[R-sig-hpc] Rmpi loads 2 versions of the same library

Ross Boylan ross at biostat.ucsf.edu
Thu Mar 13 20:16:08 CET 2014


I've been trying to get Rmpi to work with my personal copy of MPI, which
is newer than the system's.  Even when I set LD_LIBRARY_PATH
appropriately, and build Rmpi with

  export LD_LIBRARY_PATH=/home/ross/install/lib:$LD_LIBRARY_PATH
  export PATH=/home/ross/install/bin:$PATH
  # Not sure what I should use for --with-mpi
  R CMD INSTALL Rmpi --configure-args='--with-Rmpi-include=/home/ross/install/include --with-Rmpi-libpath=/home/ross/install/lib --with\
  -mpi=/home/ross/install --with-Rmpi-type=OPENMPI'

I find that the R process opens both the system and personal copies of
mpi-related libs (according to lsof and /proc/nnn/map).  ldd on my
Rmpi.so shows only references to my local copies.  I think the paths
show by ldd are simply advisory.

I think the cause is this code in Rmpi.c:
    if (!dlopen("libmpi.so.0", RTLD_GLOBAL | RTLD_LAZY)
        && !dlopen("libmpi.so", RTLD_GLOBAL | RTLD_LAZY)){
http://www.stats.uwo.ca/faculty/yu/Rmpi/changelogs.htm notes
----------------------------------
2007-10-24, version 0.5-5:

dlopen has been used to load libmpi.so explicitly. This is mainly useful for Rmpi under OpenMPI where one might see many error messages:
mca: base: component_find: unable to open osc pt2pt: file not found (ignored)
if libmpi.so is not loaded with RTLD_GLOBAL flag.
-------------------------------------

I'm not sure which version of mpi ends up getting used.

I also don't know why libmpi.so.0 is preferred to libmpi.so.1 in the
explicit load above.

Using LD_DEBUG shows
24312:     file=libmpi.so.1 [0];  needed by /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so [0]
24312:     find library=libmpi.so.1 [0]; searching
24312:      search path=/usr/lib64/R/lib:/home/ross/install/lib            (LD_LIBRARY_PATH)
24312:       trying file=/usr/lib64/R/lib/libmpi.so.1
24312:       trying file=/home/ross/install/lib/libmpi.so.1

and, later,
     24312:     file=libmpi.so.0 [0];  needed by /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so [0]
     24312:     find library=libmpi.so.0 [0]; searching
     24312:      search path=/usr/lib64/R/lib:/home/ross/install/lib            (LD_LIBRARY_PATH)
     24312:       trying file=/usr/lib64/R/lib/libmpi.so.0
     24312:       trying file=/home/ross/install/lib/libmpi.so.0
     24312:      search cache=/etc/ld.so.cache
     24312:       trying file=/usr/lib/libmpi.so.0

Does anyone know what's going on?

Ross Boylan

P.S. This might be relevant:
     24300:     calling init: /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so
     24300:
     24300:     opening file=/home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so [0]; direct_opencount=1
     24300:
     24300:     /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so: error: symbol lookup error: undefined symbol: R_init_Rmpi (fatal)
     24300:     /home/ross/Rlib-3.0.1/Rmpi/libs/Rmpi.so: error: symbol lookup error: undefined symbol: R_init_Rmpi (fatal)



More information about the R-sig-hpc mailing list