Instructions to install and run Rmpi under Windows with MPICH2

(Tested on Windows 7 64bit)

Note: Instructions to run under DeinoMPI are given here. Binary version of  Rmp compiled under MPICH2 can be used directly.

Note: It has been discovered that spawned slaves under MPICH2 1.3.0 or later consume 100% CPU while waiting for instructions from master.  Use Rmpi 0.6-1 or later.

Note: It seems wmpiconfig doesn’t work for MPICH2 64bit version. Even with 32bit version, seting up multiple hosts is useless since smpd cannot get that informatin. Instead smpd is used for multiple hosts setup. See the instructions in Step 5.


  1. Install MPICH2 for Windows (either 32 or 64bit depending on which version of R used).

Find the latest version at  Version 1.4.p1 or later is recommended.

Notice that during installation, there is a window to specify pass phrase with default value "behappy". Either keep the default or use a different pass phrase (not your user password). Run wmpiregister to register your account login name and password.

2.      Add MPICH2 bin directory to PATH environment variables. This is very important. Otherwise Rmpi will not run properly.

    1. Right click "My Computer" and choose "Properties". Click "Advanced system settings" to get a new window.
    2. Click "Environment Variables..." to get a new window. Locate variable "PATH" (it is version dependent. Either User or System variables will be fine). Click Edit to get a new window.
    3. At end of Variable value, add ";C:\Program Files\MPICH2\bin" (Remove the double quotations ). It may be ;C:\Program Files (x86)\MPICH2\bin” for 32bit MPICH2.

  1. Open "Command Prompt" with administrator. At prompt, type
         smpd -install -phrase behappy
    (change behappy to whatever the pass phrase you choose). Run
         smpd -status
    If it returns "smpd running on your_host_name", then smpd is setup properly.

  1. Download Rmpi for windows. Get it here. Get the newest one (0.6-1 or later). Launch R with administrator to install Rmpi. Quit R and launch R with normal user. Try the following codes to see if Rmpi runs properly
         mpi.parReplicate(20, mean(rnorm(1000000)))

    If it runs, congratulation. Yes. You can run Rmpi without mpiexec.exe. You can completely forget about MPICH2 (if Steps 2 and 3 are done properly) and use Rmpi like a normal R package.

  1. Run Rmpi under multiple windows PCs ( LAN with wire or wireless).
    1. Repeat Steps 1,2,3,and 4 on each window PC. Make sure that you have the same account and same pass phrase as far as MPICH2 concerns. Install R at the same location.
    2. Need to setup windows firewall to let Rgui.exe and Rterm.exe go through. For testing purpose, turn off windows firewall to see if Rmpi works or not.
    3. At master node, open "Command Prompt" with administrator. Let us assume that the master node has 4 CPUs and two remote nodes (karl and kiefer as their windows names respectively) have 2 CPUs each. At prompt, type
          smpd -sethosts localhost:4 karl:2 kiefer:2
      Then run
          smpd -get hosts
      If it returns the same hosts list, like "localhost:4 karl:2 kiefer:2", then mutiple hosts are setup properly.
    4. On the master, launch R and try the following codes to see if Rmp runs properly

      If  it runs, then there should be 4 slaves on the master, 2 on karl and 2 on kiefer.

(last update 08/17/2012)