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
.
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.
src
includes the implementation of the library. Just includetroy_cuda.cuh
and you are ready to go.test
includes the tests.extern
includes third-party libraries: googletest and pybind11.binder
includes the pybind11 code to encapsulate the C/C++/CUDA interfaces for python.app
includes a high-level implementation for computing matrix multiplication and 2d-convolution in HE.
- 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
- Make and install SEAL 4.0
This requires
sudo
privilige to install the binary library file.bash install_seal.sh
- CMake with
TROY_COMPARE_SEAL
andTROY_TEST
on.cd build cmake .. -DTROY_TEST=ON -DTROY_COMPARE_SEAL=ON make cd ..
- Testing
cd build ./test/timetest ./test/timetest_seal
Feel free to fork / pull request. Please cite this repository if you use it in your work.