Micro and Nano Mechanics Group
(Difference between revisions)
(Install HDF5)
(Build and Installation from Sources)

Revision as of 20:31, 3 February 2009

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.

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

Ubuntu

HDF5 1.6.6 can be installed directly in Ubuntu 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. As of Ubuntu 8.10 and HDF5 1.6.6 there is no way to install the MPI and C++ interfaces together unless you follow the manual installation.

Build and Installation from Sources

We will try to install HDF5 1.9 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.