-
Notifications
You must be signed in to change notification settings - Fork 502
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 std:: thread:: available_parallelism() instead of num_cpus dependency #937
Conversation
We have an RFC for that, setting policy for at least one year. Right now that would be 1.52, while we're currently still sitting on the last MSRV bump to 1.36. We could
Yeah, that's what |
OK, quite a while to wait then. |
I just wanted to add that AFAIK, This seems especially relevant as Rayon-based programs will often aim to saturate the detected number of hardware threads so this sounds like it could lead to significant oversubscription if cgroups are involved. |
That's true -- cgroup support is coming in 1.61, per rust-lang/rust#92697. |
Just updating here that it has landed now that 1.61 is released :). |
What about making the |
That cgroup support was only for cgroupv2, and this caused a regression for cgroupv1 users when Cargo switched from
Then we would have one thread if the feature is not enabled? That's not great... |
I meant the |
Just to note, Rust 1.64.0 added cgroupv1 support in rust-lang/rust#97925. |
Going by our policy, 1.64.0 will be a year old tomorrow, so we can merge this as long as I don't publish too soon. :) However, I think I'll leave the strict MSRV at 1.63 (from #948) anyway, because that keeps us compatible with the system rustc on Debian 12 (bookworm), where AFAICS they use cgroups-v2 by default anyway. bors r+ |
937: Use std:: thread:: available_parallelism() instead of num_cpus dependency r=cuviper a=andrewdavidmackenzie From rust 1.59 we have a call for available_parallelism() in the std library and we can remove the dependency on num_cpu. Open questions for maintainers: - what is the minimum version of rust that you want to support - what is the best default value when the call to get parallelism fails? I chose "1". Co-authored-by: Andrew Mackenzie <andrew@mackenzie-serres.net> Co-authored-by: Josh Stone <cuviper@gmail.com>
Canceled. |
(fixed a typo in docs) bors r+ |
Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page.
|
From rust 1.59 we have a call for available_parallelism() in the std library and we can remove the dependency on num_cpu.
Open questions for maintainers: