Skip to content

Commit c5b51fe

Browse files
ViralBShahLilithHafner
authored andcommitted
Remove openblas set_num_threads in julia __init__ (JuliaLang#42442)
* Remove openblas_set_num_threads in julia __init__ * Remove test no longer needed.
1 parent 1a167f9 commit c5b51fe

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

base/Base.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,18 +462,9 @@ end
462462
if is_primary_base_module
463463
function __init__()
464464
# try to ensuremake sure OpenBLAS does not set CPU affinity (#1070, #9639)
465-
if !haskey(ENV, "OPENBLAS_MAIN_FREE") && !haskey(ENV, "GOTOBLAS_MAIN_FREE")
465+
if !haskey(ENV, "OPENBLAS_MAIN_FREE")
466466
ENV["OPENBLAS_MAIN_FREE"] = "1"
467467
end
468-
# And try to prevent openblas from starting too many threads, unless/until specifically requested
469-
if !haskey(ENV, "OPENBLAS_NUM_THREADS") && !haskey(ENV, "OMP_NUM_THREADS")
470-
cpu_threads = Sys.CPU_THREADS::Int
471-
if cpu_threads > 8 # always at most 8
472-
ENV["OPENBLAS_NUM_THREADS"] = "8"
473-
elseif haskey(ENV, "JULIA_CPU_THREADS") # or exactly as specified
474-
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
475-
end # otherwise, trust that openblas will pick CPU_THREADS anyways, without any intervention
476-
end
477468
# for the few uses of Libc.rand in Base:
478469
Libc.srand()
479470
# Base library init

stdlib/Distributed/test/distributed_exec.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,6 @@ function test_add_procs_threaded_blas()
10311031
@warn "Skipping blas num threads tests due to unsupported blas version"
10321032
return
10331033
end
1034-
@test master_blas_thread_count <= 8 # check that Base set the environment variable in __init__ before LinearAlgebra dlopen'd it
10351034

10361035
# Test with default enable_threaded_blas false
10371036
processes_added = addprocs_with_testenv(2)

0 commit comments

Comments
 (0)