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

Doesn't take CPU affinity into account #12

Closed
jonhoo opened this issue Jun 19, 2015 · 2 comments
Closed

Doesn't take CPU affinity into account #12

jonhoo opened this issue Jun 19, 2015 · 2 comments

Comments

@jonhoo
Copy link

jonhoo commented Jun 19, 2015

While num_cpus() gives the correct number of physical CPUs, it does not take into account which of those CPU's the current process is actually allowed to use. It would be neat to be able to specify which of the two numbers to get.

For example, consider a simple num_cpus program that just prints the value of num_cpus::get();, and then exits:

$ nproc
80
$ num_cpus
80
$ taskset -c 0,1 nproc
2
$ taskset -c 0,1 num_cpus
80

If it's at all helpful, the source for nproc (which is included in coreutils) can be seen here.

jonhoo added a commit to jonhoo/volley that referenced this issue Jun 19, 2015
This is necessary because num_cpus currently does not take core affinity
into account: seanmonstar/num_cpus#12
jonhoo added a commit to jonhoo/volley that referenced this issue Jun 19, 2015
This is necessary because num_cpus currently does not take core affinity
into account: seanmonstar/num_cpus#12
@seanmonstar
Copy link
Owner

I'd welcome a PR!

@jonhoo
Copy link
Author

jonhoo commented Jun 19, 2015

Seems like unless we want to do some deep systems level hackery, we'll have to wait for rust-lang/rfcs#819

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

No branches or pull requests

2 participants