Posts

Showing posts from July, 2022

[How To] Install Pyfhel in macOS

Image
  Tested on Intel-based (x86_64) MacBook, not tested on M1/M2 (ARM) Apple Clang does not support  -fopenmp  and  -libseal , use GCC or CLANG % git clone --recursive https://github.com/ibarrond/Pyfhel 2.a) create  requirements.txt  file "setuptools<=60.9", "wheel", "cython>=3.0.0a9", "numpy>=1.20", "cmake>=3.15", "toml>=0.10" 2.b)  % pip3 install -r requirements.txt edit  pyproject.toml Line #111 [ Afhel ] extra_compile_args {Darwin = ["-std=c++17","-O3","-fopenmp"]}, extra_link_args {Darwin = ["-fopenmp","-dynamiclib"]}, Repeat the above for [ CYTHON EXTENSIONS ]

[Solved] Jupyter notebook raises Module Not Found Error

Image
I recently ran into issues on my MacBook with Jupyter notebooks, where it could not find any packages and was throwing "ModuleNotFoundError: No module named ****" for several libraries. I already had these packages installed but somehow Jupyter python kernel could not find it. I tried to install these packages in the notebook cells with the command !pip install **** but this did not help either. I also tried %brew reinstall jupyterlab and that did not work as well. Finally, I found a fix. Solution: Step-1: Install/upgrade jupyter packages: % pip3 install --upgrade jupyter notebook jupyterlab Step-2: Run jupyter with this command: % jupyter-lab

[Solved] ld: library not found for -lntl

Image
NTL: A Library for doing Number Theory NTL is a high-performance, portable C++ library providing data structures and algorithms for manipulating signed, arbitrary length integers and for vectors, matrices, and polynomials over the integers and over finite fields. You might face a linking error with NTL in macOS using the Apple Clang compiler: % make                                 Consolidate compiler generated dependencies of target degrees [ 25%] Linking CXX executable degrees ld: library not found for -lntl clang: error: linker command failed with exit code 1 (use -v to see invocation) Solution: % brew install NTL % export LIBRARY_PATH=/usr/local/lib % make This linker error means the build was told to link NTL, the C++ number theory library, but cannot find it. NTL provides arbitrary length integers and operations on polynomials and matrices over rings and finite fields. Installing NTL and poin...

[How To] Run MinimaxComp_degrees in macOS

Image
MinimaxComp_degrees This algorithm finds optimized degrees for comparison/max/ReLU algorithms using minimax composite polynomial on the RNS-CKKS scheme, which was proposed in https://ieeexplore.ieee.org/document/9517029 and https://eprint.iacr.org/2021/1215 . How to run on macOS using the Apple Clang compiler: 1. % brew install NTL 2. % export LIBRARY_PATH=/usr/local/lib 3. % git clone  https://github.com/eslee3209/MinimaxComp_degrees 4. % cd MinimaxComp_degrees 5. % cmake -S . -B build 6. % cd build 7. % make 8. % ./degrees Output: ------------------------------------ alpha: 20 epsilon: 0.2002716064453125e-4 mintime: 162 depth: 22 0.39825903512705770933e-4 7 13 15 15 59   This guide runs MinimaxComp_degrees on macOS, an algorithm that finds optimized polynomial degrees for comparison, max, and ReLU operations under the RNS-CKKS homomorphic encryption scheme, based on the referenced research. CKKS can only evaluate polynomials on encrypted data, so non-polyn...

[How To] Install CRC RevEng on macOS

Image
CRC RevEng CRC RevEng is a portable, arbitrary-precision CRC calculator and algorithm finder. It calculates CRCs using any 111 preset algorithms or a user-specified algorithm to any width. It calculates reversed CRCs to give the bit pattern that produces a desired forward CRC. CRC RevEng also reverse-engineers any CRC algorithm from good, correctly formatted message-CRC pairs and optional known parameters. It comprises powerful input interpretation options. Installation instructions for macOS: 1. Download reveng from SourceForge:  https://sourceforge.net/projects/reveng/files/ 2. Unzip the downloaded reveng zip file 3. % cd Downloads/reveng-3.0.3 4. % make gcc -O3 -Wall -ansi -fomit-frame-pointer -DPRESETS -DBMPTST -o bmptst bmpbit.c ( ./bmptst && touch bmptst ) || ( rm bmptst bmptst.exe && false ) reveng: configuration fault.   Update config.h with these definitions and recompile: #define BMP_BIT   64 #define BMP_SUB   32 rm: bmptst.exe: No suc...

Top 13 Free Email Newsletters

Image
The following is the list of the 13 free most popular newsletters: 1440 Below the Fold Benedict’s Newsletter Brain Pickings Morning Brew NextDraft NPR’s Life Kit NYTimes Morning Briefing The Elevator The GIST The Hustle The Lefsetz Letter The Moz Top Ten This is a curated list of free newsletters spanning general news, technology, and culture, for anyone who wants a quick daily or weekly digest in their inbox. A good newsletter saves time by summarizing what matters so you do not have to chase a dozen sites. Every option listed is free to subscribe to.

[Solved] frame.append method is deprecated and will be removed from pandas

Image
Code: all_results = all_results.append(current_result) Error: /var/folders/wh/tdg0ff9s1wl59234d5l27_gc0000gn/T/ipykernel_98654/2691205834.py:15: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. all_results = all_results.append(current_result) Fix: all_results = pd.concat([all_results, current_result]) This warning appears because DataFrame.append was deprecated and later removed from pandas, so code that built a frame by appending one row or frame at a time needs updating. The replacement is pandas.concat, which combines a list of frames in one call. Collecting the pieces in a list and concatenating once at the end is also faster than repeated appends.

[Solved] seaborn: decrease the size of the markers

Image
Code: ax = sns.swarmplot(y="time_taken", x="dtype", data=all_results, color=".25") Error: /usr/local/Cellar/jupyterlab/3.3.2/libexec/lib/python3.9/site-packages/seaborn/categorical.py:1296: UserWarning: 35.9% of the points cannot be placed; you may want to decrease the size of the markers or use stripplot. warnings.warn(msg, UserWarning) Fix: ax = sns.swarmplot(y="time_taken", x="dtype", data=all_results, color=".25", size=3.25 ) This seaborn warning appears when a swarm plot cannot place every point without overlap, so some are dropped. It is a sign the markers are too large for the amount of data. Reducing the marker size with the size parameter, or switching to a strip plot, lets all points show. Both are quick changes to the plotting call.