1.我有一个库fpmpi。我从这个库创建了共享库fpmpi.so。我正在使用ubuntu。
2.现在,我想在我的R包中使用。我的R包有src文件夹,有makevars.in文件我
### Setup R source code and objects.
PKG_CPPFLAGS = @PKG_CPPFLAGS@
PKG_LIBS = -L/home/g/Desktop/Project -fpmpip
### For user configuration.
USER_CONF = Makeconf
### Start making here.
all: $(SHLIB)
@echo "MPIRUN = @MPIRUN@" > $(USER_CONF)
@echo "MPIEXEC = @MPIEXEC@" >> $(USER_CONF)
@echo "ORTERUN = @ORTERUN@" >> $(USER_CONF)
@echo "TMP_INC = @TMP_INC@" >> $(USER_CONF)
@echo "TMP_LIB = @TMP_LIB@" >> $(USER_CONF)
@echo "MPI_ROOT = @MPI_ROOT@" >> $(USER_CONF)
@echo "MPITYPE = @MPITYPE@" >> $(USER_CONF)
@echo "MPI_INCLUDE_PATH = @MPI_INCLUDE_PATH@" >> $(USER_CONF)
@echo "MPI_LIBPATH = @MPI_LIBPATH@" >> $(USER_CONF)
@echo "MPI_LIBS = @MPI_LIBS@" >> $(USER_CONF)
@echo "MPI_DEFS = @MPI_DEFS@" >> $(USER_CONF)
@echo "MPI_INCL2 = @MPI_INCL2@" >> $(USER_CONF)
@echo "PKG_CPPFLAGS = @PKG_CPPFLAGS@" >> $(USER_CONF)
@echo "PKG_LIBS = @PKG_LIBS@" >> $(USER_CONF)
$(SHLIB): $(OBJECTS)
clean:
@rm -rf *.o *.d *.rc *.so* *.dll *.dylib *.a *.lib \
Makedeps Makevars $(USER_CONF) $(SHLIB) $(OBJECTS)
我在哪里定义共享库路径。我将如何验证它已被加载。 该库是动态的,我使用ldd fpmpi.so
进行检查我使用R CMD INSTALL package_name命令来安装包?
R CMD INSTALL package_name的输出为:
g@G:~/Documents/igauravsehrawat.github.io$ sudo R CMD INSTALL pbdMPI/
* installing to library ‘/home/g/R/x86_64-pc-linux-gnu-library/2.15’
* installing *source* package ‘pbdMPI’ ...
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking for mpirun... mpirun
checking for mpiexec... mpiexec
checking for orterun... orterun
checking for sed... /bin/sed
checking for mpicc... mpicc
checking for ompi_info... ompi_info
checking for mpich2version... mpich2version
found sed, mpicc, and ompi_info ...
gcc: error: unrecognized option '--showme:incdirs'
>> TMP_INC_DIRS =
gcc: error: unrecognized option '--showme:libdirs'
>> TMP_LIB_DIRS =
I am here /usr/lib/openmpi and it is OpenMPI
Trying to find mpi.h ...
Found in /usr/lib/openmpi/include
Trying to find libmpi.so or libmpich.a ...
Found libmpi in /usr/lib/openmpi/lib
checking for openpty in -lutil... yes
checking for main in -lpthread... yes
******************* Results of pbdMPI package configure *****************
>> TMP_INC = F
>> TMP_LIB = F
>> MPI_ROOT = /usr/lib/openmpi
>> MPITYPE = OPENMPI
>> MPI_INCLUDE_PATH = /usr/lib/openmpi/include
>> MPI_LIBPATH = /usr/lib/openmpi/lib
>> MPI_LIBS = -lutil -lpthread
>> MPI_DEFS = -DMPI2
>> MPI_INCL2 =
>> PKG_CPPFLAGS = -I/usr/lib/openmpi/include -DMPI2 -DOPENMPI
>> PKG_LIBS = -L/usr/lib/openmpi/lib -lmpi -lutil -lpthread
*************************************************************************
configure: creating ./config.status
config.status: creating src/Makevars
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.r
** libs
installing via 'install.libs.R' to /home/g/R/x86_64-pc-linux-gnu-library/2.15/pbdMPI
** R
** data
** moving datasets to lazyload DB
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
‘pbdMPI-guide.Rnw’
** testing if installed package can be loaded
* DONE (pbdMPI)
由于