DLTcollab / dcurl

Hardware-accelerated Multi-threaded IOTA PoW, drop-in replacement for ccurl
MIT License
41 stars 23 forks source link

Determine the thread pool size based on the physical CPU #191

Closed marktwtn closed 5 years ago

marktwtn commented 5 years ago

The dcurl before and after integrating the thread pool uses the (maximum logical CPU - 1) as the number of threads for a single PoW. However, dcurl also allows calculating 2 PoW at the same time, which is the number of threads per core. And the number of logical CPU is equal to the number of physical CPU * threads per core.

Before integrating the thread pool, dcurl may create the threads as many as the twice number of the logical CPU. After integrating the thread pool, dcurl set the pool size as (maximum logical CPU - 1). And it causes the PoW to wait for the threads returning from the previous PoW.

Goal:

marktwtn commented 5 years ago

I found out that it is hard to get the physical CPU number and hyperthreading data without parsing CPU information by the programmer. get_nprocs_conf() only gives us the logical CPU number, and the related function sysconf() can not give us the physical CPU number, either.

It would be a lot of easier if we just modify dcurl to do 1 PoW at the same time. However, I would like to try the harder way to fit the original dcurl design.