现在在用Rmpi包进行集群运算,但是在fedora linux下安装Rmpi的时候出现dyn.load()错误的问题,想请教一下大家,希望熟悉Rmpi的大虾们多多帮忙。
先说一下自己安装Rmpi的过程,安装的R版本是2.12.0(因为linux下Rmpi的最新版就支持到2.12.0),是手动编译安装的,命令如下:
<br />
./configure --prefix=/home/masc/software/R --enable-R-shlib --enable-BLAS-shlib<br />
make<br />
make install<br />
</p>
装好R之后,下载的源码Rmpi_0.5-9.tar.gz进行安装:
<br />
R CMD INSTALL --configure-args="--with-mpi=/opt/mpi/mvapich2-1.6_gcc-4.6 --with-Rmpi-type=MPICH" /home/masc/software/Rmpi_0.5-9.tar.gz<br />
</p>
Rmpi包安装成功了,可是最后检查能否load的时候出错了,出现dyn.load()错误,信息如下:
<br />
* installing to library '/home/masc/software/R/lib64/R/library'<br />
* installing *source* package 'Rmpi' ...<br />
checking for gcc... gcc -std=gnu99<br />
checking for C compiler default output file name... a.out<br />
checking whether the C compiler works... yes<br />
checking whether we are cross compiling... no<br />
checking for suffix of executables...<br />
checking for suffix of object files... o<br />
checking whether we are using the GNU C compiler... yes<br />
checking whether gcc -std=gnu99 accepts -g... yes<br />
checking for gcc -std=gnu99 option to accept ISO C89... none needed<br />
Trying to find mpi.h ...<br />
Found in /opt/mpi/mvapich2-1.6_gcc-4.6/include<br />
Trying to find libmpi.so or libmpich.a ...<br />
Found libmpich in /opt/mpi/mvapich2-1.6_gcc-4.6/lib<br />
checking whether MPICH2 is declared... yes<br />
checking whether MPICH2 is declared... (cached) yes<br />
checking for openpty in -lutil... yes<br />
checking for main in -lpthread... yes<br />
configure: creating ./config.status<br />
config.status: creating src/Makevars<br />
** libs<br />
gcc -std=gnu99 -I/home/masc/software/R/lib64/R/include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=1 -DHAVE_DECL_MPICH2=1 -I/opt/mpi/mvapich2-1.6_gcc-4.6/include -DMPI2 -DMPICH -I/usr/local/include -fpic -g -O2 -c RegQuery.c -o RegQuery.o<br />
gcc -std=gnu99 -I/home/masc/software/R/lib64/R/include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=1 -DHAVE_DECL_MPICH2=1 -I/opt/mpi/mvapich2-1.6_gcc-4.6/include -DMPI2 -DMPICH -I/usr/local/include -fpic -g -O2 -c Rmpi.c -o Rmpi.o<br />
gcc -std=gnu99 -I/home/masc/software/R/lib64/R/include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=1 -DHAVE_DECL_MPICH2=1 -I/opt/mpi/mvapich2-1.6_gcc-4.6/include -DMPI2 -DMPICH -I/usr/local/include -fpic -g -O2 -c conversion.c -o conversion.o<br />
gcc -std=gnu99 -I/home/masc/software/R/lib64/R/include -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_DECL_MPICH2=1 -DHAVE_DECL_MPICH2=1 -I/opt/mpi/mvapich2-1.6_gcc-4.6/include -DMPI2 -DMPICH -I/usr/local/include -fpic -g -O2 -c internal.c -o internal.o<br />
gcc -std=gnu99 -shared -L/usr/local/lib64 -o Rmpi.so RegQuery.o Rmpi.o conversion.o internal.o -L/opt/mpi/mvapich2-1.6_gcc-4.6/lib -lmpich -lutil -lpthread -L/home/masc/software/R/lib64/R/lib -lR<br />
installing to /home/masc/software/R/lib64/R/library/Rmpi/libs<br />
** R<br />
** demo<br />
** inst<br />
** preparing package for lazy loading<br />
** help<br />
*** installing help indices<br />
** building package indices ...<br />
** testing if installed package can be loaded<br />
Error in dyn.load(file, DLLpath = DLLpath, ...) :<br />
unable to load shared object '/home/masc/software/R/lib64/R/library/Rmpi/libs/Rmpi.so':<br />
libmpich.so.1.2: cannot open shared object file: No such file or directory<br />
Warning: .Last.lib failed in detach() for 'Rmpi', details:<br />
call: dyn.unload(file.path(libpath, "libs", paste("Rmpi", .Platform$dynlib.ext,<br />
error: shared object '/home/masc/software/R/lib64/R/library/Rmpi/libs/Rmpi.so' was not loaded<br />
ERROR: loading failed<br />
* removing '/home/masc/software/R/lib64/R/library/Rmpi'<br />
</p>
以为是dyn.load()的问题,于是运行了一下下面的代码,却成功通过了:
<br />
> code <- '#include <Rdefines.h>\nSEXP f(){\n return R_NilValue ; }'<br />
> writeLines( code, "test.c" )<br />
> system( "R CMD SHLIB test.c" )<br />
gcc -std=gnu99 -I/home/masc/software/R/lib64/R/include -I/usr/local/include -fpic -g -O2 -c test.c -o test.o<br />
gcc -std=gnu99 -shared -L/usr/local/lib64 -o test.so test.o -L/home/masc/software/R/lib64/R/lib -lR<br />
> dyn.load( "test.so" )<br />
> .Call( "f" )<br />
NULL<br />
</p>
于是我就不知道什么问题了...还请各位大虾们多多指点,在此先行谢过了![s:13]