【发布时间】:2016-05-25 08:55:49
【问题描述】:
我一直在尝试使用SharedArrays 让 Julia 程序在 SGE 环境中正确运行。我在 Julia 和 SGE 上阅读了几个主题,但其中大多数似乎都处理 MPI。来自this Gist 的函数bind_pe_procs() 似乎正确地将进程绑定到本地环境。像
### define bind_pe_procs() as in Gist
### ...
println("Started julia")
bind_pe_procs()
println("do SharedArrays initialize correctly?")
x = SharedArray(Float64, 3, pids = procs(), init = S -> S[localindexes(S)] = 1.0)
pids = procs(x)
println("number of workers: ", length(procs()))
println("SharedArrays map to ", length(pids), " workers")
产生以下输出:
starting qsub script file
Mon Oct 12 15:13:38 PDT 2015
calling mpirun now
exception on 2: exception on exception on 4: exception on exception on 53: : exception on exception on exception on Started julia
parsing PE_HOSTFILE
[{"name"=>"compute-0-8.local","n"=>"5"}]compute-0-8.local
ASCIIString["compute-0-8.local","compute-0-8.local","compute-0-8.local","compute-0-8.local"]adding machines to current system
done
do SharedArrays initialize correctly?
number of workers: 5
SharedArrays map to 5 workers
奇怪的是,如果我需要从文件加载数组并使用命令convert(SharedArray, vec(readdlm(FILEPATH))) 转换为SharedArray 格式,这似乎不起作用。如果脚本是
println("Started julia")
bind_pe_procs()
### script reads arrays from file and converts to SharedArrays
println("running script...")
my_script()
那么结果就是垃圾:
starting qsub script file
Mon Oct 19 09:18:29 PDT 2015
calling mpirun now Started julia
parsing PE_HOSTFILE
[{"name"=>"compute-0-5.local","n"=>"11"}]compute-0-5.local
ASCIIString["compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0-5.local","compute-0- 5.local"]adding machines to current system
done
running script...
Current number of processes: [1,2,3,4,5,6,7,8,9,10,11]
SharedArray y is seen by [1] processes
### tons of errors here
### important one is "SharedArray cannot be used on a non-participating process"
所以 SharedArrays 无法正确映射到所有内核。有人对此问题有任何建议或见解吗?
【问题讨论】:
-
请注意
procs()与workers()不同。第一个可能包括非工作进程。特别是因为addprocs(),在sge.jl中使用,添加了remote机器。 -
请原谅@FelipeLema 迟到的回复!你指出了一个重要的细节。但到目前为止,我仍然卡住了:(。感兴趣的读者还可以看到我在ClusterManagers.jl repo 提交的以下issue。
标签: multithreading parallel-processing julia sungridengine