Instructions to install and run Rmpi under Microsoft MPI

(Tested on Windows 10 Pro 64bit)

Note: Instructions to run Rmpi under MPICH2 are given here. However, duo to discontinuation of MPICH2, Rmpi (version 0.6-3 or older) cannot be guarantied to work properly.

Steps:

  1.   Install Microsoft MPI  for Windows. The software name is called "Microsoft MPI Redistributable Package".

It can be found from https://msdn.microsoft.com/en-us/library/bb524831%28v=vs.85%29.aspx
Install MSMpiSetup.exe to get MPI running environment. The default location is in C:\Program Files\Microsoft MPI. You can install Rmpi windows binary from within Rstudio. However, if you want to compile Rmpi yourselves, you have to install SDK msmpisdk.msi at the default location: C:/Program Files (x86)/Microsoft SDKs/MPI


2.    Install Rmpi through Rstudio or compile it yourselves with Rtools. If you compile Rmpi yourselves and Microsoft MPI is not installed in the default location C:/Program Files (x86)/Microsoft SDKs/MPI, please set up MPI_HOME environment variable before compiling.


  1. To use Rmpi through Rstudio, you need to create a shortcut with Target:
    "C:\Program Files\Microsoft MPI\Bin\mpiexec.exe" -n 1 "C:\Program Files\RStudio\bin\rstudio.exe"
    • Run library(Rmpi); mpi.spawn.Rslaves() in Rstudio to spawn R slaves.
    • Check if Rmpi is running properly,
      • mpi.setup.rngstream(iseed=123)
      • mpi.parReplicate(80, mean(rnorm(1000000)))
      • To close all R slaves, run
      • mpi.close.Rslaves()
      • To quit Rmpi
      • mpi.exit()
  2. To use Rmpi at R terminal, you need DOS terminal or PowerShell.

    • Copy Rmpi's Rprofile to your working directory as .Rprofile.
    • Launch Rmpi on a 8-core PC, run (1 master and 8 slaves for total 9 R sessions) as
      mpiexec  -n 9 "C:\Program Files\R\R-3.0.3\bin\x64\Rterm.exe" --no-save -q


(last update 04/05/2018)