HDF5 is a general purpose library and file format for storing scientific data. HDF5 can store two primary objects: datasets and groups. A dataset is essentially a multidimensional array of data elements, and a group is a structure for organizing objects in an HDF5 file. Using these two basic objects, one can create and store almost any kind of scientific data structure, such as images, arrays of vectors, and structured and unstructured grids.

Availability & Restrictions

HDF5 is available without restriction to all OSC users.

Different versions of HDF5 are available on the various OSC clusters.

Version Glenn Oakley Ruby
1.6.4 X    
1.6.5 X*    
1.8.7 X    
1.8.8   X  
1.8.12     X*
1.8.13   X*


* - Default version



To use the HDF5 library, first run the following command:

module load hdf5


module load hdf5-serial

Building With HDF5

The HDF5 library provides the following variables for use at build time:

Variable Use
$HDF5_C_INCLUDE Use during your compilation step for C programs
$HDF5_CPP_INCLUDE Use during your compilation step for C++ programs (serial version only)
$HDF5_F90_INCLUDE Use during your compilation step for FORTRAN programs
$HDF5_C_LIBS Use during your linking step programs
$HDF5_F90_LIBS Use during your linking step for FORTRAN programs

For example, to build the code myprog.c or myprog.f90 with the hdf5 library you would use:

icc -c $HDF5_C_INCLUDE myprog.c
icc -o myprog myprog.o $HDF5_C_LIBS
ifort -c $HDF5_F90_INCLUDE myprog.f90
ifort -o myprog myprog.o $HDF5_F90_LIBS

Batch Usage

You must load the hdf5 module in your batch script before executing a program which is built with the hdf5 library

#PBS -N AppNameJob
#PBS -l nodes=1:ppn=12

module load hdf5
cp foo.dat $TMPDIR


cp foo_out.h5 $PBS_O_WORKDIR

Further Reading

See Also

  • netcdf software page