Skip to content

vargalabs/h5cpp

Repository files navigation

CI ASan UBSan codecov MIT License DOI GitHub release Documentation Downloads

H5CPP — High-Performance HDF5 for Modern C++

OS / Compiler GCC 13 GCC 14 GCC 15 Clang 17 Clang 18 Clang 19 Clang 20 Apple Clang MSVC
Ubuntu 22.04 gcc13 NA NA cl17 cl18 cl19 cl20 NA NA
Ubuntu 24.04 gcc13 gcc14 NA NA cl18 cl19 cl20 NA NA
macOS 15 NA NA NA NA NA NA NA ac NA
Windows NA NA NA NA NA NA NA NA msvc

H5CPP is a modern C++ template library for serial and parallel HDF5 I/O. It provides type-safe RAII wrappers, high-level create / read / write / append operations, and seamless interoperability with the native HDF5 C API. Chunked and compressed datasets, extendable packet-table streams, hyperslab selection, custom datatypes, and MPI parallel I/O are all supported. HDF5 files written by H5CPP are readable from Python, R, MATLAB, Fortran, Julia, and any other HDF5-capable environment.

Quick Start

#include <h5cpp/all>
#include <vector>

int main() {
    auto fd = h5::create("example.h5", H5F_ACC_TRUNC);

    std::vector<float> data = {1.f, 2.f, 3.f, 4.f, 5.f};
    h5::write(fd, "sensor/readings", data);

    auto result = h5::read<std::vector<float>>(fd, "sensor/readings");
    // result == {1.f, 2.f, 3.f, 4.f, 5.f}
}
find_package(HDF5 REQUIRED)
find_package(h5cpp REQUIRED)
target_link_libraries(my_app PRIVATE h5cpp::h5cpp)

Requirements

Requirement Minimum Tested ceiling
C++ standard C++17 C++23
HDF5 1.10.x 1.12.2
CMake 3.22

C++20 upgrades the I/O pipeline to lock-free queues and enables h5::view<T> streaming ranges. C++23 adds std::float16_t dataset support.

Installation

From GitHub Releases — pre-built packages for each tagged release:

Platform Package
Ubuntu / Debian (amd64, arm64) .deb via Releases
RHEL / Fedora (x86_64, aarch64) .rpm via Releases
macOS 15 arm64 .pkg via Releases
Windows x64 NSIS .exe via Releases

From source:

git clone https://github.com/vargalabs/h5cpp.git
cmake -B build -DCMAKE_BUILD_TYPE=Release -DH5CPP_BUILD_TESTS=OFF
cmake --install build

Supported Types

Category Types
Numeric bool, int8_tint64_t, uint8_tuint64_t, float, double, long double, std::complex<T>, std::float16_t (C++23)
Strings std::string, char[], variable-length HDF5 strings
STL sequences std::vector, std::valarray, std::array, std::deque
STL node-based std::list, std::forward_list, std::set, std::multiset, std::unordered_set, std::unordered_multiset
Linear algebra Armadillo, Eigen, Blaze, Blitz++, Boost uBLAS, IT++, dlib
Structs POD / C / C++ structs via h5cpp-compiler
Arrays Up to rank 7

v1.12 Highlights

  • std::valarray<T> read/write support
  • Iterator containersstd::list, std::deque, std::set, std::unordered_set and their multi- variants
  • std::complex<T> datasets
  • std::float16_t (C++23 IEEE 754 half-precision)
  • Rank-7 array support
  • Expanded attribute type coverage
  • Threaded I/O pipeline for filter chains
  • HDF5 1.12.2 ceiling — tested and verified; H5Dvlen_reclaim / reference API compatibility
  • Windows MSVC in the CI matrix
  • ASan + UBSan clean on Clang 20

Documentation

Full API reference, examples, and architecture notes: vargalabs.github.io/h5cpp

Contributing

See CONTRIBUTING.md for issue naming, branch conventions, commit format, and the pull request workflow.

License

MIT — see LICENSE.