Hi folks,
I’m just running into (another) problem, this time related to loading modules in several workers at the same time.
I have this simple module
module My_mod
export My_Type, f
mutable struct My_type
x::Int
end
f(x) = x^2 + 1
println("Loaded !!")
end
which I want to load in several workers.
In julia 0.6.4 I could simply do the following
addprocs(3)
@everywhere using My_mod
and the whole module was loaded in all workers. Now in julia 1.0.2 I try
using Distributed
addprocs(3)
@everywhere using My_mod
I get the message
Loaded !!
On worker 2:
ArgumentError: Package My_mod not found in current path:
- Run `import Pkg; Pkg.add("My_mod")` to install the My_mod package.
require at ./loading.jl:823
eval at ./boot.jl:319
#116 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:276
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:56
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/process_messages.jl:65
#102 at ./task.jl:259
#remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:421
remotecall_wait(::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:412
#remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Function, ::Int64, ::Module, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
remotecall_wait(::Function, ::Int64, ::Module, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/remotecall.jl:433
(::getfield(Distributed, Symbol("##163#165")){Module,Expr})() at ./task.jl:259
...and 3 more exception(s).
Stacktrace:
[1] sync_end(::Array{Any,1}) at ./task.jl:226
[2] remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/macros.jl:207
[3] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Distributed/src/macros.jl:190
[4] top-level scope at In[5]:1
and,as you can see, it fails to load already in worker 2.
Now the message says I must do import Pkg etc… which does not seem to be the right thing here, as I do not want to install any package but to load a module.
I’m sure I’m probably misunderstanding something, so I could use a bit of help and get the correct way to load my (personal) modules into several workers at once…
Thx in advance,
Ferran.