Hello:
I am using Julia v 1.5.3 operating on a machine with
4 cores.
I am attempting to add workers via the REPL using:
julia> $ julia --threads 4
But I am returning the following error:
ERROR: syntax: invalid operator "--"
I have used -t, -p, ./julia combinations
but all have returned Syntax errors.
Any tips on this one?
you either start the julia REPL with keywords like -p
or you run using Distributed; addprocs()
inside the REPL
on a sidenote: this whole process is documented nicely in the julia docs
Frederik Banning said:
you either start the julia REPL with keywords like -p
or you runusing Distributed; addprocs()
inside the REPL
on a sidenote: this whole process is documented nicely in the julia docs
Thank you for this reply, I did look at the
documentation Multi-Threading previous
to this question but am having trouble
interpreting it.
My main goal is to add workers to reduce overhead
and to utilize a package that can scale better than
non-threaded packages.
how do you open the repl? Do you click on a symbol?
Max Köhler said:
how do you open the repl? Do you click on a symbol?
I open by clicking the application icon. I am not familiar
with the short symbol.
Are you familiar with starting julia from a shell?
Max Köhler said:
Are you familiar with starting julia from a shell?
Hi Max,
Sorry for not making my question clear.
Yes I know how to activate Julia from the
REPL:
add the number of processes usually
in step with the number of cores on the
machine
Pluto.run() to open web session on
localhost:XXXX
qu bit said:
julia> $ julia --threads 4
This looks to me as if you want to start julia from the julia repl, but I'm asking if you can open the julia repl from an OS (Windows, Mac, Linux depends what you use) shell
Max Köhler said:
qu bit said:
julia> $ julia --threads 4
This looks to me as if you want to start julia from the julia repl, but I'm asking if you can open the julia repl from an OS (Windows, Mac, Linux depends what you use) shell
I am using the Windows Powershell REPL to activate
a Julia browser session, is this what you mean?
Yes -- initially I used that command on the
interpreter line, but it returned a syntax error.
I am using a package similar to Distributions
and added the processes using addprocs(n).
ok, so if you want to use the command line argument as in the snippet julia --threads 4
you need to do it before starting julia, it's an argument to start julia. Otherwise, as @Frederik Banning suggested, you can add processes and threads by their corresponding packages, e.g.
using Distributed
addprocs(5)
but since you write something about Pluto, it's a different scenario anyways. Do you want to have multiple procs/threads in Pluto?
Max Köhler said:
but since you write something about Pluto, it's a different scenario anyways. Do you want to have multiple procs/threads in Pluto?
Yes -- My words before are confirming what you are saying.
Right now, I only have 1 worker running for my current session.
I wanted to have 4 workers running for a single Pluto session.
Does adding the processes via addproc(N) achieve this?
I think this problem isn't solved yet. Pluto launches workers and your code is executed on a slave process, therefore it's (AFAIK) currently not possible.
However, you can execute your Pluto notebook as normal julia code with multiple workers by
julia -p 5 notebook.jl
Max Köhler said:
However, you can execute your Pluto notebook as normal julia code with multiple workers by
julia -p 5 notebook.jl
Okay -- thank you Max.
So I understand you clearly.
In the Windows Powershell, in order to run on multiple
workers during a Pluto.jl session, run
julia -p 5 notebook.jl
Where notebook.jl is the name of the notebook you want
to implement N workers on. Correct?
no not during a Pluto.jl session but instead of a Pluto.jl session you can execute the notebook as "normal" julia code and thereby have workers, I wouldn't recommend it, try to prototype in Pluto and switch to a plain script when it comes to distributing stuff
Max Köhler said:
no not during a Pluto.jl session but instead of a Pluto.jl session you can execute the notebook as "normal" julia code and thereby have workers, I wouldn't recommend it, try to prototype in Pluto and switch to a plain script when it comes to distributing stuff
Thank you for this explanation @Max Köhler
Will addprocs() in the powershell REPL
before running a Pluto session.
Last updated: Nov 06 2024 at 04:40 UTC