-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
jl_effective_threads
not aware of CFS cpu limit (inside Docker container)
#46226
Comments
jl_effective_threads
aware of CFS cpu limit (useful for inside Docker container)jl_effective_threads
not aware of CFS cpu limit (useful for inside Docker container)
jl_effective_threads
not aware of CFS cpu limit (useful for inside Docker container)jl_effective_threads
not aware of CFS cpu limit (inside Docker container)
bump |
this was fixed in: |
nvm, @gbaraldi tried checking with rust-lang/rust#92697 using this rust snippet: fn main() {
println!("{:?}", std::thread::available_parallelism()); // prints Ok(3)
} and I get
|
Maybe it's better to follow in this case, Rust is doing something wrong so closing the issue again... |
For reference Java also follows the quota/period variables. So there might be some discussion warranted, but I don't think it's a big priority. |
For posterity sake, this is what
So if we calculate an example with a period of 100ms and a quota of 320ms, on a machine with 48 physical cores, we can chose to run
The reason for these numbers is simple - since the quotas are measured in cpu time and the period is 100ms walltime, that means in 100ms walltime a 48 core cpu has a budget of 480ms cputime. With the above setting, we get up to 320ms of that budget which we can share across cores as we see fit. Hence, utilizing 32 cores completely already uses the 320ms of the budget and similarly, utilizing 48 cores to 66.6% also uses 320ms. Ultimately, the difference in threads and whether it's beneficial for performance depends on the workload. Numerical work that does a lot of work will see a benefit from running with 100% utilization, due to caching effects. On the other hand, a web server will likely see a benefit from running with 66% utilization, since there is likely going to be a lot of I/O waiting per thread/task, so running with more threads that get blocked can mean more work getting done in the same amount of time, due to being able to take advantage of more physical cores. So if there is something to be done here, I'd say a switch between "try to utilize cores fully" and "give me the number of physical threads available" would be the most appropriate, although I question the usefulness since we can already set the number of threads explicitly anyway and if you're able to set the cpu quota, you should also be in the position to set the startup threads of julia. The "safe" default is though to follow the formula |
looks like the upstream has merged, what should we do here? |
Looks like libuv now reports the correct available parallelism through |
Would a PR switching to using that be potentially accepted? |
Note that our fork of libuv doesn't currently included libuv/libuv#4278, which was merged a couple of weeks after our fork was last synced with upstream. We will have to wait for the next sync of our libuv to benefit from that change |
Based on this comment, probably yes (but note again that our libuv doesn't contain the fix for cgroups) |
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)
amazing, thanks: [16:03] jiling-notebook-1:~/research_notebooks $ julia --startup-file=no -t auto -e "println(Threads.nthreads())"
128
[16:23] jiling-notebook-1:~/research_notebooks $ julia +nightly --startup-file=no -t auto -e "println(Threads.nthreads())"
19 |
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)
Corresponding PR to Yggdrasil: JuliaPackaging/Yggdrasil#9337. This build includes backports of libuv/libuv#4278 (useful for for #46226) and libuv/libuv#4521 (useful for #55592)
c.f. https://stackoverflow.com/questions/65551215/get-docker-cpu-memory-limit-inside-container
Should
"auto"
be aware of the fact that the container has a limited CPU? for example if we seewe should set number of threads to 4 instead of, in my case, 128
The text was updated successfully, but these errors were encountered: