问题描述
我在Linux机器上安装了Rmpi,并成功将其加载到R中.我的机器上有两个版本的MPICH,我(相信)已经安装了最新版本的Rmpi.我还必须更新我的LD_LIBRARY_PATH
.我主要按照此处的安装说明进行操作.
I installed Rmpi on my linux machine and it successfully loads in R. There are two versions of MPICH on my machine, and I (believe) have installed Rmpi with the latest version. I also had to update my LD_LIBRARY_PATH
. I primarily followed the installation instructions here.
在R中加载Rmpi后,我运行mpi.spawn.Rslaves(nslaves=4)
并得到以下错误消息:
After loading Rmpi in R, I run mpi.spawn.Rslaves(nslaves=4)
and get the following error message:
Error in mpi.spawn.Rslaves(nslaves = 2) :
You cannot use MPI_Comm_spawn API
有人知道我如何使Rmpi工作吗?
Does anyone know how I can get Rmpi working?
谢谢!
推荐答案
您需要使用MPICH2生成支持.如果已安装MPICH2,则在安装Rmpi时可能仍需要指定--with-Rmpi-type=MPICH2
.如果改用--with-Rmpi-type=MPICH
,则会禁用mpi.spawn.Rslaves
之类的功能.
You need to use MPICH2 for spawn support. If you have MPICH2 installed, you may still need to specify --with-Rmpi-type=MPICH2
when installing Rmpi. If you used --with-Rmpi-type=MPICH
instead, it would disable functions such as mpi.spawn.Rslaves
.
还请注意,除非使用mpiexec之类的命令启动程序,否则MPICH2显然不支持生成工作程序.基本上,这意味着您不能使用MPICH2从交互式R会话中执行mpi.spawn.Rslaves
,尽管使用Open MPI可以实现.需要明确的是,这不是您要报告的问题,但是在使用MPICH2正确安装Rmpi之后,您可能会遇到此问题.
Also note that MPICH2 apparently does not support spawning workers unless the program is launched using a command such as mpiexec. This basically means that you can't execute mpi.spawn.Rslaves
from an interactive R session using MPICH2, although this is possible using Open MPI. To be clear, this is not the issue that you're reporting, but you may encounter this after you have correctly installed Rmpi using MPICH2.
我能够使用MPICH 3.1.3通过以下命令安装Rmpi 0.6-5:
I was able to install Rmpi 0.6-5 using MPICH 3.1.3 with the command:
$ R CMD INSTALL Rmpi_0.6-5.tar.gz --configure-args='--with-mpi=$HOME/mpich-install --with-Rmpi-type=MPICH2'
要调试配置问题,应从目录而不是tar文件安装Rmpi.这样,您之后便可以检查"config.log"文件,该文件将提供重要信息.这是我在Linux机器上执行的操作:
To debug a configuration problem, you should install Rmpi from a directory rather than a tar file. That will allow you to examine the "config.log" file afterwards which will provide important information. Here is how I did that on my Linux box:
$ tar xzvf Rmpi_0.6-5.tar.gz
$ R CMD INSTALL Rmpi --configure-args='--with-mpi=$HOME/mpich-install --with-Rmpi-type=MPICH2'
为了获得生成支持,在Rmpi中编译C代码时需要定义MPI2
宏.您可以通过在config.log中搜索"PKG_CPPFLAGS"来检查是否发生了这种情况:
In order to get spawn support, the MPI2
macro needs to be defined when compiling the C code in Rmpi. You can check if that is happening by searching for "PKG_CPPFLAGS" in config.log:
$ grep PKG_CPPFLAGS Rmpi/config.log
PKG_CPPFLAGS='-I/home/steve/mpich-install/include -DMPI2 -DMPICH2'
我发现"config.log"对于调试配置和构建问题非常有用.
I have found "config.log" to be very useful for debugging configuration and build problems.
请注意,您可以在没有衍生支持的情况下使用Rmpi.您将需要使用mpirun(或mpiexec等)启动所有工作程序,并且使用[c7>,mpi.applyLB
等功能,如果不是不可能的话,将会更加困难.初始化MPI,以便可以使用C或Fortran中实现的功能使用MPI,您可能需要通过mpirun启动所有工作程序.
Note that you can use Rmpi without spawn support. You'll need to start all of the workers using mpirun (or mpiexec, etc) and it will be much more difficult, if not impossible, to use functions such as mpi.apply
, mpi.applyLB
, etc. But if you just need to initialize MPI so you can use MPI from functions implemented in C or Fortran, you will probably need to start all of the workers via mpirun.
这篇关于rmpi:无法使用MPI_Comm_spawn API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!