# Threads.nthreads(): different results in Atom and in Julia built-in REPL

**URL:** https://discourse.julialang.org/t/threads-nthreads-different-results-in-atom-and-in-julia-built-in-repl/20791
**Category:** New to Julia
**Tags:** multithreading
**Created:** [February 14, 2019, 4:41pm UTC](https://discourse.julialang.org/t/threads-nthreads-different-results-in-atom-and-in-julia-built-in-repl/20791 "2019-02-14T16:41:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ale](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@ale](https://discourse.julialang.org/u/ale)
#### Post date: [February 14, 2019, 4:41pm UTC](https://discourse.julialang.org/t/threads-nthreads-different-results-in-atom-and-in-julia-built-in-repl/20791/1 "2019-02-14T16:41:05Z")

</div>

Hi,

I am using Julia 0.6.4 and my Windows 10 computer has 4 cores.  
If I write `Threads.nthreads()` in Atom’s REPL, I get as an answer:

```julia
julia> Threads.nthreads()
4

```

However, if I start the Julia built-in-REPL (I hope it’s clear, I mean if I simply start Julia without using a code editor like Atom), and run the same line I get:

```julia
julia> Threads.nthreads()
1

```

What can this be due to?

By the way, I have already read [https://discourse.julialang.org/t/how-to-change-the-number-of-threads/6169](https://discourse.julialang.org/t/how-to-change-the-number-of-threads/6169), and followed the steps, that is:

- opening the Command Prompt
- changing the directory
- typing `set JULIA_NUM_THREADS=4`.  
I click Enter, and nothing happens, so I presume it works. But if I then open Julia built-in-REPL I still get:

```julia
julia> Threads.nthreads()
1

```

Please let me know if you have any ideas!

---

<div class="post-metadata">

### Author: ![Simon\_Bolland](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simon_bolland/32/8920_2.png) [@Simon\_Bolland](https://discourse.julialang.org/u/Simon_Bolland)
#### Post date: [February 15, 2019, 10:33am UTC](https://discourse.julialang.org/t/threads-nthreads-different-results-in-atom-and-in-julia-built-in-repl/20791/2 "2019-02-15T10:33:54Z")

</div>

When you say you opened the Julia REPL, did you type the name of the executable into the Command prompt where you set JULIA\_NUM\_THREADS, or just click a shortcut? The variable set in the command prompt will only be seen by things run from that prompt. If you want something that can be seen by Julia started from shortcut, search for environment variables and add JULIA\_NUM\_THREADS as a new variable.

---

<div class="post-metadata">

### Author: ![ale](https://avatars.discourse-cdn.com/v4/letter/a/f19dbf/32.png) [@ale](https://discourse.julialang.org/u/ale)
#### Post date: [February 15, 2019, 3:14pm UTC](https://discourse.julialang.org/t/threads-nthreads-different-results-in-atom-and-in-julia-built-in-repl/20791/3 "2019-02-15T15:14:38Z")

</div>

> [@Simon\_Bolland](#):
>
> The variable set in the command prompt will only be seen by things run from that prompt

Thank you very much for your feedback!  
I was unaware of this, and was opening Julia from the desktop shortcut. Instead, if I open it from the prompt, by simply typing `julia`, setting the number of threads works!
