OpenMPI already installed in OS X?

Solution 1:

Neither mpicc nor mpirun are installed on a stock Mountain Lion system nor present with Xcode v5 or lower.

The homebrew packaging system has a trivially simple install (v2.0.1):

brew install open-mpi 

You could also build your OpenMPI from code:

  • https://sites.google.com/site/dwhipp/tutorials/installing-open-mpi-on-mac-os-x

It appears from this article, that Lion dropped the inclusion of a build of OpenMPI - but I'd go with the instructions above rather than the MacPorts version if you don't already use MacPorts.

Solution 2:

Make sure gcc and g++ are at least version 5.0 (eg. brew install gcc5 --with-fortran --without-multilib)

Download the openmpi tar.gz file here: http://www.open-mpi.org/

cd ~/Downloads
tar zxvf openmpi...tar.gz
cd openmpi....
./configure --prefix=/usr/local/openmpi
make
sudo make install (enter password)

Now add

export MPI_DIR=/usr/local/openmpi
export PATH=/usr/local/openmpi/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/openmpi/lib:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH

To the bottom of ~/.bash_profile