wiki:R-MPI_Install

Version 14 (modified by jazz, 17 years ago) (diff)

--

R-MPI

1.What is R-MPI


2.Software Requirement

  • MPI implements
    • mpich2, mpich, LAM/MPI (7.0.2 or higher)
      • For mpich2 installation, please reference here
    • OpenMPI may causes some problem, not for sure.
  • R (2.0.0 or higher)
    • Assuming that your system is ubuntu or you got apt-get commands, you can just install R by :
      root@client-01:~# apt-get install r-base-core
      
  • gcc-4.2
    • As previous step, you can install gcc-4.2 by :
      root@client-01:~# apt-get install gcc-4.2
      

3.Install Rmpi

  • Download for Rmpi from here. The latest version is 0.5-5.
    root@client-01:/opt# wget http://www.stats.uwo.ca/faculty/yu/Rmpi/download/linux/Rmpi_0.5-5.tar.gz
    
  • Assuming that your system have installed R, gcc-4.2 and any one of MPI implements already. Then we can start to install Rmpi as follows
    root@client-01:/opt# R CMD INSTALL Rmpi_0.5-5.tar.gz
    
  • Rmpi have been installed successfully so far.

4.Test for Rmpi

  • At first, you need to start mpi at Master node (such as client-01).
    For example, mpich2,
    root@client-01:/opt# mpdboot -n 3 -f /root/mpich2-1.0.7rc1/mpd.hosts
    root@client-01:/opt# mpdtrace
    client-01
    client-03
    client-02
    
  • Test for example program
    Notice that this example has a plot in it so trying it in X-windows.
    root@client-01:/opt# wget http://ace.acadiau.ca/math/ACMMaC/Rmpi/task_pull.R
    root@client-01:/opt# mpirun -np 1 R --slave CMD BATCH task_pull.R
    
  • If success, there will be two files generated out, they are Rplots.ps, task_pull.Rout.
  • Simple check of R-MPI environment
    • Reference code from Rmpi Sample Program, Acadia Centre for Mathematical Modelling and Computation
      # R
      > if (!is.loaded("mpi_initialize")) {
      + library("Rmpi")
      + }
      
  • If you did not install LAM/MPI, you should see this message
    > if (!is.loaded("mpi_initialize")) {
    + library("Rmpi")
    + }
    
            LAM/MPI runtime environment is not operating.
            Starting LAM/MPI runtime environment.
    
  • For more test program, please reference R_note.

5.Reference