Julia Distributed,出现冗余迭代
Julia Distributed, redundant iterations appearing
我运行
mpiexec -n $nprocs julia --project myfile.jl
在集群上,其中 myfile.jl 具有以下形式
using Distributed; using Dates; using JLD2; using LaTeXStrings
@everywhere begin
using SharedArrays; using QuantumOptics; using LinearAlgebra; using Plots; using Statistics; using DifferentialEquations; using StaticArrays
#Defining some other functions and SharedArrays to be used later e.g.
MySharedArray=SharedArray{SVector{Nt,Float64}}(Np,Np)
end
@sync @distributed for pp in 1:Np^2
for jj in 1:Nj
#do some stuff with local variables
for tt in 1:Nt
#do some stuff with local variables
end
end
MySharedArray[pp]=... #using linear indexing
println("$pp finished")
end
timestr=Dates.format(Dates.now(), "yyyy-mm-dd-HH:MM:SS")
filename="MyName"*timestr
@save filename*".jld2"
#later on, some other small stuff like making and saving a figure. (This does give an error "no method matching heatmap_edges(::Surface{Array{Float64,2}}, ::Symbol)" but I think that this is a technical thing about Plots so not very related to the bigger issue here)
但是,在查看输出时,有几个问题让我断定出了问题
- “$pp finished”的输出对于每一个pp的值都重复了很多次,看来这个数量其实等于32=$nprocs
- 尽管代码尚未完成,但已生成“MyName”文件。应该是一个,但我得到了十几个不同的 timestr 组件
编辑:我还可以添加两件事
- 不同“MyName”文件的输出不相同,但这是预料之中的,因为在内部循环中使用了 运行dom 编号。其中有 28 个,我很难认出这个数字,只是它再次接近 32 个 $nprocs
- 早些时候,我写道 walltime 已超过,但事实证明这不是真的。 .o 文件以“您的一个应用程序进程错误终止......退出代码:9”结尾,紧跟在最后一个输出文件之后。
$nprocs在pbs脚本中通过
获取
#PBS -l select=1:ncpus=32:mpiprocs=32
nprocs= `cat $PBS_NODEFILE|wc -l`
正如 adamslc 在 Julia 话语中所指出的,在集群上使用 Julia 的正确方法是
- 使用作业脚本中的一个核心启动会话,在 Julia 脚本本身中使用 addprocs() 添加更多
- 使用更专业的 Julia 包
https://discourse.julialang.org/t/julia-distributed-redundant-iterations-appearing/57682/3
我运行
mpiexec -n $nprocs julia --project myfile.jl
在集群上,其中 myfile.jl 具有以下形式
using Distributed; using Dates; using JLD2; using LaTeXStrings
@everywhere begin
using SharedArrays; using QuantumOptics; using LinearAlgebra; using Plots; using Statistics; using DifferentialEquations; using StaticArrays
#Defining some other functions and SharedArrays to be used later e.g.
MySharedArray=SharedArray{SVector{Nt,Float64}}(Np,Np)
end
@sync @distributed for pp in 1:Np^2
for jj in 1:Nj
#do some stuff with local variables
for tt in 1:Nt
#do some stuff with local variables
end
end
MySharedArray[pp]=... #using linear indexing
println("$pp finished")
end
timestr=Dates.format(Dates.now(), "yyyy-mm-dd-HH:MM:SS")
filename="MyName"*timestr
@save filename*".jld2"
#later on, some other small stuff like making and saving a figure. (This does give an error "no method matching heatmap_edges(::Surface{Array{Float64,2}}, ::Symbol)" but I think that this is a technical thing about Plots so not very related to the bigger issue here)
但是,在查看输出时,有几个问题让我断定出了问题
- “$pp finished”的输出对于每一个pp的值都重复了很多次,看来这个数量其实等于32=$nprocs
- 尽管代码尚未完成,但已生成“MyName”文件。应该是一个,但我得到了十几个不同的 timestr 组件
编辑:我还可以添加两件事
- 不同“MyName”文件的输出不相同,但这是预料之中的,因为在内部循环中使用了 运行dom 编号。其中有 28 个,我很难认出这个数字,只是它再次接近 32 个 $nprocs
- 早些时候,我写道 walltime 已超过,但事实证明这不是真的。 .o 文件以“您的一个应用程序进程错误终止......退出代码:9”结尾,紧跟在最后一个输出文件之后。
$nprocs在pbs脚本中通过
获取#PBS -l select=1:ncpus=32:mpiprocs=32
nprocs= `cat $PBS_NODEFILE|wc -l`
正如 adamslc 在 Julia 话语中所指出的,在集群上使用 Julia 的正确方法是
- 使用作业脚本中的一个核心启动会话,在 Julia 脚本本身中使用 addprocs() 添加更多
- 使用更专业的 Julia 包
https://discourse.julialang.org/t/julia-distributed-redundant-iterations-appearing/57682/3