Open donovaly opened 2 days ago
Meanwhile I tried this approach:
import Pluto; Pluto.run(threads=12)
But also with this, whatever I execute in Pluto, only runs on one thread.
import Pluto; Pluto.run(threads=12)
This should work. Are you sure that only one thread is being used? Can you share a screenshot/video where you demonstrate this?
when I close the Julia REPL, Pluto is closed as well
This is the intended behaviour for any number of threads. Maybe you want to use multiprocessing, not multithreading?
This should work. Are you sure that only one thread is being used? Can you share a screenshot/video where you demonstrate this?
To test, I downloaded this notebook: import Pluto; Pluto.run(threads=12)
There they do an image convolution, which is a nice test case. But no matter what I try, the convolution runs only on one 1 core of my CPU:
I loaded Julia with
julia.exe -p auto -t auto
(instead of 'auto', I also used explicit numbers)
and Pluto with
import Pluto; Pluto.run(threads=12)
(I also tried other numbers)
However, the result is always that only one CPU core is used.
when I close the Julia REPL, Pluto is closed as well
This is the intended behaviour for any number of threads. Maybe you want to use multiprocessing, not multithreading?
My point here was that I set up several threads for Julia thus think Pluto uses them as well.
I found a solution that Pluto respects the setting of the JULIA_NUM_THREADS
variable:
import Pluto; Pluto.run(;threads="$(Threads.nthreads())")
I think that this should be the standard as Pluto is a package and packages should respect the global settings of Julia. Here, the user knows why he sets a certain number of threads for Julia, therefore there is no need to change the user's decision. If the user really wants to override Julia's presets, he can already run Pluto with another number of threads.
So here my proposal to fix the bug:
JULIA_NUM_THREADS
environment variable and use its settings also for Pluto; otherwise just use one thread
I am new to Julia and to give it a try, I wanted to check its performance. I have a CPU with 12 cores and according to the docs, I can set the number of threads uses by Julia by setting the
JULIA_NUM_THREADS
variable: https://docs.julialang.org/en/v1/manual/multi-threading/in the Julia REPL I see via
Threads.nthreads()
that it uses the 12 threads I set.However, Pluto ignores this. Whatever I compute, it only uses one CPU thread. But Pluto runs in a single Julia thread, meaning when I close the Julia REPL, Pluto is closed as well. Thus I think it is a bug that Julia's thread settings is ignored.
I use Julia 1.11RC4 under Windows 10 64bit and latest Pluto.