Skip to content

Instantly share code, notes, and snippets.

@robfalck
Last active March 8, 2019 17:45
Show Gist options
  • Save robfalck/92a587b49d73cb24e53a to your computer and use it in GitHub Desktop.
Save robfalck/92a587b49d73cb24e53a to your computer and use it in GitHub Desktop.
How to install OpenMPI, mpi4py, and petsc4py for use with OpenMDAO on OS X with Anaconda
  1. Install OpenMPI

1.a Download OpenMPI: https://www.open-mpi.org/software/ompi/v1.10/

1.b Extract and configure

  cd ~/Downloads/openmpi-1.10.0
  mkdir build
  cd build
  # I prefer to keep /usr/local clean, so I put it in /opt/openmpi
  ../configure --prefix=/opt/openmpi --with-devel-headers --enable-binaries
  make
  sudo make install

1.c Add the following to your bash profile

  export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/opt/openmpi/lib
  export PATH=${PATH}:/opt/openmpi/bin      
  1. Install mpi4py
git clone https://github.com/mpi4py/mpi4py.git ./mpi4py.git
cd mpi4py.git
python setup.py build --mpicc=/opt/openmpi/bin/mpicc  
python setup.py install
  1. Petsc and petsc4py
git clone https://bitbucket.org/petsc/petsc.git ./petsc.git
cd petsc.git
python setup.py build
python setup.py install
cd ..
git clone https://bitbucket.org/petsc/petsc4py.git ./petsc4py.git
cd petsc4py.git
python setup.py build
python setup.py install
@hwangjt
Copy link

hwangjt commented Sep 20, 2016

The 'Install mpi4py' step is likely missing an install step:
python setup.py install
or:
python setup.py install --user

@robfalck
Copy link
Author

Thanks for catching that, updated.

@hschilling
Copy link

Can we make a note in this to not get the latest petsc ? OpenMDAO doesn't work with the latest. 3.9 works but 3.10 does not. SO need to do git checkout v3.9.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment