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
Add numa-balanced mode to hpx::bind, spread cores over numa domains #2900
Conversation
std::size_t num_threads = affinities.size(); | ||
num_pus.resize(num_threads); | ||
// numa nodes | ||
std::size_t num_numas = (std::max)(std::size_t(1),t.get_number_of_numa_nodes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add a fallback to the number of sockets here if the kernel misses NUMA support? We do that already in a couple of places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really any point. if the kernel lacks numa support then asking for numa-balanced is meaningless anyway. Let it default to 1 domain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about reporting an error at startup if the user asks for NUMA-domain awareness on a machine which does not have NUMA domains.
} | ||
// how many threads should go on each domain | ||
for (std::size_t n=0; n<num_numas; ++n) { | ||
num_threads_numa[n] = num_threads*num_cores_numa[n]/cores_t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be rounded up, in the case where, for example, 1 thread is requested, we end up with 0 threads per numa domain.
That fixes the 1 thread and any odd number requested - and also ensures that the rounding up does not oversubscribe the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This fixes #2899