How to ensure `inv()` is multi-threaded?

I’m running a code that constructs Fisher matrices and then inverts them to obtain the covariance matrices. The matrices end up ~16000x16000 in size.

On my laptop the call to inv() is multi-threaded, but on the local university supercomputer it runs single-threaded on a node with 20 cores. How can I ensure it runs multi-threaded there as well? Julia was installed by downloading the binaries from julialang.org.

Moreover, for my application it would be great to be able to choose between a parallelized inv() and a serial inv(). This is because the construction of the Fisher matrix can be parallelized and contains calls to inv(). Is it possible to choose?

Thanks, Henry

Not sure why that would happen, but you can use https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.BLAS.set_num_threads.

Thank you @tkoolen! That is exactly what I was looking for.

1 Like