By Categories    By Tags

Installing open-mpi on Mac

October 24 2013

This is a guide for installing open-mpi and Rmpi on Mac OSX.
Open-mpi is open source mpi library such allows scalable and parallel processing. To install open-mpi, you will need to install Homebrew first. Then install gfortran and open-mpi

brew install gfortran
brew install open-mpi

You will need a C complier. For OSX 10.9, see Configuring complier for R 3.0.1 on OSX 10.9 Mavericks. For previous OS, the default llvm-gcc complier should work fine most of the time.

Final step, either open R in terminal or R GUI, and run

install.packages("Rmpi", type="source")

This should install Rmpi.

To test Rmpi

mpi.iparReplicate(100, mean(rnorm(1000000)))

Note: If you compile your own R, or install R via Homebrew or macport, it is more likely that Rmpi will fail to detect number of cores via mpi.universe.size(). In this case, you may need to specify the number of salves.

mpi.iparReplicate(100, mean(rnorm(1000000)))

Configuring complier for R 3.0.x on OSX 10.9 Mavericks

October 23 2013

Warning [2014-2-12]: Most packages are now compatible with libc++, changing to libstdc++ may cause problems for some packages.

On 10.9, the default complier is clang with libc++ library. Many old c++ files may not be compatible with it. Hence some R packages cannot be complied from source. There are 2 solutions.

1. change the complier to GNU gcc complier.
2. an easier solution, but it doesn't work for all packages

1. GNC gcc complier

First of all, install Homebrew, then install gcc47 and gfortran.

brew install gcc47
brew install gfortran

Then edit ~/.R/Makevars


2. An easier solution

Edit ~/.R/Makevars and add


But it doesn’t fix all problems.

###Test if it works<

You should be able to compile R packages from source now. If the package is installed, it means that you have already changed your complier. As clang with libc++ fails to compile this package.

install.packages("SuppDists", type="source")

Happy R coding~

Latex Testing

October 1 2012


$\alpha_3 + \beta_1^2 = 1$