doMPI error: There are not enough slots available in the system to satisfy the 2 slots that were requested by the application

doMPI error: There are not enough slots available in the system to satisfy the 2 slots that were requested by the application

我正在尝试在我的本地 machine 上获取 doMPI 包 运行ning,以便我可以在将作业提交到集群之前对其进行测试。我正在使用 Mac OSX Yosemite 并通过 brew 安装了 open mpi 2.0.2。

mpirun -V

mpirun (Open MPI) 2.0.2

Report bugs to http://www.open-mpi.org/community/help/

我已经阅读了 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中的主机数量运行。这里我指定了四台主机。

startMPIcluster() #in sincMPI.R 
mpirun -H localhost,localhost,localhost,localhost R --slave -f sincMPI.R

您甚至可以使用此方法指定多于可用内核的数量。我有 8 个(逻辑)核心,但我可以指定 9 个主机,它 运行s.

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 来控制任务数?

通过使用 mpirun -H localhost 选项,MPI 宇宙大小只有一个,这导致 mpi.comm.spawn 在示例调用 startMPIcluster 时失败。如果您使用 -H localhost,localhost,localhost,Universe 大小将为 3,该示例应该有效。


更新

请注意,在单台计算机上交互式执行时(即,当我 使用 mpirun 时,我只调用带有计数参数的 startMPIcluster )。使用mpirun执行doMPI脚本时,我发现通过mpirun控制worker的数量更容易。