Parallel processing 并行处理:@无处不在、分布和类型
我最近开始在Julia学习并行处理,我有一个问题,我真的不知道如何解决 在使用Julia-p4执行Julia之后,我想在所有进程中加载Distributions模块,并定义一个依赖于分发的类型 当我将其包括在内时,以下内容显然是正确的:Parallel processing 并行处理:@无处不在、分布和类型,parallel-processing,julia,Parallel Processing,Julia,我最近开始在Julia学习并行处理,我有一个问题,我真的不知道如何解决 在使用Julia-p4执行Julia之后,我想在所有进程中加载Distributions模块,并定义一个依赖于分发的类型 当我将其包括在内时,以下内容显然是正确的: @everywhere using Distributions type TypeDistrib{T <: Float64} d::Distributions.Normal{T} end @everywhere使用发行版 键入Type
@everywhere using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
@everywhere使用发行版
键入TypeDistrib{T@everywhere something
在所有进程的主模块中计算something
。在这种情况下,不是在test
模块中,因此错误在第二种情况下,而不是在第一种情况下
或许
@everywhere module test
using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
export TypeDistrib
end
@everywhere模块测试
使用分布
键入TypeDistrib{T这可能是它应该是的。但是,我还不太清楚为什么我写的代码不起作用。请你再澄清一点你的观点好吗?使用发行版的评估就像在主模块和发行版中编写一样。正常{T}
在测试模块中搜索(定义它的地方)因此找不到它。例如,使用Main.Distributions.Normal{T}
在test
中工作,如问题中所定义。
@everywhere module test
using Distributions
type TypeDistrib{T <: Float64}
d::Distributions.Normal{T}
end
export TypeDistrib
end