Is the Julia linear algebra multithreaded? I think I read somewhere that it isn’t, but I can’t find that text anymore. Does anyone know for sure?
It is multithreaded. You can use BLAS.set_num_threads(1)
if you want single threaded.
This also applies to many LAPACK functions.
The default is set to the number of physical cores, not threads. Eg, eigfact would churn away at 1600% CPU on my threadripper for huge matrices.
Excellent, thank you very much!
Would you by any chance also know how BLAS.set_num_threads
interacts with JULIA_NUM_THREADS
? Is it independent of it, or is it only allowing the number of threads to be set up to this number?
They’re independent.
Splendid. Ta!
In case someone wants to see what BLAS
number of threads is currently set to: https://github.com/JuliaLang/julia/blob/251a501def6a52d497784ad1ca8206579d814bce/stdlib/Distributed/test/distributed_exec.jl#L918
Note that one has to change LinearAlgebra
to LinAlg
for julia version < 0.7.