DLTcollab / dcurl

Hardware-accelerated Multi-threaded IOTA PoW, drop-in replacement for ccurl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Determine the thread pool size based on the physical CPU

marktwtn opened this issue · comments

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:

  • First of all, the thread pool size must be changed to allow 2 PoW being calculated at the same time.
  • Second, the thread number should be modified since using (maximum logical CPU - 1) number of threads in a single PoW is contradicts to calculating (threads per core) number of PoW at the same time.

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.