Skip to content

Commit a8b3994

Browse files
authored
Set OPENBLAS_NUM_THREADS=1 on local Distributed workers (#47803)
This should prevent LinearAlgebra from trying to increase our OpenBLAS thread count in its `__init__()` method when we're not trying to enable threaded BLAS.
1 parent e5a82fb commit a8b3994

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

stdlib/Distributed/src/managers.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,13 @@ function launch(manager::LocalManager, params::Dict, launched::Array, c::Conditi
487487
if get(env, "JULIA_DEPOT_PATH", nothing) === nothing
488488
env["JULIA_DEPOT_PATH"] = join(DEPOT_PATH, pathsep)
489489
end
490+
491+
# If we haven't explicitly asked for threaded BLAS, prevent OpenBLAS from starting
492+
# up with multiple threads, thereby sucking up a bunch of wasted memory on Windows.
493+
if !params[:enable_threaded_blas] &&
494+
get(env, "OPENBLAS_NUM_THREADS", nothing) === nothing
495+
env["OPENBLAS_NUM_THREADS"] = "1"
496+
end
490497
# Set the active project on workers using JULIA_PROJECT.
491498
# Users can opt-out of this by (i) passing `env = ...` or (ii) passing
492499
# `--project=...` as `exeflags` to addprocs(...).

0 commit comments

Comments
 (0)