Is the number of threads used by Pluto capped?

I’m on a Linux box and launched Julia with 16 threads, and then launched Pluto as follows:


And yet Pluto only seems to have 8 threads available

Am I doing something wrong or misunderstanding things? Or is multithreading in Pluto capped at 8 threads, at least for my setup? I’m guessing the former and will be happy to be corrected…

1 Like

You can specify the number of threads Pluto uses by setting the JULIA_NUM_THREADS environment variable or by using the threads keyword argument to (ex: Pluto.run(threads=16)).

The default value is computed here and is the number of CPU cores divided by two.

5 Likes

Ah… That’s great, thank you. I thought the Pluto instance inherited the thread number from the Julia session that launched it.

Sorry to revive an old topic.

This means that those 16 threads are shared across all running notebooks?
Or that each notebook has its own 16 threads?

If it’s not 16 threads for each notebook then are you asking whether i) 2 notebooks would have 8 threads each? Or are you asking ii) if 16 threads are common to the 2 open notebooks and a given notebook can use all or none of the threads depending on the needs of the other notebook? Alternative i) is clearly false because a given notebook can utilize all 16 cores fully even when other notebooks are open. How would you distinguish alternative ii) from the case of 16 threads each, and why would you care? Both situations would allow you to maximize usage of all available cores…

But fwiw, I think that if you launch Pluto notebooks A and B from the same Julia repl (by doing Pluto.run() to open A and then clicking on the three dot Pluto icon to launch notebook B) then notebooks A and B share the 16 threads associated with the Julia session from which you launched the notebooks. But if you launch each notebook from a separate Julia repl then I think they’ll have 16 threads each…

Oh wise and powerful Pluto and Julia gods… Am I right or wrong?

Each Pluto notebook runs in a separate Julia process. There is no sharing of resources between notebooks.