troy := seal-cuda
June 4, 2024 ยท View on GitHub
Notice
We have re-implemented this library and introduced a faster NTT-kernel and easier-to-use python packaging workflow. Be sure to checkout our new open-sourced repository at troy-nova.
Introduction
The homomorphic encryption library implemented on GPU. Troy includes BFV, BGV, and CKKS schemes. Its implementation referred to the Microsoft SEAL library.
For reference, this library inherently includes a CPU version of the schemes, but you can just use the GPU part by using namespace troyn.
Brief usage
The interfaces (classes, methods, etc.) are basicly the same as in SEAL, but you need to initialize the CUDA kernels (troyn::KernelProvider::initialize()) before using any of the GPU related classes. You can just call this at the beginning of your programs.
See test/timetest.cu for example.
Code structures
srcincludes the implementation of the library. Just includetroy_cuda.cuhand you are ready to go.testincludes the tests.externincludes third-party libraries: googletest and pybind11.binderincludes the pybind11 code to encapsulate the C/C++/CUDA interfaces for python.appincludes a high-level implementation for computing matrix multiplication and 2d-convolution in HE.
How to run
- Build the basic library
mkdir build cd build cmake .. -DTROY_TEST=ON # or OFF(default), if you don't want to run tests make cd .. - Run tests
cd build ctest ./test/timetest cd .. - Make the module for python
bash makepackage.sh
Comparing with CPU Microsoft SEAL-4.0
- Make and install SEAL 4.0
This requires
sudoprivilige to install the binary library file.bash install_seal.sh - CMake with
TROY_COMPARE_SEALandTROY_TESTon.cd build cmake .. -DTROY_TEST=ON -DTROY_COMPARE_SEAL=ON make cd .. - Testing
cd build ./test/timetest ./test/timetest_seal
Contribute
Feel free to fork / pull request. Please cite this repository if you use it in your work.