Skip to content

Commit

Permalink
Use max(1, Sys.CPU_THREADS) BLAS threads for apple aarch64. (#46085)
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Jul 20, 2022
1 parent d7c56ba commit 97df6db
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stdlib/LinearAlgebra/src/LinearAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,11 @@ function __init__()
Base.at_disable_library_threading(() -> BLAS.set_num_threads(1))

if !haskey(ENV, "OPENBLAS_NUM_THREADS")
BLAS.set_num_threads(max(1, Sys.CPU_THREADS ÷ 2))
@static if Sys.isapple() && Base.BinaryPlatforms.arch(Base.BinaryPlatforms.HostPlatform()) == "aarch64"
BLAS.set_num_threads(max(1, Sys.CPU_THREADS))
else
BLAS.set_num_threads(max(1, Sys.CPU_THREADS ÷ 2))
end
end
end

Expand Down

0 comments on commit 97df6db

Please sign in to comment.