= R-MPI = == 1.What is R-MPI == ---- == 2.Software Requirement == * MPI implements * mpich2, mpich, [http://www.lam-mpi.org/ LAM/MPI] (7.0.2 or higher) * For mpich2 installation, please reference [wiki:MPICH2_Install 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 should install gcc-4.2 by : {{{ root@client-01:~# apt-get install gcc-4.2 }}} * If you want use lower version of gcc, please link the gcc-4.2 to your location of your gcc compiler. Such as: {{{ root@client01:~# ln -s /usr/bin/gcc /usr/bin/gcc-4.2 }}} ---- == 3.Install Rmpi == * Download for Rmpi from [http://www.stats.uwo.ca/faculty/yu/Rmpi/ 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 --configure-args=--with-mpi=/opt/mpich2 }}} * 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).[[BR]] 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 [http://ace.acadiau.ca/math/ACMMaC/Rmpi/task_pull.R example program][[BR]] '''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.[[BR]] * Simple check of R-MPI environment * Reference code from [http://ace.acadiau.ca/math/ACMMaC/Rmpi/sample.html 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 [http://www.math.ncu.edu.tw/~chenwc/R_note/index.php?item=Rmpi R_note]. ---- == 5.Reference == * [http://www.r-project.org/ The R Project Offical Website] * [http://www.stats.uwo.ca/faculty/yu/Rmpi/ Rmpi Project Offical Website] * [http://www.statistik.uni-dortmund.de/useR-2008/ The R User Conference 2008] * [http://cran.r-project.org/web/packages/Rmpi/index.html Rmpi: Interface (Wrapper) to MPI (Message-Passing Interface)] * [http://packages.debian.org/stable/math/r-cran-rmpi Debian Rmpi Package] * [http://www.eyaoo.net/R/ Chinese Documentation for GNU R] - δΈ­ζ–‡ζ‰‹ε†Š