JULIA_NUM_THREADS in VS Code (Windows 10 + WSL)

I recently came across this thread:

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).

Any assistance would be appreciated. Thanks.

1 Like

You can set additional env variables for the julia REPL via the julia.additionalArgs setting of the Julia extension in VS Code.

1 Like

I apologize if this is obvious, but could be more specific about what to add to the setting.json?

What argument should be added there? just julia.JULIA_NUM_ThREADS ?

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.

You can find it now in the settings of the Julia extension of vscode.
grafik

3 Likes

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!

Works great now. Doing the benchmarks for the merge sort from this post, with 1 and 12 threads:

Annotation 2020-01-11 121355

Thanks to @davidanthoff for the great work!

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.