Skip to content
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

Merged
merged 2 commits into from Sep 20, 2017

Conversation

biddisco
Copy link
Contributor

This fixes #2899

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());
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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;
Copy link
Member

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.

@biddisco
Copy link
Contributor Author

That fixes the 1 thread and any odd number requested - and also ensures that the rounding up does not oversubscribe the node

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@sithhell sithhell merged commit 157d3a0 into master Sep 20, 2017
@sithhell sithhell deleted the numa_balanced branch September 20, 2017 22:45
@biddisco biddisco moved this from Work in Progress to completed in resource partitioner/manager work Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

hpx::bind does not have a mode that balances cores over numa domains
3 participants