Instructions to install Rmpi (under Linux only)

Due to various distributions of Linux or other types of Unix, it is hard to give instructions that can be applied to all situations. However, the supplied configurations should be working for many well known distributions such as RedHat, Debian, etc. Before installing, make sure you have a proper installed MPI environment. All configurations for various systems are in the file configure.ac. Feel free to modify it to fit your system. Then run autoconf to generate a new configure file.

  1. Run “R CMD INSTALL Rmpi_version.tar.gz”.
    1. Success. Luck you.
    2. If mpi.h or mpi library couldn’t be found, move to step 2.
    3. If compiling successful but failing to do loading test, then mpi libraries are not in LD_LIBRARY_PATH. Modify R in R_home_dir/bin:  at the third line, add
      LD_LIBRARY_PATH=/path/to/your_mpi_lib_dir.
      If this still fails, try
      R CMD INSTALL Rmpi_version.tar.gz --no-test-load
      then run
      R CMD ldd R_home_dir/library/Rmpi/libs/Rmpi.so
      This will give a clue if a right mpi library is linked.

  2. Assume that the MPI is installed at a central location with sub directories include and lib, then run
    R CMD INSTALL Rmpi_version.tar.gz --configure-args=--with-mpi=/path/to/central_location_dir
    You may go to the step 1.c. to finish the installation.

  3. Assume that the MPI is installed at different locations with its include and lib files, then run
      R CMD INSTALL Rmpi_version.tar.gz --configure-args="  \\
    --with-Rmpi-include=/path/to/mpi_include_dir \\ --with-Rmpi-libpath=/path/to/mpi_lib_dir \\ --with-Rmpi-type={OPENMPI or MPICH or MPICH2 or LAM}"
    You may go to the step 1.c. to finish the installation. If you install Rmpi  on a Cray cluster, please use
      R CMD INSTALL Rmpi_version.tar.gz --configure-args="  \\
    --with-Rmpi-include=/path_to_cray_mpich2_include_dir \\ --with-Rmpi-libpath=/path_to_cray_mpich2_lib_dir \\ --with-Rmpi-type=CRAY" --no-test-load

    Note: Use aprun to launch Rmpi instead of mpirun on a Cray cluster.

These three steps should be enough for most cases. If Rmpi still fails to be installed, then check MPI installation. As for Open MPI, after installation, make sure to set LD_LIBRARY_PATH properly. In case you got errors like (most likely under OpenMPI 1.7 or 1.8)

mca: base: component_find: unable to open /usr/local/openmpi-1.6.5/lib/openmpi/mca_paffinity_hwloc:
/usr/local/openmpi-1.6.5/lib/openmpi/mca_paffinity_hwloc.so: undefined symbol:

then configure OpenMPI with ./configure --disable-dlopen

How to test Rmpi

To test if Rmpi can be run on a host with OpenMPI, try at command line
   mpirun  -oversubscribe -np 1 R --vanilla

Then run R and

> library(Rmpi)
 library(Rmpi)
 > mpi.spawn.Rslaves()

Some slaves should be spawned. Test a few Rmpi functions like mpi.remote.exec.