Adding Threads

i’m newbie parallel computing and i’m trying to practice it a little bit and when i want to add threads: set JULIA_NUM_THREADS =4 i get this Error and i don’t get if i should add something or what: ERROR: syntax: extra token "JULIA_NUM_THREADS" after end of expression

It looks like you are doing this inside a Julia session. JULIA_NUM_THREADS is an environment variable that needs to be set already at the time you start a new Julia session, it cannot be done afterwards. See also Environment Variables · The Julia Language.

1 Like

oh i get it it’s working now thanks

So where can you set the number of threads if not in the REPL or the file itself?

You can, e.g., start Julia with julia -t 4 (here, with 4 threads) from your terminal for a single session. The environment variable can for instance be set in your bash configuration file. How exactly this is done depends somewhat on your system, see here: Environment Variables · The Julia Language