Skip to content

Commit d67f771

Browse files
committed
add news entry and function cross-reference
1 parent 61ff04a commit d67f771

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Standard library changes
5858

5959
#### LinearAlgebra
6060

61+
* A new unexported function `BLAS.with_num_threads` allows you to temporarily change the number of
62+
BLAS threads. ([#41785])
63+
6164
#### Markdown
6265

6366
#### Printf

stdlib/LinearAlgebra/src/blas.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ Set the number of threads the BLAS library should use equal to `n::Integer`.
120120
121121
Also accepts `nothing`, in which case julia tries to guess the default number of threads.
122122
Passing `nothing` is discouraged and mainly exists for historical reasons.
123+
124+
See also [`with_num_threads`](@ref BLAS.with_num_threads) to temporarily change
125+
number of BLAS threads.
123126
"""
124127
set_num_threads(nt::Integer)::Nothing = lbt_set_num_threads(Int32(nt))
125128
function set_num_threads(::Nothing)
@@ -168,7 +171,7 @@ restore to previous threads setting.
168171
169172
# Example
170173
171-
The result differs on different machines.
174+
Depending on the number of available CPU cores, the result can be different:
172175
173176
```julia
174177
julia> BLAS.get_num_threads()
@@ -188,6 +191,9 @@ julia> BLAS.get_num_threads()
188191
This function is not thread safe. If there are multiple
189192
threads calling BLAS routines, then the threads they are
190193
using will also be changed until this function finishes.
194+
195+
See also [`set_num_threads`](@ref BLAS.set_num_threads) to permanently change
196+
number of BLAS threads.
191197
"""
192198
function with_num_threads(f, num_threads::Integer)
193199
prev_num_threads = BLAS.get_num_threads()

0 commit comments

Comments
 (0)