about setting the environment variable JULIA_NUM_THREADS in Windows, and was wondering if anyone know how this would work in VS Code (context: I am using a computer with Windows 10 and the Linux subsystem). The only way I have gotten Julia to start with multiple threads is to start a new bash session in the same directory as julia.exe, but this is inconvenient for when I am writing code (VS Code by default starts a session in the workspace directory).
I think we added an explicit setting for the number of threads now, but it might currently only be on the alpha build for the next version, which you can try here. That is also the only version that works with Julia 1.3 currently.
This extension setting works for me in the REPL, but it does not extend to the Run Tests (w/wo Coverage) Task. I don’t know the VS codebase, but I’ll take a look to see if it is an easy PR.
Yes, good point, we are not currently picking it up for the test runner. It should be an easy PR, the point where you would add this is here. PR would be great!
PR in place. https://github.com/julia-vscode/julia-vscode/pull/930. I’m not able to run the test suite on my machine, but the Travis builds are passing, in any case. I did test the functionality on my machine by directly editing the extension JS files. Let me know if you need anything done.
I apologize if this is obvious, but could be more specific about what to add to the setting.json?
I did not figure out how to do this, but, for anyone in a similar situation, you can simply edit your .bashrc file to set the environment variable. Add export JULIA_NUM_THREADS=4 (replace 4 with desired number) as a line at the bottom of your .bashrc file, restart your computer (logging out and in might be enough), and you are all set.
Just to answer this for anyone that finds this thread, I was using 1.7.2 Julia and the VSCode Julia extension v.1.6.6, and the nice box to change the number of threads wasn’t there. Instead there was a “Edit in settings.json” link.
I could change the threads in the terminal instance of Julia but it wouldn’t register in my Jupyter notebooks within VS Code. Eventually, I figured out the solution.
Altogether, the settings.json file should look something like the following:
{
# Probably has some settings for
# color schemes, zoomlevel, etc.
# Then you should add these lines:
"julia.NumThreads": 12,
"settingsSync.ignoredSettings": [
"-julia.NumThreads"
],
}