Open Lionhehao opened 1 day ago
Based on previous questions and answers regarding the GPU support in Pyfhel, you can refer to these issues: #205, #171. All in all, Pyfhel depends on the underlying backend FHE libs, which have not yet been ported to GPU.
@Lionhehao I suspect two things migth be in play:
@Lionhehao I suspect two things migth be in play:
- The multiplication in Pyfhel might be using parallelisation across several CPUs.
- The multiplication happens in-place in Pyfhel, if you are running many multiplications in SEAL creating new objects every time you might be paying some extra computational cost.
@ibarrond Thank you very much for your answer, but what confuses me is whether homomorphic multiplication can really run so fast on CPU? It seems that the time it takes to perform a homomorphic multiplication is only 1ms. Did your homomorphic multiplication test also take such a short time? Below is my test code, I don't know if there is anything wrong.
I found that openFHE seems to use parallelization under the hood, which may be one of the reasons. I guess openfhe may have made some other optimizations in other underlying operations. If the test is correct, I will no longer use the seal library hahaha. Thank you again.
I first wrote a code for dense state matrix multiplication based on the seal library. After transplanting it to the pyfhel library, I found that the speed was much faster. So I tested the ciphertext multiplication of ckks locally.
Without performing re-linearization, the time consumption of 1000 multiplications was: seal 48s c++ pyfhel 1s python
This makes me feel unbelievable. My cpu is i3-10100f. Does pyfhel use gpu acceleration?