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

Fix Issue 19513 - Use sched_getaffinity(2) to get the number of CPU cores if abailable #7030

Merged
merged 1 commit into from May 28, 2019

Conversation

kubo39
Copy link
Contributor

@kubo39 kubo39 commented May 24, 2019

Currently std.parallelism.totalCPUs is implemented by
sysconf(_SC_NPROCESSORS_ONLN) on Posix platoform. However, on GNU/Linux,
usable number of processors may be restricted if a process runs in
container. In case it's better to use sched_getaffinity(2).

ref: http://man7.org/linux/man-pages/man1/nproc.1.html

@kubo39 kubo39 requested a review from andralex as a code owner May 24, 2019 03:33
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @kubo39! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
19513 enhancement Use sched_getaffinity(2) to get the number of CPU cores if available

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + phobos#7030"

@thewilsonator thewilsonator added the 72h no objection -> merge The PR will be merged if there are no objections raised. label May 24, 2019
cores if available

Currently std.parallelism.totalCPUs is implemented by
sysconf(_SC_NPROCESSORS_ONLN) on Posix platoform. However, on GNU/Linux,
usable number of processors may be restricted if a process runs in
container. In case it's better to use sched_getaffinity(2).

ref: http://man7.org/linux/man-pages/man1/nproc.1.html
@thewilsonator thewilsonator added auto-merge and removed 72h no objection -> merge The PR will be merged if there are no objections raised. labels May 28, 2019
@dlang-bot dlang-bot merged commit 0be618b into dlang:master May 28, 2019
@kubo39 kubo39 deleted the issue-19513 branch May 29, 2019 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants