Hello, I was recently suggested to try the multi-threading functionality, but I have not been successful.
In the terminal I run export JULIA_NUM_THREADS=4
(which I know I have by running sysctl hw.ncpu
). In the REPL I call Threads.nthreads()
but the output remains 1.
What step am I missing ?
Thank you for your help!
Did you set the environment variable before starting Julia? What is ENV["JULIA_NUM_THREADS"]
?
As a matter of fact I did not, when running your command I get ERROR: KeyError: key “JULIA_NUM_THREADS” not found.
I simply followed https://docs.julialang.org/en/v1/manual/parallel-computing/#Multi-Threading-(Experimental)-1.
How do I set the environment ? Are the steps in the Documentation as well ?
What you did should work, but you probably need to start julia from the same terminal as you set the variable.
Indeed, that was it… I did not know changing terminal windows could affect anything. Thank you very much.