Skip to content

Commit

Permalink
[LinearAlgebra] Support more env variables to set OpenBLAS threads (#…
Browse files Browse the repository at this point in the history
…46118)

(cherry picked from commit 6009ae9)
  • Loading branch information
giordano authored and KristofferC committed Aug 7, 2022
1 parent 87d89f7 commit 3e4646d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,8 @@ function __init__()
# register a hook to disable BLAS threading
Base.at_disable_library_threading(() -> BLAS.set_num_threads(1))

if !haskey(ENV, "OPENBLAS_NUM_THREADS")
# https://github.com/xianyi/OpenBLAS/blob/c43ec53bdd00d9423fc609d7b7ecb35e7bf41b85/README.md#setting-the-number-of-threads-using-environment-variables
if !haskey(ENV, "OPENBLAS_NUM_THREADS") && !haskey(ENV, "GOTO_NUM_THREADS") && !haskey(ENV, "OMP_NUM_THREADS")
@static if Sys.isapple() && Base.BinaryPlatforms.arch(Base.BinaryPlatforms.HostPlatform()) == "aarch64"
BLAS.set_num_threads(max(1, Sys.CPU_THREADS))
else
Expand Down

0 comments on commit 3e4646d

Please sign in to comment.