Hi,
I’m trying to use distributed computing, but am running into some trouble with loading packages. Here is the MWE:
module bogus_module
using Parameters, Distributed
@with_kw mutable struct cenas
# Households
a::Float64
b::Float64
end
@everywhere function ragnarok(parm::cenas)
@unpack a = parm
prinln("dum")
end
end
The main script:
using Distributed
nprocs()==Sys.CPU_THREADS || addprocs(Sys.CPU_THREADS-1)
@everywhere begin
using Parameters, Distributed
#include("bogus_module.jl")
import bogus_module
end
I get the error
Blockquote
ERROR: LoadError: TaskFailedException:
LoadError: UndefVarError: @unpack not defined
Stacktrace:
[1] top-level scope
[2] eval at .\boot.jl:331 [inlined]
[3] (::Distributed.var"#155#156"{Module,Expr})() at .\task.jl:356
in expression starting at D:\dropbox\Dropbox\Meu\PhD\Tese\JMP\Code\Julia\main_code\version7\bogus_module.jl:12
Stacktrace:
[1] sync_end(::Channel{Any}) at .\task.jl:314
[2] macro expansion at .\task.jl:333 [inlined]
[3] remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\macros.jl:218
[4] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Distributed\src\macros.jl:202
[5] include(::Function, ::Module, ::String) at .\Base.jl:380
[6] include(::Module, ::String) at .\Base.jl:368
[7] top-level scope at none:2
[8] eval at .\boot.jl:331 [inlined]
[9] eval(::Expr) at .\client.jl:467
[10] top-level scope at .\none:3
in expression starting at D:\dropbox\Dropbox\Meu\PhD\Tese\JMP\Code\Julia\main_code\version7\bogus_module.jl:11
I declared the Parameters package both within the module, which I initiate in every worker, and outside. What am I missing? Why is @unpack not recognized?