Parallel processing: @ everywhere, distributions and types
I recently started learning about parallel processing in Julia and I got a problem that I really don't understand how to fix.
After running Julia with, julia -p 4
I want to load the Distributions module in all processes, and I would like to define a type that depends on the distributions.
The following seems to work correctly when I enable it:
@everywhere using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
If I write exactly the same code as the module, then it is not:
module test
@everywhere using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
export TypeDistrib
end
The above message displays the following error message:
ERROR: LoadError: UndefVarError: Allocations are not defined in include_from_node1 (:: String) on. /loading.jl:488 to include_from_node1 (:: String) to / Applications / Julia -0.5.app/Contents/Resources/julia/lib/julia/sys.dylib :? when loading /***/test.jl, in an expression starting on line 4
Could you please clarify what I am doing wrong here?
Note. I replaced the full path in the error message with *** as it was confusing.
source to share
@everywhere something
evaluates something
in the main module for all processes. And in this case, not in the module test
, and therefore the error is in the second case, and not in the first.
Can
@everywhere module test
using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
export TypeDistrib
end
does what is meant.
source to share