Skip to content

Commit 101f766

Browse files
authored
Added note to BLAS.[g|s]et_num_threads about Apple Accelerate not supporting it (#1195)
Per the documentation for `AppleAccelerate.jl`, `BLAS.get_num_threads()` returns a hard coded default when using `AppleAccelerate`. This PR simply adds a warning message when this function is called to alert the user in the console itself.
1 parent 5aca26f commit 101f766

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/blas.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ Set the number of threads the BLAS library should use equal to `n::Integer`.
129129
130130
Also accepts `nothing`, in which case julia tries to guess the default number of threads.
131131
Passing `nothing` is discouraged and mainly exists for historical reasons.
132+
133+
!!! note
134+
Some BLAS libraries, such as Apple Accelerate, cannot be configured to use a fixed number of threads.
135+
For these backends, `set_num_threads()` is a no-op. See also [`get_num_threads`](@ref).
132136
"""
133137
set_num_threads(nt::Integer)::Nothing = lbt_set_num_threads(Int32(nt))
134138
function set_num_threads(::Nothing)
@@ -148,6 +152,10 @@ Get the number of threads the BLAS library is using.
148152
149153
!!! compat "Julia 1.6"
150154
`get_num_threads` requires at least Julia 1.6.
155+
156+
!!! note
157+
Some BLAS libraries, such as Apple Accelerate, cannot be configured to use a fixed number of threads.
158+
For these backends, `get_num_threads()` always returns `1`. See also [`set_num_threads`](@ref).
151159
"""
152160
get_num_threads()::Int = lbt_get_num_threads()
153161

0 commit comments

Comments
 (0)