# How to get number of current BLAS threads?

**URL:** <https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090>\
**Category:** New to Julia\
**Created:** [December 10, 2019, 10:29am UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090 "2019-12-10T10:29:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [December 10, 2019, 10:29am UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090/1 "2019-12-10T10:29:57Z")

</div>

`LinearAlgebra.BLAS.set_num_threads()` sets the number of threads. But, how to _ **get** _ the number of threads (so that I could save it, set another one, then restore the value)? Thanks.

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [December 10, 2019, 12:14pm UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090/2 "2019-12-10T12:14:09Z")

</div>

I think you can use `get_num_threads` that is defined here:  
[https://github.com/JuliaLang/julia/blob/7bc374290cbb62ff1890541226da2df8fb3ef864/stdlib/Distributed/test/distributed\_exec.jl#L999](https://github.com/JuliaLang/julia/blob/7bc374290cbb62ff1890541226da2df8fb3ef864/stdlib/Distributed/test/distributed_exec.jl#L999)

---

<div class="post-metadata">

**Author:** ![tomtom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomtom/32/5106_2.png) [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Post date:** [December 10, 2019, 1:47pm UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090/3 "2019-12-10T13:47:10Z")

</div>

thanks. Should I assume that this function would be available soon in future releases?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 10, 2019, 3:47pm UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090/4 "2019-12-10T15:47:44Z")

</div>

In future releases hopefully BLAS will just use Julia’s own threads.

---

<div class="post-metadata">

**Author:** ![Amin\_Yahyaabadi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amin_yahyaabadi/32/9826_2.png) [@Amin\_Yahyaabadi](https://discourse.julialang.org/u/Amin_Yahyaabadi)\
**Post date:** [December 11, 2019, 12:23am UTC](https://discourse.julialang.org/t/how-to-get-number-of-current-blas-threads/32090/5 "2019-12-11T00:23:52Z")

</div>

Someone can make a PR for having this in the release.
