集群中多个节点的 Julia 并行计算
Julia parallel computing over multiple nodes in cluster
我正在 运行共享集群上执行一些作业,我一直在尝试一次使用多个节点。虽然使用 julia -p #processors
适用于一个节点上的核心,但它找不到其他节点。
集群正在使用 SGE,我尝试了很多不同的方法来使节点工作,但只有一个在工作。 Julia 中是否有一种简单的方法可以使用 julia -mpi 32
或类似的东西启动 Julia?
使用
using ClusterManagers
println(nworkers(),nprocs(),Sys.CPU_CORES)
ClusterManagers.addprocs_sge(16)
ClusterManagers.addprocs_sge(15)
println(nworkers(),nprocs(),Sys.CPU_CORES)
不起作用(我提交了一个作业,在 SGE 上保留了 2 个节点,每个节点有 16 个内核),作业的输出文件是空的,相反我得到 16 个不同的输出文件 julia-70755.o8252776.*
(* = 1...16)
带有以下文本:
julia_worker:9009#192.168.17.206
Master process (id 1) could not connect within 60.0 seconds.
exiting.
使用 julia --machinefile $PE_HOSTFILE
启动 Julia 也失败了:
Warning: Permanently added the RSA host key for IP address '192.168.18.10' to th
e list of known hosts.
ERROR: connect: invalid argument (EINVAL)
in uv_error at ./libuv.jl:68 [inlined]
in connect!(::TCPSocket, ::IPv4, ::UInt16) at ./socket.jl:652
in connect!(::TCPSocket, ::SubString{String}, ::UInt16) at ./socket.jl:688
in connect at ./stream.jl:959 [inlined]
in connect_to_worker(::SubString{String}, ::Int16) at ./managers.jl:483
in connect(::Base.SSHManager, ::Int64, ::WorkerConfig) at ./managers.jl:425
in create_worker(::Base.SSHManager, ::WorkerConfig) at ./multi.jl:1786
in setup_launched_worker(::Base.SSHManager, ::WorkerConfig, ::Array{Int64,1}) a
t ./multi.jl:1733
in (::Base.##669#673{Base.SSHManager,Array{Int64,1}})() at ./task.jl:360
in sync_end() at ./task.jl:311
in macro expansion at ./task.jl:327 [inlined]
in #addprocs_locked#665(::Array{Any,1}, ::Function, ::Base.SSHManager) at ./mul
ti.jl:1688
in (::Base.#kw##addprocs_locked)(::Array{Any,1}, ::Base.#addprocs_locked, ::Bas
e.SSHManager) at ./<missing>:0
in #addprocs#664(::Array{Any,1}, ::Function, ::Base.SSHManager) at ./multi.jl:1
658
in (::Base.#kw##addprocs)(::Array{Any,1}, ::Base.#addprocs, ::Base.SSHManager)
at ./<missing>:0
in #addprocs#764(::Bool, ::Cmd, ::Int64, ::Array{Any,1}, ::Function, ::Array{An
y,1}) at ./managers.jl:112
in process_options(::Base.JLOptions) at ./client.jl:227
in _start() at ./client.jl:321
UndefRefError()
有人建议我使用 MPI.jl 包,但在我看来它并不真正支持 julia 并行语法,按照我的方式我通过在我想要并行 运行 的 for 循环之前编写 @sync @parallel 来使用它(即 Metropolis-Montecarlo)。
您可能想阅读有关并行计算的 julia 文档,其中有一节是关于集群管理器的。另外,看看支持 SGE 的 ClusterManagers.jl:
julia> using ClusterManagers
julia> ClusterMangers.addprocs_sge(5)
IT 团队回复我并告诉我 SGE 不允许无密码 ssh,这就是 addprocs_sge()
无法工作的原因。但是,他们现在为我可以传递给 Julia 的作业添加了一个文件,并告诉我 运行 使用此脚本的作业:
qlogin -pe mpi_28_tasks_per_node 56
module load julia/0.5.1
julia --machinefile $TMPDIR/machines
机器文件如下所示:
::::::::::::::
/scratch/8548498.1.u/machines
::::::::::::::
{hostname1}
{hostname1}
...
{hostname2}
{hostname2}
我正在 运行共享集群上执行一些作业,我一直在尝试一次使用多个节点。虽然使用 julia -p #processors
适用于一个节点上的核心,但它找不到其他节点。
集群正在使用 SGE,我尝试了很多不同的方法来使节点工作,但只有一个在工作。 Julia 中是否有一种简单的方法可以使用 julia -mpi 32
或类似的东西启动 Julia?
使用
using ClusterManagers
println(nworkers(),nprocs(),Sys.CPU_CORES)
ClusterManagers.addprocs_sge(16)
ClusterManagers.addprocs_sge(15)
println(nworkers(),nprocs(),Sys.CPU_CORES)
不起作用(我提交了一个作业,在 SGE 上保留了 2 个节点,每个节点有 16 个内核),作业的输出文件是空的,相反我得到 16 个不同的输出文件 julia-70755.o8252776.*
(* = 1...16)
带有以下文本:
julia_worker:9009#192.168.17.206
Master process (id 1) could not connect within 60.0 seconds.
exiting.
使用 julia --machinefile $PE_HOSTFILE
启动 Julia 也失败了:
Warning: Permanently added the RSA host key for IP address '192.168.18.10' to th
e list of known hosts.
ERROR: connect: invalid argument (EINVAL)
in uv_error at ./libuv.jl:68 [inlined]
in connect!(::TCPSocket, ::IPv4, ::UInt16) at ./socket.jl:652
in connect!(::TCPSocket, ::SubString{String}, ::UInt16) at ./socket.jl:688
in connect at ./stream.jl:959 [inlined]
in connect_to_worker(::SubString{String}, ::Int16) at ./managers.jl:483
in connect(::Base.SSHManager, ::Int64, ::WorkerConfig) at ./managers.jl:425
in create_worker(::Base.SSHManager, ::WorkerConfig) at ./multi.jl:1786
in setup_launched_worker(::Base.SSHManager, ::WorkerConfig, ::Array{Int64,1}) a
t ./multi.jl:1733
in (::Base.##669#673{Base.SSHManager,Array{Int64,1}})() at ./task.jl:360
in sync_end() at ./task.jl:311
in macro expansion at ./task.jl:327 [inlined]
in #addprocs_locked#665(::Array{Any,1}, ::Function, ::Base.SSHManager) at ./mul
ti.jl:1688
in (::Base.#kw##addprocs_locked)(::Array{Any,1}, ::Base.#addprocs_locked, ::Bas
e.SSHManager) at ./<missing>:0
in #addprocs#664(::Array{Any,1}, ::Function, ::Base.SSHManager) at ./multi.jl:1
658
in (::Base.#kw##addprocs)(::Array{Any,1}, ::Base.#addprocs, ::Base.SSHManager)
at ./<missing>:0
in #addprocs#764(::Bool, ::Cmd, ::Int64, ::Array{Any,1}, ::Function, ::Array{An
y,1}) at ./managers.jl:112
in process_options(::Base.JLOptions) at ./client.jl:227
in _start() at ./client.jl:321
UndefRefError()
有人建议我使用 MPI.jl 包,但在我看来它并不真正支持 julia 并行语法,按照我的方式我通过在我想要并行 运行 的 for 循环之前编写 @sync @parallel 来使用它(即 Metropolis-Montecarlo)。
您可能想阅读有关并行计算的 julia 文档,其中有一节是关于集群管理器的。另外,看看支持 SGE 的 ClusterManagers.jl:
julia> using ClusterManagers
julia> ClusterMangers.addprocs_sge(5)
IT 团队回复我并告诉我 SGE 不允许无密码 ssh,这就是 addprocs_sge()
无法工作的原因。但是,他们现在为我可以传递给 Julia 的作业添加了一个文件,并告诉我 运行 使用此脚本的作业:
qlogin -pe mpi_28_tasks_per_node 56
module load julia/0.5.1
julia --machinefile $TMPDIR/machines
机器文件如下所示:
::::::::::::::
/scratch/8548498.1.u/machines
::::::::::::::
{hostname1}
{hostname1}
...
{hostname2}
{hostname2}