Team members: Adhitya Mangudy Venkata Ganesh, Nicola Lawford, Ishan Satish Pednekar, Li Xuan Tan
Problem: Performing singular value decomposition on a matrix encrypted using fully homomorphic encryption.
<TODO: figure out OS quirks?>
This script builds and installs OpenFHE and OpenFHE-Python for FHERMA challenges.
git clone --recursive https://github.com/Fherma-challenges/toolchain
cd toolchain
sh prepare_env_debian.shIf you are using Windows, run on WSL and use the following before running prepare_env_debian.sh to ensure line endings are correct:
sed -i 's/\r$//' prepare_env_debian.sh<TODO: figure out if pip install works?>
- Install Docker Desktop 4.37.1 or later. If you are using windows, ensure WSL backend is configured
- Run
docker pull yashalabinc/fherma-validator. - From the root of this repo, run
sudo docker run -ti -v $(pwd):/fherma yashalabinc/fherma-validator --project-folder=/fherma/openfhe-python --testcase=/fherma/fherma-svd/tests/test_case.json. - A
result.jsonfile will be generated in the project folder. - Troubleshooting: The
fherma-svddirectory should contian atestsdirectory with.jsonfiles representing test cases. Theopenfhe-pythondirectory should contain your python solution. See Docker validator provided by FHERMA. - Note: We may need to edit the project structure to match the challenge format.
- Get an account following the startup guide and SSH into a Centos 7 node.
salloc -p mit_normal -c 12 --mem=54Gto request a machine with 12 CPU/54GB RAM just like the FHERMA configuration, on themit_normalORCD cluster.- Once logged in, run the following:
module purgemodule load gcc/12.2.0module load cmake/3.27.9
- Install OpenFHE by compiling from source as per official instructions. For CMake, use the command
CC=$(which gcc) CXX=$(which g++) cmake \
-DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc" \
-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
-DCMAKE_SHARED_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
-DCMAKE_INSTALL_PREFIX=~/openfhe-install ..
..
where the last line points to a userspace install location (since we don't have sudo access on Engaging). Run an example or two to verify successful installation.
- Default ORCD modules don't have recent-enough Python versions. Load ORCD's conda distribution with
module load miniforge/25.11.0-0and verify thatpython --versionreturns 3.10+. - Create a virtual environment, activate it and
pip install "pybind11[global]". - Install OpenFHE-Python by compiling from source as per official instructions. For CMake, use
CC=$(which gcc) CXX=$(which g++) cmake \
-DCMAKE_CXX_FLAGS="-static-libstdc++ -static-libgcc" \
-DCMAKE_SHARED_LINKER_FLAGS="-static-libstdc++ -static-libgcc" \
-DCMAKE_PREFIX_PATH=~/openfhe-install ..
- Add OpenFHE-Python install to PYTHONPATH:
export PYTHONPATH=/home/< your login here >/openfhe-python/build:$PYTHONPATH. Python examples should run fine now. - To use the validator, use the cluster's Singularity/Apptainer install (compatible with Docker images). Run
singularity pull fherma-validator.sif docker://yashalabinc/fherma-validatorto pull the Dockerfile and save it locally, thensingularity run --bind $(pwd):/fherma ./fherma-validator.sif --project-folder=/fherma/openfhe-python --testcase=/fherma/fherma-svd/tests/test_case.jsonto run the validation script.
openfhe-pythonimplementation template from OpenFHE- FHERMA Challenge - Singular Value Decomposition
- Docker validator provided by FHERMA
- OpenFHE-Python library
- FHERMA challenge toolchain
- OpenFHE Documentation