# LAPACK multithreading

**URL:** <https://discourse.julialang.org/t/lapack-multithreading/22230>\
**Category:** Performance\
**Tags:** question, build\
**Created:** [March 23, 2019, 1:30am UTC](https://discourse.julialang.org/t/lapack-multithreading/22230 "2019-03-23T01:30:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhinavd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abhinavd/32/7951_2.png) [@abhinavd](https://discourse.julialang.org/u/abhinavd)\
**Post date:** [March 23, 2019, 1:30am UTC](https://discourse.julialang.org/t/lapack-multithreading/22230/1 "2019-03-23T01:30:21Z")

</div>

Hello everyone,  
I would like to know how the binaries on the Julia [downloads page](https://julialang.org/downloads/) page are generated. For example, what are the default compilation flags used? Would I get the same result if I compiled them on some (Linux) system, assuming I do not link to any system libraries?  
I ask because I am going to be running Julia on a cluster and I am concerned I may not be taking full advantage of the compute node architecture.

As an example, diagonalising a 4096 by 4096 Hermitian matrix using `eigen!` takes around 22-23 seconds on my computer (with 8 threads), but 15-16 seconds on a node of a cluster (which has 40 threads). I don’t expect a 5x speedup, but how do I ensure that the LAPACK that is being called really does know about 40 threads being present (and using them all)?

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [March 23, 2019, 2:20am UTC](https://discourse.julialang.org/t/lapack-multithreading/22230/2 "2019-03-23T02:20:22Z")

</div>

Standard Julia builds use the version of LAPACK included with OpenBLAS, and build the latter with a limit of 16 threads. AFAICT one needs to edit `deps/blas.mk` in the Julia tree to get more. Be aware that this can make things worse for small and medium-sized problems; see discussion at [this issue](https://github.com/JuliaLang/julia/issues/14857). (If your cluster uses Intel processors, consider building with MKL instead.)

---

<div class="post-metadata">

**Author:** ![abhinavd](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abhinavd/32/7951_2.png) [@abhinavd](https://discourse.julialang.org/u/abhinavd)\
**Post date:** [March 27, 2019, 7:19pm UTC](https://discourse.julialang.org/t/lapack-multithreading/22230/3 "2019-03-27T19:19:56Z")

</div>

Thanks, Ralph! I’m trying to build with MKL, but facing several more issues relating to really old versions of gcc. I think I will just use the binary and see how it goes.

---

<div class="post-metadata">

**Author:** ![lbenet](https://avatars.discourse-cdn.com/v4/letter/l/35a633/32.png) [@lbenet](https://discourse.julialang.org/u/lbenet)\
**Post date:** [March 27, 2019, 9:01pm UTC](https://discourse.julialang.org/t/lapack-multithreading/22230/4 "2019-03-27T21:01:24Z")

</div>

Maybe this helps: [MKL and libm compile notes: macOS - #5 by Elrod](https://discourse.julialang.org/t/mkl-and-libm-compile-notes-macos/21024/5)
