我试图让 doMPI 包在我的本地机器上运行,这样我就可以在将作业提交到集群之前对其进行测试。我正在使用 Mac OSX Yosemite 并通过 brew 安装了 open mpi 2.0.2。
mpirun -V
mpirun(开放 MPI)2.0.2
我已经阅读了 doMPI 的介绍,我正在尝试执行演示中的示例
mpirun -H localhost R --slave -f sincMPI.R
不幸的是,我不断收到以下错误。我用谷歌搜索,但似乎无法弄清楚可能出了什么问题。
> Loading required package: foreach Loading required package: iterators
> Loading required package: Rmpi
> --------------------------------------------------------------------------
> There are not enough slots available in the system to satisfy the 2
> slots that were requested by the application:
> /Library/Frameworks/R.framework/Resources/bin/Rscript
>
> Either request fewer slots for your application, or make more slots
> available for use.
> --------------------------------------------------------------------------
> Error in mpi.comm.spawn(slave = rscript, slavearg = args, nslaves =
> count, : MPI_ERR_SPAWN: could not spawn processes Calls:
> startMPIcluster -> mpi.comm.spawn -> .Call Execution halted
> -------------------------------------------------------
> Primary job terminated normally, but 1 process returned a non-zero exit code..
>Per user-direction, the job has been aborted.
> -------------------------------------------------------
> --------------------------------------------------------------------------
> mpirun detected that one or more processes exited with non-zero
> status, thus causing the job to be terminated. The first process to do
> so was:
>
> Process name: [[27630,1],0] Exit code: 1
已编辑:基于以下答案的测试结果
按规定工作:
mpirun -H localhost,localhost,localhost R --slave -f sincMPI.R
我从 startMPIcluster() 中取出 count=2 ,它也有效。
startMPIcluster() #in sincMPI.R
mpirun -H localhost,localhost,localhost R --slave -f sincMPI.R
如果取出count=2,就可以改变mpi run中的主机数。这里我指定了四个主机。
startMPIcluster() #in sincMPI.R
mpirun -H localhost,localhost,localhost,localhost R --slave -f sincMPI.R
您甚至可以使用此方法指定多于可用内核的数量。我有 8 个(逻辑)核心,但我可以指定 9 个主机并且它运行。
mpirun -H localhost,localhost,localhost,localhost,localhost,localhost,localhost,localhost,localhost R --slave -f sincMPI.R
但是,您不能将 count=9 放入 startMPIcluster()
startMPIcluster(count=9)
Error in startMPIcluster(count = 9) :
count must be either unspecified, or set to 8
Execution halted
那么,也许在 mac 上测试 mpi 的最佳方法是不在 startMPIcluster 中设置计数,而使用 -H 来控制任务数?