Search code examples
fortranhdf5macportsopenmpi

How do I install HDF5, openMPI .mod files with macports?


I have installed HDF5 and openmpi-mp (also openmpi-devel-mp) on my Mac (Mojave 10.14.4, with latest Xcode and macports) with macports in order to compile a Fortran90 program that needs them. However, compilation fails with errors telling me that mpi.mod or hdf5.mod, which are requested by use statements, are not found. What else do I have to install or do in order to get all these modules? The path doesn't seem to be the issue, as I do see files like hdf5.h in /opt/local/include/, which I have specified as path.


Solution

  • For HDF5 and MPI, you need to have both libraries compiled with a single build environment (same compiler suite for C and Fortran). You need to build MPI first (possibly use the one from macports). Then, build HDF5 referring to the OpenMPI install.

    The build from HDF5 will include the wrapped h5pfc (h5 for HDF5, p for parallel and fc for Fortran compiler). You should use h5pfc -show to see all the flags.