How to set number of threads for VS Code?

There are quite a few topics about this question but I am still confused after reading them. I am using VS Code for Julia Version 1.5.0. Currently,
image
The documentation (Multi-Threading · The Julia Language) says that we can set the number of threads with

$ julia --threads 4

However, when I enter this in my REPL,
image
Or if I follow other users’ comments and do
image
I also tried these in cmd, but not working either.

I believe it is julia -t 4.

Oh, I see. You need to start Julia like this, it cannot be set in the REPL.
So start a cmd and do

set JULIA_NUM_THREADS=4
julia

Or, with Git bash:

export JULIA_NUM_THREADS=4
julia

Or, start cmd and type

julia -t 4

You can set the threads in the extension settings in vs code.

Just to clarify: I first go to cmd, find the directory of Julia, and enter

set JULIA_NUM_THREADS=4

and then enter

julia

to start Julia. Now indeed I get
image
However, in VS Code REPL, I still see
image

This works and it’s much more convenient!

btw, first result of google search:

I think VS Code can control the number of threads in the settings. I am not in front of my computer so So can’t tell you precisely which, but open the settings and you will find it.

This thread is really helpful, and led me to the environment settings in VS code where I have changed the thread number to 4, for user and workspace. However, julia is apparently still using one thread. I

have closed and reopened VS code, closed all the julia files in VS code, then closed and reopened VS code, but without anything improving. Setings shows 4 threads but Threads.nthreads() still shows 1.
Pretty sure I’m being stupid, can anyone help me!?

I managed to “somehow” install VSCode on our remote server under JupiterHub… but the num thread option doesn’t compare in the settings… where could I did wrong ?

Make sure you switch to the “Remote” tab in the settings:
image