Micro and Nano Mechanics Group
Revision as of 21:16, 3 February 2009 by Correaa (Talk)

Contents

HDF5 Library*

HDF5 is a library for managing large numerical data sets. It is appropriate for saving and retrieving data to/from structured large files. It also supports parallel access to files in HDF5 format, in particular within the MPI environment. HDF5 library can be used from C, C++ and Fortran. Files can be saved optionally in text format, binary and compressed format (if zlib is available).

HDF5 is recommended by the developers of FFTW http://www.fftw.org/fftw3.3alpha_doc/Simple-MPI-example.html as a means to output and synchronize data from different processes.

Some popular numerical packages, like MATLAB, Mathematica, Octave and ROOT, already have native support for the HDF5 format. If you want to quickly experiment with HDF5 files, you can use those programs to see how it works.

For example, in Mathematica

 m = RandomInteger[255, {5, 5}]
 Export[ "matrix.h5", m]
 mLoad = Import["matrix.h5", {"Datasets", "/Dataset1"}]

will create a binary file called "matrix.h5" with the matrix data.

Install

As of HDF5 version 1.9 there is no way to use the MPI version and the C++ interfaces together.

Ubuntu

HDF5 1.6.6 can be installed directly in Ubuntu 8.10 be doing:

 sudo apt-get install libhdf5-serial-dev

This will install the C, C++ and Fortran versions of the library and development (header) files, but it will not include the MPI version.

The MPI version, (which will remove the previous serial version) can be installed by:

 sudo apt-get install libhdf5-mpich-dev

where 'mpich' can be replaced by 'openmpi' or 'lam'. Unfortunately then the C++ interface is not provided for this MPI version. Note that the two version are incompatible.

Build and Installation from Sources

We will try to install the parallel version of HDF5 1.8 in our user space:

 mk $HOME/usr

from a download location

 mk $HOME/soft
 cd $HOME/soft
 wget ftp://ftp.hdfgroup.org/HDF5/current/src/hdf5-1.8.2.tar.gz
 tar -zxvf hdf5-1.8.2.tar.gz
 cd hdf5-1.8.2

then we can configure:

 ./configure --prefix=$HOME/usr --enable-parallel

Other options are described in ./configure --help. The opton --enable-cxx can be specified but not together with --enable-parallel.

 export CFLAFS=-I/usr/lib/mpich/include
 ./