Build netcdf4 with hdf5 support


I am trying to install netcdf4 on my PC which has Ubuntu 16.04 as the OS. I am using gcc and gfortran as the C and fortran compiler. I started off installing zlib compression library(version 1.2.11) with shared library as follows:
CFLAGS=-fPIC ./configure --prefix=/${NCDIR}
make -j 4
make install

Then I installed mpi for parallel IO support for netcdf:
./configure --prefix=${NCDIR} --enable-shared
make install

Then I tried to install hdf5 as it is required for netCDF-4:
CC=${NCDIR}/bin/mpicc ./configure --enable-parallel --prefix=${NCDIR} --with-zlib=${NCDIR} CFLAGS=-fPIC
make -j 8
make check
The make check fails with the following error:
make[4]: Entering directory ‘/home/kcube/CDO2/hdf5-1.10.4/testpar’

Testing t_mpi

t_mpi Test Log

time: cannot run mpiexec: No such file or directory
Command exited with non-zero status 127
0.00user 0.00system 0:00.00elapsed ?%CPU (0avgtext+0avgdata 1168maxresident)k
0inputs+0outputs (0major+27minor)pagefaults 0swaps
Makefile:1436: recipe for target ‘t_mpi.chkexe_’ failed
make[4]: *** [t_mpi.chkexe_] Error 1
make[4]: Leaving directory ‘/home/kcube/CDO2/hdf5-1.10.4/testpar’
Makefile:1545: recipe for target ‘build-check-p’ failed
make[3]: *** [build-check-p] Error 1
make[3]: Leaving directory ‘/home/kcube/CDO2/hdf5-1.10.4/testpar’
Makefile:1416: recipe for target ‘test’ failed
make[2]: *** [test] Error 2
make[2]: Leaving directory ‘/home/kcube/CDO2/hdf5-1.10.4/testpar’
Makefile:1217: recipe for target ‘check-am’ failed
make[1]: *** [check-am] Error 2
make[1]: Leaving directory ‘/home/kcube/CDO2/hdf5-1.10.4/testpar’
Makefile:654: recipe for target ‘check-recursive’ failed
make: *** [check-recursive] Error 1

It seems to be issue related to parallel IO but don’t know how to fix it.


The prerequisite for parallel HDF5 is indeed parallel IO. ROMIO/ADIO is an abstraction layer to help reduce parallel request and is supported with MPI capable libraries. OpenMPI and MPITCH are open source libraries furnished with parallel IO. Unfortunately the story doesn’t end here – in order to make this work they must be run on a parallel file system. You can think of a parallel filesystem as RAID 0, distributing strips across attached disk with the add on bonus working across nodes and may be layered on top of local file system such as ext4.
Here is a list for such freely available file systems: BeeGFS, OrangeFS and Lustre FS, sorted in the order of difficulty to install. Keep in mind that having a properly tuned parallel filesystem is non-trivial and your experience may be function of product, OS / kernel and time put into it.
hope it helps,


Thanks for the prompt response. It turns out it was just an issue of specifying the paths to the mpi compiler/linker for C and fortran programs after which the parallel tests were successful. Nevertheless, I understand that implementing parallel IO capabilities on a truly parallel system is going to be one with numerous challenges.