Skip to content

Archive: per-rank files (layouts B and C) and check_archive, landed on main (C1.4, C7.1 decision 1) - #176

Merged
cekees merged 1 commit into
devfrom
archive-modes-land
Nov 4, 2026
Merged

cekees merged 1 commit into
devfrom
archive-modes-land

Conversation

@cekees

@cekees cekees commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Lands archive-modes 3ea0c1f0 (the second pass on #98) on current main, as decision 1 of the ymf mesh plan (C7.1) asks: per-rank h5 files, layouts B and C, check_archive. No redesign; nothing else in the Archiver changes.

  • driver="per-rank": every rank writes <name>_p<rank>.h5 with plain HDF5, no communication; turns global_sync off and says so.
  • document="global" (layout B): one <name>.ymf, each instant a spatial collection of the ranks' grids, each referencing its rank's file; readArchiveDomain rebuilds it from _p0.h5.
  • document="per-rank" (layout C): one <name>_p<rank>.ymf per rank, single grids, appended by each rank on its own.
  • pro run / parun / RunOptions: --archive-mode, --archive-driver, --archive-document.
  • check_archive: one integrity check over every layout x 1-3 ranks.

Port to current main (two conflicts, both from work merged since 10-24): the metadata writer's row count now feeds _dataset (the hot-start reuse/replace helper) instead of create-or-open; the new tests read collections through archive_collections because the archive is format 2 (time outside, space inside).

check (macOS arm64, MPICH, FI_PROVIDER=tcp, ymf main d466645) before after
test_archive_parallel_metadata.py (rank script at 1, 2, 3 ranks) 66 passed 87 passed
archive / hotstart / test_pro_cli / read-path tests 292 passed, 1 skipped
parun -n 2 ladr_2d, per-rank driver, document=global n/a 11 steps x 2 grids, 154/154 data items resolve, rebuilt from _p0.h5
parun -n 2 ladr_2d, per-rank driver, document=per-rank n/a 2 documents, 11 steps x 1 grid, 77/77 data items resolve each

Unblocks C7.1 steps H (per-rank mesh view) and I (canonical-order write), and C40.

🤖 Generated with Claude Code

…options in pro run; every layout checked

driver="per-rank" has every rank write its own <name>_p<rank>.h5 with
plain HDF5 and no communication; per-rank files hold per-rank datasets,
so it turns global_sync off and says so. document= chooses where the
grids are described: "global", one <name>.ymf whose every step is a
spatial collection of the ranks' grids, each referencing its rank's
file, built by master from the gathered grids and rebuilt by
readArchiveDomain from master's file (the roster's layout B); or
"per-rank", one <name>_p<rank>.ymf per rank, each step a single grid,
each rank appending its own with no collective step (layout C). Every
rank's file carries its own metadata rows and attributes, so a per-rank
hot start reads nothing but its own file.

pro run takes --archive-mode, --archive-driver and --archive-document
alongside parun; RunOptions carries them.

check_archive is the one integrity check every layout goes through:
each document validates, each collection has its steps in the expected
shape, every data item names a dataset that exists in the file it says
with the dimensions it declares, the files on disk are the expected
ones, and a per-rank-file global document is rebuilt from master's
file. It runs over the single-file drivers x both dataset layouts x 1-3
ranks and the per-rank driver x both documents x 1-3 ranks, plus the
per-rank hot start and running documents, and the invalid combinations
are refused by name. pro run's options are checked end to end.

Landed on cekees/main 9fca0b9 (decision 1 of the ymf mesh plan, C7.1),
cherry-picked from archive-modes with no redesign. Two conflicts, both
with work merged since the commit was written: the metadata writer now
sizes its dataset through _dataset (the hot-start reuse/replace helper),
so the per-rank row count feeds that helper instead of the old
create-or-open; and the archive is format 2 (time outside, space inside),
so the new tests read collections through archive_collections instead of
domain["time_collections"]. The live document's per-instant records
already branched on uniformSteps, so per-rank documents append single
grids per space.

Measured (macOS arm64, MPICH, FI_PROVIDER=tcp, ymf proteustoolkit main
d466645):
  test_archive_parallel_metadata.py   87 passed (rank script at 1, 2, 3 ranks;
                                     66 before this commit)
  archive/hotstart/pro CLI/read paths 292 passed, 1 skipped
  parun -n 2 ladr_2d (KSP), per-rank driver:
    document=global   ladr_2d.ymf + _p0.h5 + _p1.h5, 11 steps x 2 grids,
                      154/154 data items resolve; rebuilt from _p0.h5
    document=per-rank _p0/_p1.ymf, 11 steps x 1 grid each, 77/77 resolve

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cekees added a commit that referenced this pull request Nov 4, 2026
…back, gauge headers on a hot start

Three defects found by review of proteustoolkit#1335 (main train 2026-11-04), each confirmed against
the code and covered by a test that fails without the fix.

1. EntropyViscosity.reduce_numDiff (from #184). With a uniform entropy, norm_factor is 0 and an
   element with zero entropy residual gave 0/0 = NaN. np.minimum kept the NaN and wrote it into q_numDiff_u,
   so on 2+ ranks the solution went NaN. Serial runs and the kernels use C fmin, which keeps the linear
   viscosity. It now uses np.fmin under errstate, the kernels' rule. test/test_entropy_viscosity_reduce.py:
   uniform entropy gives NaN before, the linear viscosity after.

2. Archiver.readArchiveDomain (from #176). When <name>.h5 was missing it fell back to <name>_p0.h5
   without reading the document layout. With document="per-rank" that file holds only rank 0's subdomain, so
   gatherTimes silently wrote a _complete.ymf covering rank 0 alone. It now raises, naming the per-rank files,
   when the document is per-rank and other ranks' files exist. check_archive in
   test_archive_parallel_metadata.py asserts the error: layout C at 2 and 3 ranks assembled rank 0 alone
   before, and raises after.

3. Gauges.resumeAt (from #184, gauge plan step 2). A hot start kept the old file's header as it
   was, so with moved, added or reordered gauges under the same file name, new rows sat under the old labels.
   The header is now built by headerLine() and compared with the kept one. If they differ, the file starts
   over with this run's header and a log line. Two tests in test_hotstart_history_files.py: same gauges keep
   the rows up to t, other gauges start the file over.

macOS arm64, proteus-bc-261025, FI_PROVIDER=tcp, -mat_partitioning_type current:
  test_entropy_viscosity_reduce.py                  2 passed
  test_hotstart_history_files.py                    6 passed
  test_archive_parallel_metadata.py -k per_rank_file_layout  6 passed
  test_archive_read_paths.py                       21 passed
  test_tadr_partition_independence.py              10 passed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cekees
cekees merged commit e60760d into dev Nov 4, 2026
14 of 16 checks passed
@cekees
cekees deleted the archive-modes-land branch November 4, 2026 13:32
cekees added a commit that referenced this pull request Nov 4, 2026
Conflict: #183 rewrote both readMeshADH on a card parser
(_readADHMeshCards); this branch removes the in-tree SMS/ADH readers.
Kept the removal and dropped the parser. #183's 3DM and ADH tests in
test_importers.py and their fixtures (importers/cube_3x3x3.3dm,
importers/adh/angle_bt.3dm + README + licence) go with the readers;
the same checks run in proteustoolkit/ymf-import-sms against its
converter, on the same files. The IFISS and NURBS tests stay.

After the merge (extensions rebuilt in place): mesh_tests, poisson_2d,
domain_ymf, ci, pro CLI, read_mesh_xml and six multilevel files 656
passed, 1 skipped, 3 xfailed; mpiexec -n 2: test_ymf_mesh_domain,
test_importers and test_2dm pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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