You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use jl_effective_threads for container-aware CPU detection (#59916)
👨 It seems to me we should use the effective thread number basically
everywhere when defaulting to running some threaded workload. Running
with the raw cpu threads will explode quickly when running in a
constrained environment.
-----
🤖
Julia was not respecting container CPU limits (Docker --cpus, Kubernetes
CPU limits, cgroups) in several places, leading to oversubscription when
determining parallelism.
Changes:
- src/aotcompile.cpp:2013: Use jl_effective_threads() for LLVM
compilation threads
- src/threading.c:760: Use jl_effective_threads() for GC thread
capping/warnings
- src/threading.c:842: Use jl_effective_threads() for JULIA_EXCLUSIVE
mode validation
- base/sysinfo.jl: Add Sys.EFFECTIVE_CPU_THREADS constant for user
access
- test/runtests.jl:119: Use Sys.EFFECTIVE_CPU_THREADS for test worker
processes
- base/precompilation.jl:529: Use Sys.EFFECTIVE_CPU_THREADS for
precompilation tasks
- base/util.jl:697: Use Sys.EFFECTIVE_CPU_THREADS for Base.runtests()
default
The existing jl_effective_threads() function returns
min(jl_cpu_threads(),
uv_available_parallelism()), where uv_available_parallelism() respects
cgroup limits.
--------
0 commit comments