vernamlab / cufhe Goto Github PK
View Code? Open in Web Editor NEWCUDA-accelerated Fully Homomorphic Encryption Library
License: MIT License
CUDA-accelerated Fully Homomorphic Encryption Library
License: MIT License
test_api_gpu dies for me, every time, with Invalid Managed Memory Access, while evaluating the Nand gate (before bootstrapping occurs.) It looks like this code is running on the Host Thread, but the underlying data (in the Unified Memory) is mapped to the GPU, causing an error.
Would love a workaround, since this project looks really neat! Let me know if you need more info.
System setup:
Output:
------ Key Generation ------
------ Test Encryption/Decryption ------
Number of tests: 96
PASS
------ Initilizating Data on GPU(s) ------
------ Test NAND Gate ------
Number of tests: 96
(crashes here)
Stack trace:
Thread [1] 14501 [core: 2] (Suspended : Signal : CUDA_EXCEPTION_15:Invalid Managed Memory Access)
cufhe::Nand() at cufhe_gates_gpu.cu:50 0x7ffff7b18223
main() at test_api_gpu.cu:116 0x4048c1
system setup:
Ubuntu LTS 16.04
NVidia drivers, 418.67
CUDA Toolkit, v9.2
NVidia GeForce 940MX (Compute Capability 5.0)
when run 'make python_cpu', i got the following error below
/usr/include/boost/python/object/value_holder.hpp:137:13: error: use of deleted function ‘cufhe::Ctxt::Ctxt(const cufhe::Ctxt&)’
BOOST_PP_REPEAT_1ST(N, BOOST_PYTHON_UNFORWARD_LOCAL, nil)
^
In file included from python/lib/fhepy.cpp:23:0:
./include/cufhe.h:109:3: note: declared here
Ctxt(const Ctxt& that) = delete;
^
Makefile:97: recipe for target 'python/lib/fhepy_cpu.o' failed
make: *** [python/lib/fhepy_cpu.o] Error 1
Any idea how i should go about this? Or is there anything i can check?
Hi,I am curious about the time it takes to perform 1024 polynomial multiplication using ntt optimized in cufhe?
Have you conducted any relevant experiments?
Building with -g
flag (segfault is also w/o it, but also w/o symbols) causes sigsegv with the following output:
------ Key Generation ------
------ Test Encryption/Decryption ------
Number of tests: 1024
PASS
------ Test NAND Gate ------
Number of tests: 4
PASS
Program received signal SIGSEGV, Segmentation fault.
Debugger points out to that line:
Line 288 in ec47abb
Where lwe_sample_device_
is nullptr
p.s. thanks for your amazing work!
The whole build seems to be working for me, but the simple test results for gpu output FAIL at every time. No clue on why this happens (I guess it shouldn't?)
System setup:
Ubuntu LTS 16.04
NVidia drivers, 384.81
CUDA Toolkit, v9.0
Tesla V100-SXM2 (Compute Capability 7.0)
Output of every test:
------ Key Generation ------
------ Test Encryption/Decryption ------
Number of tests: 2560
PASS
------ Initilizating Data on GPU(s) ------
------ Test NAND Gate ------
Number of tests: 2560
0.178565 ms / gate
FAIL
------ Cleaning Data on GPU(s) ------
Hello! I'm Darren from Singapore, and I'm doing a research paper on FHE using the Nvidia GPU via cuda. I'm wondering what these sets of error mean when I'm making a CUDA object. I've cloned the repository here at cuFHE, which was initally forked from this repository. I've made sure that the files in include was succesfully copied to /usr/include, and all packages were updated and properly installed. Any help will be greatly appreciated :)
in test_api_cpu.cc,the data of private key is different from private_key_old
is there something wrong with write/read keys to/from files methods??
May I ask if cuFHE can gain accelaration from multi-GPU or even distributed computation? Thanks!
It seems this library uses the private key to encrypt data. Shouldn't this be happening with the public key or am I missing something?
I am testing some cuFHE code on a VM (so no GPU access) and just want to build the CPU version, so I ran:
make cpu
But failed with an error as Make could not find nvcc.
I was able to get compilation working by updating the Makefile, but didn't want push a fix as I am not sure if this is correct in all build configurations.
diff --git a/cufhe/Makefile b/cufhe/Makefile
index 7396594..52e64c5 100644
--- a/cufhe/Makefile
+++ b/cufhe/Makefile
@@ -70,7 +70,7 @@ $(DIR_OBJ)/test/test_api_gpu.o: test/test_api_gpu.cu
$(DIR_BIN)/libcufhe_cpu.so: $(CC_OBJ)
$(dir_guard)
- $(CU) $(FLAGS) $(CU_FLAGS) -shared -o $@ $(CC_OBJ)
+ $(CC) $(FLAGS) -shared -o $@ $(CC_OBJ)
$(DIR_BIN)/libcufhe_gpu.so: $(CU_OBJ) $(DIR_OBJ)/cufhe.o $(DIR_OBJ)/cufhe_io.o
$(dir_guard)
Hi, I was reading through the implementation of the code, and I believe that there is an off by one error in the SizeData
method for a TLWE key. As far as I understand, this should be size of Binary times degree of the polynomials (n) times the number of elements of the secret key vector (k). (k+1) would be referring to the TLWE sample size (T_N[X]^k, T_N[X]).
cuFHE/cufhe/include/cufhe_core.h
Line 162 in 1af2f2b
Part of this is just to confirm my understanding of the code, as I'm sure this is not so serious and is probably only used in size calculations!
The lwe_sample_device_ never gets initialized in cufhe_cpu.cc. This results in a segfault when the destructor is called.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.