About Examples#

You find examples for most implemented features on the project github page, or when installed from package manager in /usr/local/share/h5cpp. Only a cmake, a C++17 compatible tool-chain and the HDF5 libraries are required to run them. The examples not only cmake but traditional make files as well.


Demonstrates how to create and manipulate HDF5 containers within H5CPP read on HDF5 container here.


Datasets within HDF5 containers similarly to other file-systems are addressed by a tree like data structure, each node in the path is called a group these examples help you how to manipulate the groups, including adding attributes. You can read on groups here.


This example guides you how to create HDF5 datasets, and control its properties. You can read on datasets here.


Objects may have additional information attached to them, called attributes, currently only datasets h5::ds_t are supported, but at some point this will be extended to h5::gr_t and h5::dt_t as well. Since the attributes are saved in the metadata section in the HDF5 container the space is limited. You can read on attributes here.


Sparse matrices are ubiquitous in engineering, for low fill rate matrices various storage formats are explored read on sparse matrices here.


Demonstrates data descriptors, their properties and how to work with them.


is a comparison between C API and H5CPP persisting a compound datatype. While the example uses the h5cpp compiler, the generated.hpp header file is provided. Written by Gerd Heber, The HDFGroup


is another example for persisting Plain Old Data (POD) Struct types, with a more complex struct to show that the compiler indeed works, with arbitrary embedding and the quality of generated header file.


has all the linear algebra related examples for various systems. IF you are a data-scientist/engineer working with massive HDF5 datasets, probably this is where you want to start.


Message Passing Interface (MPI) is de facto standard on HPC clusters and supercomputers. This example demonstrates how to persist data to parallel file system with collective and independent IO requests. This section is for people who intend to write code for MPI based systems.

multi translation unit - h5cpp compiler#

Projects are rarely small, breaking it into different translation units is a natural way of handling complexity for compiled systems. This example shows you how to set up your makefile and write the program file so it works with h5cpp source code transformation tool.

packet table#

Streams of packets from sensor networks, stock exchange, ... need high performance event processor. This example shows you how simple it is to persists a stream of various shaped packets into HDF5 dataset. Supported objects are:

Packetable also known to work with matrices, vectors, etc...

raw memory#

shows you how to save data from memory location, as well as provides examples for filtering algorithms such as h5::fletcher32 | h5::shuffle | h5::nbit | h5::gzip{9} and setting fill value with h5::fill_value<short>{42}


a brief example on how to save a set of strings with h5::utf8 encoding


simple example how to transform/change data within the data transfer buffer of the HDF5 C library. This feature is to change the data set transparently before loading, or saving.

google test#

Integrity tests are with google-test framework and placed under test/ directory