HDF5

From HPC users
Jump to navigationJump to search

The HDF5 package is a software and library to write machine independently large data sets. The main difference to the NetCDF library is that with HDF5 the data can be stored in a hirachical structure and that compression is supported.

Different versions compiled with different compilers are available. A list is given by typing

module avail hdf5

Within the modules the interfaces, header files and libraries for Fortran, C and C++ are available. The libraries are compiled with zlib compression support, but without parallel and szip support.

The intel and gcc versions are compiled with the Intel or the GNU compilers. This distiction is needed for Fortran because the .mod files are incompatible between gfortran' and ifort.


Compilation and Linking

When loading the module for convinience the environment variables HDF5_DIR, HDF5_INCDIR and HDF5_LIBDIR are set to the main, include and library path of HDF5, respectively. The extension of the search path for header/module files is simply done by the compiler option

-I$HDF5_INCDIR

or in a Makefile

-I$(HDF5_INCDIR)

The libraries can be linked by the compiler options

 -L$HDF5_LIBDIR -lhdf5_hl -lhdf5 -lz

When using the C++ or Fortran interface please use

 -L$HDF5_LIBDIR -lhdf5hl_cpp -llibhdf5_cpp -lhdf5_hl -lhdf5 -lz

or

 -L$HDF5_LIBDIR -lhdf5hl_fortran -llibhdf5_fortran -lhdf5_hl -lhdf5 -lz

repectively. If you use a Makefile don't forget the round bracket around the environment variable names (see above).


External links