Files
hdf5/HDF5Examples
Larry Knox 27c4bbe585 Rebase hdf5 2 1 0 from develop (#6242)
* Skip some parallel example tests for small MPIEXEC_MAX_NUMPROCS values (#6224)

* chore: fix grammar (#6227)

* Split static targets into separate optional target [UPDATED] (#6216)

Build-tree exports can't diverge from install-tree exports — the export(EXPORT ...) reads directly from the install export sets. No manual list to keep in sync.

Removed 3 global variables (HDF5_STATIC_LIBRARIES_TO_EXPORT, HDF5_JAVA_LIBRARIES_TO_EXPORT, HDF5_UTILS_TO_EXPORT) and their ~21 set_global_variable calls across tool/utility files.

Fixed the static-only build bug in the PR where the base export set was guarded by BUILD_SHARED_LIBS, breaking tools export.

Removed redundant utils in export files — the PR was dumping tools into all three build-tree export files (java, static, shared). Now they correctly appear only in the base export.

* Apply filters to variable-length data (#6178)

Closes can_apply and set_local filter callbacks skipped for H5T_VARIABLE dtypes #5942. A more detailed explanation of the rationale for this PR is in the linked issue.

Mandatory filters can be now applied to variable-length data. This notably includes h5py object strings and NpyStrings.

Optional filters applied to variable-length data no longer skip can_apply and set_local, only to jump directly to filter. This fixes hdf5_blosc and HDF5_Blosc2, which rely on set_local. Note that all filters which have neither can_apply nor set_local have always worked fine with vlen data, as long as they were tagged as optional. Notable examples are deflate, lzf, bzip2 (from hdf5plugin), and lz4 (also from hdf5plugin).

Lossy filters, such as scale-offset, are and remain untested and most likely broken, as I expect them to treat the vlen metadata as numbers and corrupt it. The right place to ensure proper behaviour is their can_apply function, which however is broken (filters: can_apply does nothing for optional filters #6161).
2026-02-25 15:53:11 -06:00
..
2026-02-25 15:53:11 -06:00
2026-01-21 23:02:49 -06:00

HDF5 Examples

Please refer to the Using_CMake.txt file for CMake instructions.

Note that this HDF5Examples directory structure is also provided as a stand-alone project distributed with library binaries as well as compiled and tested during a HDF5 Library build.

This repository contains a high-performance library's example code that demonstrate the HDF5® data model API. The HDF5® data model has been adopted across many industries and this implementation has become a de facto data management standard in science, engineering, and research communities worldwide.

The HDF Group is the developer, maintainer, and steward of HDF5 software. Find more information about The HDF Group, the HDF5 Community, and other HDF5 software projects, tools, and services at The HDF Group's website.

We suggest using the presets method with CMake for building the examples. However, if you prefer to use the h5cc pkg-config wrappers, you can use the following commands to build the examples:

export HDF5_HOME="hdf5 installation root"
export PKG_CONFIG_PATH="$HDF5_HOME/lib/pkgconfig"
export LD_LIBRARY_PATH="$HDF5_HOME/lib:$LD_LIBRARY_PATH"
export PATH="$HDF5_HOME/bin:$PATH"

Then, you can compile the examples with:

h5cc -o example1 example1.c
h5c++ -o example2 example2.cpp
h5fc -o example3 example3.f90

For Java examples with Maven integration, see the JAVA/README-MAVEN.md file for complete instructions on using the org.hdfgroup:hdf5-java-examples Maven artifact.

The test-pc.sh script can test the examples with the h5*cc pkg-config wrappers with: cd <path to examples> export HDF5_HOME="hdf5 installation root"; sh ./test-pc.sh <path to examples> <path to build dir> . Notice that period (.) at the end of the command is important, it tells the script to use the current directory as the source directory.

HELP AND SUPPORT

Information regarding Help Desk and Support services is available at

https://help.hdfgroup.org

FORUM and NEWS

The HDF Forum is provided for public announcements and discussions of interest to the general HDF5 Community.

These forums are provided as an open and public service for searching and reading. Posting requires completing a simple registration and allows one to join in the conversation. Please read the instructions pertaining to the Forum's use and configuration.

HDF5 SNAPSHOTS, PREVIOUS RELEASES AND SOURCE CODE

Full Documentation and Programming Resources for this HDF5 can be found at

https://support.hdfgroup.org/documentation/index.html

Periodically development code snapshots are provided at the following URL:

https://github.com/HDFGroup/hdf5/releases/tag/snapshot

Source packages for current and previous releases are located at:

Latest HDF5 release Previous releases

Development code is available at our Github location:

https://github.com/HDFGroup/hdf5.git