# Why passing a distributed matrix to functions hurts performance?

**URL:** https://discourse.julialang.org/t/why-passing-a-distributed-matrix-to-functions-hurts-performance/79353
**Category:** Performance
**Tags:** performance, linearalgebra, distributed, matrices, functions
**Created:** [April 11, 2022, 6:34pm UTC](https://discourse.julialang.org/t/why-passing-a-distributed-matrix-to-functions-hurts-performance/79353 "2022-04-11T18:34:53Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)
#### Post date: [April 11, 2022, 6:52pm UTC](https://discourse.julialang.org/t/why-passing-a-distributed-matrix-to-functions-hurts-performance/79353/2 "2022-04-11T18:52:51Z")

</div>

For distributed matmul, you should set the number of BLAS threads per core to 1 with [`BLAS.set_num_threads(1)`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.BLAS.set_num_threads), otherwise you’ll oversubscribe.

---

_[View the full topic](https://discourse.julialang.org/t/why-passing-a-distributed-matrix-to-functions-hurts-performance/79353)._
