Rmpi for Mac OS X

Use homebrew to install Open MPI and Rmpi on Mac OS (64bit only)

  1. For Mac OS El Capitan, follow this page to install Apple's Xcode, Command Line Tools, and homebrew (just homebrew itself).
    For old versions of Mac OS, follow this page to install Apple's Xcode, Command Line Tools, and homebrew. Follow up to the Step 3 in that guide.

    If you get /usr/local not writable error on 10.13 high Sierra, please use
       /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    to update homebrew.
  2. At the terminal, install gcc by
    brew install gcc
  3. At the terminal, install Open MPI by
    brew install open-mpi
    May need to run (if Rmpi cannot be loaded)
    brew link --overwrite open-mpi
  4. Launch Rstudio or R and install Rmpi by
    install.packages("Rmpi", type="source")
    Note: To compile Rmpi with the latest version, grab it here and use install.packages(file.choose(), repos = NULL, type = "source")
    Note: You can install R through homebrew as well: brew install R.
  5. Test Rmpi
    library(Rmpi)
    mpi.spawn.Rslaves(nslaves=mpi.universe.size() - 1)
    mpi.parReplicate(100, mean(rnorm(1000000)))
    mpi.close.Rslaves()
    mpi.quit()

    Note
    : Since version 3, OpenMPI puts a limit on the max number of slaves to be spawned. It depends on the number of physical cores, not HT cores. So if you have 4 physical cores, only 3 slaves are allowed to be spawned.

To install Rmpi from command line (xterm terminal), please use
    sudo R CMD INSTALL Rmp_xxx.tar.gz
to install.