Skip to content

consider affinity when computing active cpus on Linux #199

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

Merged
merged 1 commit into from
Jan 12, 2017

Conversation

dgrove-oss
Copy link
Contributor

If pthread_getaffinity_np is available, then use the cpuset
of the current thread to determine the number of active cpus.

@MadCoder
Copy link
Contributor

why is that better?

@dgrove-oss
Copy link
Contributor Author

It gets the right answer if the program is being run under numactl with a restricted cpu set. sysconf doesn't consider scheduler affinity.

@MadCoder
Copy link
Contributor

I see, makes sense, could you please add a comment above to explain this shortly in the .c file ? because someone is bound to wonder at some point.

If pthread_getaffinity_np is available, then use the cpuset
of the current thread to determine the number of active cpus.
@dgrove-oss dgrove-oss force-pushed the hwconfig-respect-affinity branch from 7aeabe5 to e59638d Compare January 12, 2017 17:02
@dgrove-oss
Copy link
Contributor Author

good point; added a comment & squashed commit.

@MadCoder MadCoder merged commit 967876e into swiftlang:master Jan 12, 2017
@dgrove-oss dgrove-oss deleted the hwconfig-respect-affinity branch January 12, 2017 17:14
das pushed a commit that referenced this pull request Feb 21, 2017
consider affinity when computing active cpus on Linux

Signed-off-by: Daniel A. Steffen <[email protected]>
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