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

**URL:** <https://discourse.julialang.org/t/how-to-ensure-inv-is-multi-threaded/25846>\
**Category:** New to Julia\
**Tags:** parallel\
**Created:** [June 29, 2019, 7:12pm UTC](https://discourse.julialang.org/t/how-to-ensure-inv-is-multi-threaded/25846 "2019-06-29T19:12:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hsgg](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Post date:** [June 29, 2019, 7:12pm UTC](https://discourse.julialang.org/t/how-to-ensure-inv-is-multi-threaded/25846/1 "2019-06-29T19:12:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [June 30, 2019, 3:57pm UTC](https://discourse.julialang.org/t/how-to-ensure-inv-is-multi-threaded/25846/2 "2019-06-30T15:57:11Z")

</div>

> [@hsgg](#):
>
> 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

Not sure why that would happen, but you can use [Linear Algebra · The Julia Language](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.BLAS.set_num_threads).

---

<div class="post-metadata">

**Author:** ![hsgg](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@hsgg](https://discourse.julialang.org/u/hsgg)\
**Post date:** [July 1, 2019, 2:43pm UTC](https://discourse.julialang.org/t/how-to-ensure-inv-is-multi-threaded/25846/3 "2019-07-01T14:43:04Z")

</div>

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