Write files HDF5 1.8 can read: FileWriter/FileBuilder::libver_bounds
New `LibVer` (V18, V110, V112, V114, V200, Latest) and
`libver_bounds(low, high)` on the format crate's `FileWriter` and the
facade's `FileBuilder`, as libhdf5's H5Pset_libver_bounds / h5py's
libver=(low, high). The default stays (V110, Latest), byte for byte what
was written before.
With a low bound of 1.8: superblock version 2, layout message version 3
(contiguous, compact, chunked) and a version-1 B-tree chunk index for
every chunked dataset, resizable ones included -- what libhdf5 2.x writes
under libver=('v108', 'latest'). The new chunk B-tree writer
(btree_v1_write.rs) replays H5B_insert with the H5Dbtree.c callbacks for
row-major insertion (split ratios 0.1/0.5/0.9, right keys moved as
H5D__btree_cmp3 moves them, root kept in place): its trees equal
libhdf5's node for node for 1-D/2-D/3-D, 2- and 3-level, filtered and
unfiltered datasets (libhdf5 writing without a chunk cache).
The high bound refuses, with FormatError::LibverBound before anything is
written, what needs a newer format: virtual datasets and the paged
file-space strategy (1.10), the 1.12 reference types (datatype v4),
native complex (datatype v5, HDF5 2.0), and a low bound above the high.
Tests: tools/tests/libver_v18.rs writes every writer feature under
(V18, V18), and HDF5 1.8.23's h5dump (scripts/build-hdf5-1.8.sh; skipped
when absent) dumps it exactly as h5dump 1.14 does and returns our bytes
for every numeric dataset; h5py, clawhdf5 and h5rs check --data agree;
then FileEditor grows/appends/annotates it and h5py appends, and every
reader checks again. read_harness gains --v18 and --chunk N.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build libhdf5 1.8.23 (the last 1.8 release) with its command-line tools, as
|
||||
# the oracle for files written with `LibVer::V18` (the `libver_v18` test in
|
||||
# clawhdf5-tools finds h5dump through CLAWHDF5_H5DUMP18 or this default prefix).
|
||||
#
|
||||
# bash scripts/build-hdf5-1.8.sh [PREFIX]
|
||||
#
|
||||
# PREFIX defaults to ~/.cache/hdf5-1.8.23; sources go to PREFIX-src and the
|
||||
# build tree to PREFIX-build. Reuses an existing install. Needs git, cmake, a C
|
||||
# compiler and zlib headers.
|
||||
set -euo pipefail
|
||||
PREFIX="${1:-$HOME/.cache/hdf5-1.8.23}"
|
||||
SRC="$PREFIX-src"
|
||||
BUILD="$PREFIX-build"
|
||||
if [ -x "$PREFIX/bin/h5dump" ]; then
|
||||
echo "reusing $PREFIX/bin/h5dump"
|
||||
"$PREFIX/bin/h5dump" --version
|
||||
exit 0
|
||||
fi
|
||||
if [ ! -d "$SRC" ]; then
|
||||
git clone --depth 1 --branch hdf5-1_8_23 https://github.com/HDFGroup/hdf5.git "$SRC"
|
||||
fi
|
||||
# 1.8 predates current compilers (GCC 14 turns its pointer-type mismatches in
|
||||
# the tools into errors): pin gnu99 and demote those errors to warnings.
|
||||
CFLAGS18="-w -std=gnu99 -Wno-error=incompatible-pointer-types"
|
||||
CFLAGS18="$CFLAGS18 -Wno-error=implicit-function-declaration -Wno-error=int-conversion"
|
||||
cmake -S "$SRC" -B "$BUILD" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS18" \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DBUILD_TESTING=OFF \
|
||||
-DHDF5_BUILD_TOOLS=ON \
|
||||
-DHDF5_BUILD_EXAMPLES=OFF \
|
||||
-DHDF5_BUILD_CPP_LIB=OFF \
|
||||
-DHDF5_BUILD_FORTRAN=OFF \
|
||||
-DHDF5_BUILD_HL_LIB=OFF \
|
||||
-DHDF5_BUILD_JAVA=OFF \
|
||||
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
|
||||
-DHDF5_ENABLE_SZIP_SUPPORT=OFF
|
||||
cmake --build "$BUILD" -j "${JOBS:-6}"
|
||||
cmake --install "$BUILD"
|
||||
"$PREFIX/bin/h5dump" --version
|
||||
Reference in New Issue
Block a user