herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
450 stars 152 forks source link

Multi-thread C api for mclBn_millerLoopVec #133

Closed fateh321 closed 2 years ago

fateh321 commented 2 years ago

I want to use the function mclBn_millerLoopVec() to implement cryptographic pairing. In order to speed up this processing for large vector sizes, I want to parallelize this function using multi-threading and distributing it over all cores. Is there a feature or flag for this in the API. Thanks a lot.

herumi commented 2 years ago

I've added millerLoopVecMT.

https://github.com/herumi/mcl/blob/dev/sample/mt_test.cpp

Could you try it?

make bin/mt_test.exe MCL_USE_OMP=1
bin/mt_test.exe -n 1000 -cpu 3
herumi commented 2 years ago

C api is https://github.com/herumi/mcl/blob/dev/include/mcl/bn.h#L470-L472 .

fateh321 commented 2 years ago

It works well. Thanks a ton!