Title: Compiling npRmpi from source code under MS Windows 7 (32-bit/64-bit)

Date: 07/14/2011
Author: David T. Jacho-Chavez (djachocha@emory.edu)

These are based on those given in http://www.stats.uwo.ca/faculty/yu/Rmpi/

1) Create the folder "R_temp" in your C:\ drive.

2) Download the following files and place then in "C:\R_temp" (note
   version numbers as most recent versions of each program may create
   undesirable results):

R-2.13.1-win.exe           http://www.r-project.org/
Rtools213.exe              http://www.murdoch-sutherland.com/Rtools/
mpich2-1.3rc1-win-ia       http://www-unix.mcs.anl.gov/mpi/mpich2
npRmpi_0.40-7.tar.gz       http://cran.r-project.org/web/packages/npRmpi/index.html
test.R                     http://www.economics.mcmaster.ca/faculty/racinej
.Rprofile                  http://www.economics.mcmaster.ca/faculty/racinej

 * If you have problems downloading this file in MS Windows, a local
   copy will be located in "C:\R_Temp\npRmpi\inst" (See step 3-(i)
   below) that you can freely move to your working directory (see note
   (i) at the bottom of this document)

3) Install the following programmes (in this order) using the default
   directories:

  (i) R-2.13.1-win.exe (If you experience any difficulties, 
      kindly refer to installation instructions at
      http://www.r-project.org/)

      After installation, add the R bin directory to your PATH
      environment variables.

      Right click "My Computer" and choose "Properties". Click
      "Advanced system settings" to get a new window.

      Click "Environment Variables..." to get a new window. Locate the
      variable "PATH" (it is version dependent. Either User or System
      variables will be fine). Click Edit to get a new window.

      At the end of Variable value, add

      ;C:\Program Files\R\R-2.13.1\bin\i386;

 (ii) Rtools213.exe (If you experience any difficulties, kindly
      refer to installation instructions at
      http://www.murdoch-sutherland.com/Rtools/)

      During installation, accept all default folders. After installation,
      add the Rtools bin directory to your PATH environment variables.

      Right click "My Computer" and choose "Properties". Click
      "Advanced system settings" to get a new window.

      Click "Environment Variables..." to get a new window. Locate the
      variable "PATH" (it is version dependent. Either User or System
      variables will be fine). Click Edit to get a new window.

      At the beginning of Variable value, add

      C:\Rtools\bin;C:\Rtools\perl\bin;C:\Rtools\MinGW\bin;

(iii) mpich2-1.3rc1-win-ia (If you experience any difficulties,
      kindly refer to installation instructions at
      http://www.stats.uwo.ca/faculty/yu/Rmpi/windows.htm)

      Before installing MPICH2, you may need Microsoft .Net Framework 4
      (Standalone Installer) Visual C++ 2010 Redistributable Package
      (x86).

      After installation, add the MPICH2 bin directory to your PATH
      environment variables.

      Right click "My Computer" and choose "Properties". Click
      "Advanced system settings" to get a new window.

      Click "Environment Variables..." to get a new window. Locate the
      variable "PATH" (it is version dependent. Either User or System
      variables will be fine). Click Edit to get a new window.

      At end of Variable value, add 

      ;C:\Program Files (x86)\MPICH2\bin;

      Next launch wmpiconfig.exe from the Start menu. First it will
      ask you for your account name and password. Enter your account
      name and password. Click "Register" and then "OK". After that
      MPICH2 Configurable Settings will show up. Click "Get Settings"
      on the right upper corner. If your machine name gets a green
      color on the left hosts panel, then MPICH2 is running
      properly. Otherwise open "Command Prompt" as the
      administrator. At the prompt, type

      smpd -install -phrase mypassword

      (change `mypassword' to your actual password). click "Get
      Settings" again to see if your host gets green color.

4) Copy npRmpi_0.40-7.tar.gz to the "C:\R_temp" folder.

5) (i) Untar npRmpi_0.40-7.tar.gz in the "C:\R_temp" folder.

  * To 'untar' in MS Windows, please download & install the following
    freeware programme: 7-zip (http://www.7-zip.org)

  (ii) 'Open a command window here' (google this phrase if you don't
   know how) in "C:\R_Temp\" and type:

  R CMD INSTALL npRmpi

6) To test your installation now type:

  mpiexec -n 2 R --no-save -q < test.R > test_np_2.txt

7) Now open test_np_2.txt and if you find no errors, your installation
   has been successful!

Notes:

  (i) If you are planning to run R programmes in other folders that
      use the npRmpi package, simply make sure that the file .Rprofile
      is always located in the same folder as the programme you are
      trying to run, otherwise it will not work.

 (ii) The command 'mpiexec' is available only when the proper
      installation of mpich2-1.2.1p1-win-ia is performed. 
      Kindly refer to
      http://www.stats.uwo.ca/faculty/yu/Rmpi/windows.htm for
      step-by-step instructions.
