-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmark: add thread affinity mask option #68
Conversation
Good work. However, to take full advantage of NUMA, we would have to also support having multiple datasets. It may be possible to control dataset allocation with CPU affinity because operating systems tend to allocate memory in the node that first writes to the memory page (this would have to be confirmed). |
Yes, that's my next task. I'm going to start looking into/testing hwloc for pinning caches and datasets to NUMA nodes and add to this PR. |
hwloc branch here https://github.com/jtgrassie/RandomX/tree/numa that uses multiple datasets and binds their memory to NUMA nodes. Then I'm using the affinity flag to bind threads to nodes. I'm not seeing a significant difference though, so need to investigate further before a PR of that hwloc branch. |
Fwiw, I ran multiple instances on separate NUMA nodes using numactl, don't recall seeing much impact then either. Though come to think of it, I haven't run the latest version yet. These are from the old code. |
@jtgrassie FYI: I moved the affinity files into the 'tests' directory, since it's not directly related to the RandomX library. Also the |
@tevador what was the issue with mask_to_string? I tested this pretty thoroughly and no issues. the nulls just present after the 1's and 0's to terminate the string. Also, would have been nice to preserve the files formatting (space vs tabs) as it now has a mixture. |
When built with Visual Studio, the output looked like this (for example
The whitespace characters inside the parentheses are actually null characters. |
Very weird MS behavior of printing a string with nulls then! Can you fix the indentation on the file to keep consistently though please. |
Adds a thread affinity mask option for allowing to set miner threads to specific cpus/cores. Accepts a hex or decimal value representing a bitmask.
E.g.
--threads 4 --affinity 0x1D
, equates to our 4 threadst1,t2,t3,t4
and a mask11101
, which yields:(t4, cpu4), (t3, cpu3), (t2, cpu2), (t1, cpu0)
. So cpu is the bit position (right-to-left) and each1
sequentially is the next thread.Useful for benchmarking multi-processor/NUMA node systems.