Docs · I/O adapters
The CLIO HDF5 file driver.
clio_vfd is an HDF5 virtual file driver: a drop-in replacement for HDF5's default sec2 driver that writes every byte through to the native file and can also keep a copy of byte ranges in the CLIO tier. It works below the HDF5 library, so it sees every datatype and all of HDF5's metadata I/O, but only as byte ranges.
- Driver
- clio_vfd (value 3200)
- Library
- libclio_vfd.so
- Build
- CLIO_CTE_ENABLE_VFD=ON, HDF5 1.14+
- Select
- HDF5_DRIVER=clio_vfd
- Install
- Source builds: Spack (+vfd) or CMake
What it does
HDF5 turns every dataset and metadata operation into reads and writes of byte ranges at file offsets, and hands them to a file driver. clio_vfd performs each one on an ordinary file, synchronously, exactly where sec2 would: after a successful H5Fclose the file is a complete native HDF5 file, and h5dump, h5ls or h5repack read it with or without CLIO. The driver adds no driver-info message to the file.
On top of that it has an optional read tier in the CTE, off by default and experimental. With it on, written and read ranges are copied into the tier, and later reads of those ranges can be served from it. Without it, the driver is a write-through sec2 replacement: writes do not populate the tier at all, because nothing could ever read them back.
Choose the VFD over the VOL connector when the VOL cannot help: datatypes it passes through (compound, variable-length) or workloads dominated by HDF5's own metadata I/O.
1. Build it
$ cmake -S . -B build -DCLIO_CTE_ENABLE_VFD=ON \
-DHDF5_ROOT=/path/to/the/hdf5/your/application/uses
$ cmake --build build -j"$(nproc)"
$ ls build/bin/libclio_vfd.soHDF5 1.14 or newer is required; configure fails without it. The driver does not need ELF support. Link the same libhdf5 as the application (ldd build/bin/libclio_vfd.so | grep hdf5). It is only available from a source build, with Spack (+vfd, on by default) or CMake; see Install.
2. Select the driver
By environment, with no source changes
$ export HDF5_PLUGIN_PATH=$PWD/build/bin
$ export HDF5_DRIVER=clio_vfd
$ ./my_hdf5_appConfigure it with HDF5_DRIVER_CONFIG, using the same key=value;key=value grammar as the VOL connector. An unknown key or a value that does not parse fails the open rather than being ignored.
$ export HDF5_DRIVER_CONFIG="cache=0;fsync=1;sieve=131072"cache=0|1- Default on.
0makes the driver native-only: no CTE traffic and no runtime needed. fsync=0|1- Default off.
1makesH5FflushandH5Fclosefsyncthe native file and fail if that fails. sieve=<bytes>- Default 65536, accepted from 0 to 1 GiB. The window in which consecutive vector-I/O elements are coalesced into one I/O;
0handles them one at a time. It only matters withCLIO_VFD_VECTOR_IO=1, because the driver does not advertise vector I/O by default (doing so switches HDF5 to selection I/O and defeats its own sieve buffer).
In code
Include H5FDclio.h (installed to include/adapter/vfd/), link libclio_vfd.so, and set the driver on a file-access property list:
#include <hdf5.h>
#include "H5FDclio.h"
hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_fapl_clio(fapl, /*cache_enabled=*/1);
hid_t file = H5Fcreate("/scratch/run1/data.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl);H5Pget_fapl_clio(fapl, &cache_enabled) reads the setting back. CLIO_VFD_CACHE=0 in the environment can switch the cache off over an explicit H5Pset_fapl_clio(fapl, 1), but never on over an explicit 0.
3. Use plain file names
Pass ordinary filesystem paths such as /scratch/run1/data.h5. A name containing clio:: is refused with an error: the driver is selected by HDF5_DRIVER or H5Pset_fapl_clio, never by the file name, so an application gains CLIO without having any of its paths rewritten.
4. Turn on the read tier (experimental)
The read tier needs a running runtime and is kept in the CLIO filesystem module, so use a configuration that composes both a CTE pool named clio_cte_core and a clio_cte_filesystem pool. Then:
$ export CLIO_SERVER_CONF=$HOME/clio-hdf5.yaml
$ build/bin/clio-run start &
$ export HDF5_PLUGIN_PATH=$PWD/build/bin HDF5_DRIVER=clio_vfd
$ export CLIO_VFD_READ_TIER=1 CLIO_REQUIRE_RUNTIME=1
$ ./my_hdf5_appWith the read tier on, each cached copy is guarded by a coherence stamp, as in the VOL connector: a file changed between sessions no longer matches its stamp, and its cached copy is dropped. CLIO_STAMP_GRANULARITY_NS and CLIO_STAMP_SETTLE_MAX_NS apply to the VFD too; see the configuration reference.
Runtime behavior
- One attach per process. The driver attaches to the runtime on the first open that wants the cache and remembers the result. With
cache=0it never attaches. - Runtime absent. The open succeeds native-only with a warning, after the client's attach timeout. Set
CLIO_VFD_CACHE=0(orCLIO_WAIT_SERVER=0) when you expect no runtime, orCLIO_REQUIRE_RUNTIME=1to make it an error instead. - Runtime misconfigured. A
CLIO_SERVER_CONFthat names a missing or unparseable file aborts the process inside the runtime client. A missing runtime is survivable; a broken configuration is not. - Late runtime. A runtime started after the first open is not picked up for the life of the process.
Durability
- Writes are committed to the native file before the call returns, and a failing
closefailsH5Fclose. Any driver failure either falls back to the native path or returns a real HDF5 error. - By default, like
sec2, neitherH5FflushnorH5Fclosewaits for stable storage.fsync=1inHDF5_DRIVER_CONFIG, orCLIO_VFD_FSYNC=1for every file in the process, turns both into durability barriers, at the cost of anfsyncper file.
Diagnostics
CLIO_VFD_TRACE=<dir>- Access telemetry at byte level: a
.access.jsonlfile per HDF5 file and a.access.jsonsummary at close, with the request-size histogram, repeated ranges, metadata versus raw-data split, read/write mix and access locality. CLIO_VFD_DEBUG=1- Print every read and write (address and size) to stderr.
CLIO_VFD_MAX_IO_BYTES- Largest single
pread/pwrite, default 1 GiB; larger transfers are split.
Limits
- The driver is serial: it advertises no MPI support. Parallel HDF5 codes should use the VOL connector.
- It cannot tell hot data from metadata, and HDF5's tiny metadata writes become many requests when the read tier is on.
- The read tier is experimental and off by default.
Where to go next
- HDF5 VOL connector: dataset-level caching, on by default.
- Configuration reference.
- HDF5 connector design.