I have recently started studying parallel processing in Julia and I am having an issue which I don't really understand how to fix.
After having executed Julia with julia -p 4
I want to load the Distributions module in all the processes and I would like to define a Type which depends on Distributions.
The following apparently works correctly when I include it:
@everywhere using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
If I write exactly the same code as a module, then it doesn't:
module test
@everywhere using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
export TypeDistrib
end
The above gives the following error message:
ERROR: LoadError: UndefVarError: Distributions not defined in include_from_node1(::String) at ./loading.jl:488 in include_from_node1(::String) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:? while loading /***/test.jl, in expression starting on line 4
Would you please clarify what I am not doing correctly here?
Note: I replaced the full path in the error message with *** since it was confusing.
@everywhere something
evaluatessomething
in the Main module across all processes. And in this case, not intest
module, and therefore the error in the second case and not in the first.Perhaps
does what is meant.