intel / hexl

Intel:registered: Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption
https://intel.github.io/hexl
Apache License 2.0
219 stars 50 forks source link

Creation of Custom Thread Pool #135

Closed joserochh closed 1 year ago

joserochh commented 2 years ago

So far the thread pool is meant to be used from one single main thread. Protection was added in case multiple threads try to use the thread pool in parallel. If the thread pool is busy while a parallel thread try to add new tasks then those tasks will be immediately run on the same thread sequentially. In other words, any other thread trying to use a busy thread pool wont be blocked waiting for resources. However, parallel thread pool edition (Adding/Removing threads) is blocked until any other thread has finished updating or using the thread pool.

skmono commented 2 years ago

Unit-test on Windows 10 IceLake system fails on the following tests:

[ RUN      ] ThreadPool.setup_num_threads_env_var
C:\Users\monol\Documents\WORKS\intel_hexl\hexl\test\test-thread-pool.cpp(112): error: Expected equality of these values:
  value
    Which is: 1
  max_or_default
    Which is: 8
[  FAILED  ] ThreadPool.setup_num_threads_env_var (0 ms)
[ RUN      ] ThreadPool.setup_ntt_calls_env_var
C:\Users\monol\Documents\WORKS\intel_hexl\hexl\test\test-thread-pool.cpp(172): error: Expected equality of these values:
  value
    Which is: 0
  HEXL_DEFAULT_NTT_PARALLEL_DEPTH
    Which is: 1
[  FAILED  ] ThreadPool.setup_ntt_calls_env_var (0 ms)
[  FAILED  ] 2 tests, listed below:
[  FAILED  ] ThreadPool.setup_num_threads_env_var
[  FAILED  ] ThreadPool.setup_ntt_calls_env_var