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

Use hwloc for setting task affinity. #8

Closed
wants to merge 1 commit into from

Conversation

mjoras
Copy link

@mjoras mjoras commented Mar 15, 2018

Using sched_set_affinity, sched_get_affinity, and
pthread_attr_setaffinity_np are not portable beyond glibc/Linux. hwloc
has APIs for setting the affinity, so we can use those instead. The
plumbing for doing this for a thread in particular is a little annoying,
as it requires a function prior to testcase_trampoline to set the
affinity.

Using sched_set_affinity, sched_get_affinity, and
pthread_attr_setaffinity_np are not portable beyond glibc/Linux. hwloc
has APIs for setting the affinity, so we can use those instead. The
plumbing for doing this for a thread in particular is a little annoying,
as it requires a function prior to testcase_trampoline to set the
affinity.
@mjoras mjoras mentioned this pull request Mar 15, 2018
@amitay
Copy link

amitay commented Feb 19, 2019

Since the thread affinity is now set after creating the thread, it might be worthwhile to create the thread after setting process affinity (similar to what's done for processes).

A quick question. While testing your patch on freebsd 11.2, noticed that hwloc-ps does not work on freebsd. Does hwlock-ps work on netbsd? If not, how do you confirm the process/thread cpu affinity?

@antonblanchard
Copy link
Owner

Solved by #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants