Using export
You should set the number of threads outside the julia REPL itself (and use export to export an environment variable), like so:
export JULIA_NUM_THREADS=4
(in your terminal)
then you can open julia:
julia
and check the threads
Threads.nthreads()
Start julia with --threads
Alternatively, you can also start julia passing the number of threads:
julia --threads 4
The difference with export
is that you would have to pass --threads
every time you start the julia REPL, whereas with export you don’t (at least as long as you use the same terminal in which you exported)
Hope that’s clear