# Launching with JULIA\_NUM\_THREADS=\<max\>

**URL:** https://discourse.julialang.org/t/launching-with-julia-num-threads-max/52964
**Category:** Performance
**Tags:** question, parallel, threads
**Created:** [January 6, 2021, 10:57pm UTC](https://discourse.julialang.org/t/launching-with-julia-num-threads-max/52964 "2021-01-06T22:57:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mkarikom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkarikom/32/7096_2.png) [@mkarikom](https://discourse.julialang.org/u/mkarikom)
#### Post date: [January 6, 2021, 10:57pm UTC](https://discourse.julialang.org/t/launching-with-julia-num-threads-max/52964/1 "2021-01-06T22:57:18Z")

</div>

Is there any drawback to always launching julia with the number of existing cpu cores?

Suppose my cpu has 4 cores, and I need to do some non-production stuff like debugging, etc:

```julia
# cpu with 4 cores
firefox &
export JULIA_NUM_THREADS=4 && julia

```

---

<div class="post-metadata">

### Author: ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)
#### Post date: [January 6, 2021, 11:19pm UTC](https://discourse.julialang.org/t/launching-with-julia-num-threads-max/52964/2 "2021-01-06T23:19:07Z")

</div>

```julia
leandro@pitico:~% julia -t auto
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.5.3 (2020-11-09)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> Threads.nthreads()
8

julia>

```

A drawback? No, only your Julia will compete with the other processes of your computer.

---

<div class="post-metadata">

### Author: ![moeddel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/moeddel/32/18641_2.png) [@moeddel](https://discourse.julialang.org/u/moeddel)
#### Post date: [January 7, 2021, 6:17pm UTC](https://discourse.julialang.org/t/launching-with-julia-num-threads-max/52964/3 "2021-01-07T18:17:11Z")

</div>

Actually there can julia can also compete with itself if one uses julia treads and BLAS, which by default has its own thread pool

> [@Julia Threads vs BLAS threads](https://discourse.julialang.org/t/julia-threads-vs-blas-threads/8914):
>
> I am experimenting with Julia’s (experimental) multithreading feature recently and like the results so far. One of the problems I need to deal with, involves the multiplication of several pairs (say in the order 5 to 50) of matrices, whose size is average (say linear size in the order 10 - 1000). For that problem, there can be a competition between either using Julia threads (to loop over the different pairs) versus using multithreaded matrix multiplication provided by BLAS, and it will depend …
