Skip to content

Instantly share code, notes, and snippets.

@kentwait
Last active June 11, 2021 14:25
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kentwait/280aa20e9d8f2c8737b2bec4a49b7c92 to your computer and use it in GitHub Desktop.
Save kentwait/280aa20e9d8f2c8737b2bec4a49b7c92 to your computer and use it in GitHub Desktop.
Install HDF5 and h5py supporting MPI (Parallel HDF5)

How to install HDF5 and h5py supporting MPI on OS X

Works on Mac OS 10.11.6, HDF5 1.8.17

HDF5

  1. Download and install dependencies like zlib, openmpi. Use homebrew.
  2. Download source tarball from http://www.hdfgroup.org/HDF5/release/obtain5.html
  3. Configure Makefile using the following command:
$ CC=/usr/local/bin/mpicc ./configure --with-zlib=/usr/local/opt --disable-fortran --prefix=/usr/local/ --enable-shared --enable-parallel

This will configure a shared library HDF5 installation that uses MPI. Note that if homebrew was used to install zlib, remember to supply the proper path pointing to the zlib library. 3. Compile and install HDF5.

$ make
$ make check
$ sudo make install
  1. Check HDF5 installation using h5pcc --showconfig on the command line.

h5py

  1. Download and install numpy. Use pip or conda.
  2. Declare environmental variables used by h5py
$ export CC=mpicc
$ export HDF5_MPI="ON"
  1. Configure using setup.py and install.
$ python setup.py configure --mpi
$ python setup.py install
  1. Check the installation using the demo code on this page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment