Skip to content

Compress the merged campaign HDF5 with lzf - #937

Merged
cailmdaley merged 1 commit into
developfrom
perf/merge-hdf5-lzf
Oct 1, 2026
Merged

cailmdaley merged 1 commit into
developfrom
perf/merge-hdf5-lzf

Conversation

@cailmdaley

Copy link
Copy Markdown
Contributor

The campaign merges (final_cat_<run>.hdf5, full_starcat_<run>.hdf5) both go through workflow/scripts/hdf5_reconcile.py, which wrote datasets uncompressed: 952 MB for the 25-tile smk-g11 campaign, roughly 800 GB projected at DR6. This PR makes that one writer create every unit's dataset with compression="lzf" (the module constant COMPRESSION).

Measured on one real tile (smk-g11 181.308, 34,946 rows × 178 columns, 40.8 MB raw; scratch, best of 3):

setting size write read
none (current) 40.8 MB 0.11 s 0.53 s
lzf 20.5 MB 0.25 s 0.31 s
lzf + shuffle 18.4 MB 0.30 s 0.49 s
gzip 1 19.1 MB 0.47 s 0.29 s
gzip 4 18.8 MB 0.57 s 0.42 s

lzf halves the file for a fraction of a second per tile. Shuffle buys another ~10% but slows reads, so it is left off.

Notes

  • Kept datasets move across via h5py's group copy, which preserves their filter, so files stay uniformly compressed across rebuilds; existing uncompressed files become compressed the next time a unit is refreshed (or on a fresh build). Datasets are fixed-size (no maxshape/resizing), so h5py's auto-chunking is used.
  • Readers need h5py. lzf ships with h5py and reads transparently there (sp_validation reads with h5py; nothing in this repo reads these files any other way). Plain libhdf5 tools — h5dump, C/Fortran readers, some non-Python bindings — cannot decode lzf. If collaborators need those, gzip level 1 is the portable alternative at nearly the same size (table above) and ~2× the write time.
  • Test: test_every_dataset_is_compressed_and_round_trips checks compression and exact round-trip through fresh build, add-only append and rewrite. test_hdf5_reconcile_props.py, test_final_cat_merge_invariants.py, test_star_cat_refresh.py: 14 passed.

— Claude on behalf of Cail

🤖 Generated with Claude Code

hdf5_reconcile writes every unit's dataset with compression=COMPRESSION
(lzf), halving final_cat_<run>.hdf5 and full_starcat_<run>.hdf5 at
negligible write cost. A test checks compression and exact round-trip
across fresh build, add-only append and group-copy rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UB6fn7qPHJeEWzMW1pu6vy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant