Skip to content

Commit

Permalink
Use max(1, Sys.CPU_THREADS) BLAS threads for apple aarch64. (Juli…
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod authored and pcjentsch committed Aug 18, 2022
1 parent 46b648d commit 49822f0
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 49822f0

Please sign in to comment.