A user asked us to install PhantomHFE. As this software isn’t available in EasyBuild below is a step-by-step guide to build the library and run it using SLURM as user.
This setup is based on the official PhantomHFE documentation.
Step 1: Clone the Repository
git clone --recursive https://github.com/Encryptorion-Lab/phantom-fhe.git
cd phantom-fhe
Step 2: Load Required Modules
module load foss/2023a
module load CUDA/12.3.0
module load CMake/3.26.3
module load Python/3.11.3
Step 3: Configure and Build
mkdir build
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON_BINDINGS=ON
make -j 4
The compiled Python module pyPhantom will be located in build/lib.
Step 4: Use the Python Module
To run a Python script with the module, export the path:
export PYTHONPATH=$PWD/lib:$PYTHONPATH
Test the module:
python3 -c "import pyPhantom; print('Phantom module loaded successfully')"
Step 5: Run with SLURM (sbatch)
Create a SLURM job script, e.g. phantom_job.sbatch:
#!/bin/bash
#SBATCH --job-name=phantom_ckks
#SBATCH --output=phantom_ckks.out
#SBATCH --error=phantom_ckks.err
#SBATCH --time=00:10:00
#SBATCH --partition=shared-gpu
#SBATCH --gpus=1
#SBATCH --cpus-per-task=4
module load foss/2023a
module load CUDA/12.3.0
module load CMake/3.26.3
module load Python/3.11.3
cd /path/to/phantom-fhe/
export PYTHONPATH=$PYTHONPATH:build/lib
srun python3 python/examples/ckks.py
Replace /path/to/phantom-fhe with the actual path to your PhantomHFE repository.
Example Used: python/examples/ckks.py