Is the Julia linear algebra multithreaded?


#1

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?


#2

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.


#3

Excellent, thank you very much!


#4

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?


#5

They’re independent.


#6

Splendid. Ta!


#7

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.