doMPI无法识别R脚本的群集中的其他节点

达伦·埃里(Daren Eiri)
  • 使用RHEL7.3
  • 使用R 3.3.2
  • 已安装Rmpi_0.6-6.tar.gz和doMPI_0.2.1.tar.gz
  • 为x86_64安装了mpich-3.0-3.0.4-10.el7 RPM

我创建了一个由三台机器组成的集群(aml1,2,3)。我可以从mpich安装中运行/ examples / cpi示例,并且所有三台计算机上的进程运行都没有问题。

我还可以运行需要多次运行的R脚本,这在doMPI文档中已进行了讨论-因此该脚本可以在所有群集上运行。

我的问题是,当我的R脚本的%dopar%之前的代码需要在master(aml1)上运行一次,并且%dopar%在群集(aml2,aml3)上运行时。它仅在主服务器上运行。而且doMPI表示Size of MPI universe: 0并且无法识别aml2或aml3。

例如:

跑步: mpirun -np 1 --hostfile ~/projects/hosts R --no-save -q < example6.R

(我的~/projects/hosts文件已定义为使用8个内核)

example6.R:

library(doMPI) #load doMPI library
cl <- startMPIcluster(verbose=TRUE)
#load data
#clean data
#perform some functions

#let's say I want to have this done in the script and only parallelize this
x <- foreach(seed=c(7, 11, 13), .combine="cbind") %dopar% {
 set.seed(seed)
 rnorm(3)
 }
x
closeCluster(cl)

example6.R的输出:

Master processor name: aml1; nodename: aml1
Size of MPI universe: 0
Spawning 2 workers using the command:
  /usr/lib64/R/bin/Rscript /usr/lib64/R/library/doMPI/RMPIworker.R WORKDIR=/home/spark LOGDIR=/home/spark MAXCORES=1 COMM=3 INTERCOMM=4 MTAG=10 WTAG=11 INCLUDEMASTER=TRUE BCAST=TRUE VERBOSE=TRUE
 2 slaves are spawned successfully. 0 failed.

如果我定义,cl <- startMPIcluster(count=34, verbose=TRUE)我仍然得到以下信息,但至少我可以运行34个奴隶:

Master processor name: aml1; nodename: aml1
Size of MPI universe: 0
34 slaves are spawned successfully. 0 failed.

我该如何解决?我想运行R脚本,以便它在主服务器上运行第一部分,然后在集群上执行%dopar%。

谢谢!!

更新1

自上次更新以来,我尝试运行旧版本的OpenMPI:

[spark@aml1 ~]$ which mpirun
/opt/openmpi-1.8.8/bin/mpirun

对于@SteveWeston,我创建了以下脚本并运行它:

[spark@aml1 ~]$ cat sanity_check.R
library(Rmpi)
print(mpi.comm.rank(0))
mpi.quit()

具有以下输出:

[spark@aml1 ~]$ mpirun -np 3 --hostfile ~/projects/hosts R --slave -f sanity_check.R
FIPS mode initialized
master (rank 0, comm 1) of size 3 is running on: aml1
slave1 (rank 1, comm 1) of size 3 is running on: aml1
slave2 (rank 2, comm 1) of size 3 is running on: aml1
[1] 0

它只是挂在这里-没有任何反应。

达伦·埃里(Daren Eiri)

我已经接受@SteveWeston的回答,因为它有助于我更好地理解我的原始问题。

我评论了他的回答,说我的R脚本挂起仍然有问题;这些脚本可以运行,但是它永远无法独立完成或关闭自己的集群,我必须使用ctrl-C杀死它。

我最终建立了一个nfs环境,在那里建立并安装了openmpi-1.10.5,并在那里也安装了我的R库。R分别安装在两台计算机上,但是它们在我的nfs目录中共享相同的库。以前,我已经在root用户下安装和管理了所有内容,包括R库(我知道)。我不确定这是否引起了并发症,但我的问题似乎已经解决。

[master@aml1 nfsshare]$ cat sanity_check.R
library(Rmpi)
print(mpi.comm.rank(0))
mpi.quit(save= "no")

[master@aml1 nfsshare]$ mpirun -np 3 --hostfile hosts R --slave -f sanity_check.R
FIPS mode initialized
[1] 1
[1] 0
[1] 2
# no need to ctrl-C here. It no longer hangs

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章