【问题标题】:Julia Distributed, redundant iterations appearingJulia 分布式,出现冗余迭代
【发布时间】:2021-06-18 17:15:51
【问题描述】:

我跑了

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”文件的输出不相同,但这是意料之中的,因为内部循环中使用了随机数。其中有 28 个,除了再次接近 32 个 $nprocs 之外,我不容易认出这个数字
  • 之前,我写过超过 walltime,但事实证明这不是真的。 .o 文件以“您的一个应用程序进程的错误终止...退出代码:9”结尾,就在最后一个输出文件之后不久。

$nprocs是在pbs脚本中通过

获取的
#PBS -l select=1:ncpus=32:mpiprocs=32
nprocs= `cat $PBS_NODEFILE|wc -l`

【问题讨论】:

    标签: julia mpi distributed-computing


    【解决方案1】:

    正如 adamslc 在 Julia discourse 中指出的那样,在集群上使用 Julia 的正确方法是

    • 使用作业脚本中的一个核心启动会话,在 Julia 脚本本身中使用 addprocs() 添加更多内容
    • 使用更专业的 Julia 包

    https://discourse.julialang.org/t/julia-distributed-redundant-iterations-appearing/57682/3

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-10
      • 2015-05-16
      • 2013-11-30
      • 1970-01-01
      • 2021-02-08
      相关资源
      最近更新 更多