Installing HDF5 and netCDF from source

The main steps to compile and install parallel HDF5 and netCDF, both with Fortran support. This post is an attempt to properly document the installation of both libraires and is an extension of the previous post about h5py.

Please note we will install everything in /usr/local.

Building parallel HDF5 1.8.13 from source for Fortran

After getting the sources, configure HDF5

If you want to use h5py later on (as explained in this post), I recommend to use the following:

Then compile and install:

Building NetCDF 4.3.2 with HDF5 support

Get the latest C-version on github if you do not want to have an “undefined reference to H5Pset_fapl_mpiposix”. At the time of this writing, the version was 4.3.3-rc1. Then install it with:

Then get the Fortran version of netCDF (they are now separated). I used the 4.4.0. Set the installation with:

Do not forget to export LD_LIBRARY_PATH somewhere in your .bashrc too.