Repository navigation
custom_mg.build agrees on failure: the set-up phase and the per-level loop body (#874) - #1225
Conversation
… loop body (#874) CustomMGHierarchy.build now runs its body (_build_body) inside one agreed_build context (#1218): a rank-local exception on one rank is raised on every rank as the same CollectiveBuildError, a builder failure (which the mesh-owned path retries with the next builder), at the next agreement point or at the build's end. Agreement points: - set-up phase: before each collective (the node coordinates' basis DM, the level layouts, the allreduced node and DOF counts through the agreed wrapper, the move check, the operator check, the FAC kill check) and at the phase's end; - the per-level loop's own body: each level starts at one, and one precedes each collective it makes (the provenance and cell-located transfers, the node-cloud builders, the zero-column counts and their allreduce, the FAC split, the zone's node table, the patch-block gather, the patch allreduce). The transfer builders' insides keep their own guards: the next phase. test_0052: the accepted entry for custom_mg.build is deleted, as the test asks (the guarded collective it was accepted for is now an agreed allreduce). Test: tests/parallel/test_0874_agreed_custom_mg_build_parallel.py, 8 forced failures on the last rank (4 in the set-up phase, 4 in the loop body) and a clean rebuild. Development: 7 hangs and an MPI abort at np 2. Branch: 9 passed at np 2 to 5. Underworld development team with AI support from Claude Code
- _agreed_node_transfer's verdict is now fault_contact._collective_raise (the library's one verdict protocol) instead of an allgather of its own on the solver's communicator, so it pairs with an agreed_build exit or agree() on another rank. The error carries the first failing rank's message, with its rank. - _assemble_node_transfer: agreement points before its allreduce (the agreed wrapper) and before the collective createAIJ. - _gather_coarse_cloud's two allgathers and _count_zero_columns_parallel's allreduce go through the agreed wrappers. Tests: three more forced failures in test_0874_agreed_custom_mg_build_parallel (the builder on one rank; while assembling the rows; between the local CSR and createAIJ). Development: the builder case already passed (#886's verdict), the other two hang or abort at np 2. Branch: 12 passed at np 2 to 5; 108 np-2 and 81 serial neighbours pass. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at 376d815 (phases 1 to 3): changes requested. The conversion behaves correctly, and I found no hang, mis-pairing or change of answer. The one requested change is in test_0052 (finding 1). Deleting the accepted entry for What I measured
Findings
What was run
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
…s accepted with reasons (#874) H1's review of #1225: deleting the accepted entry for build hid the agreement points rather than covering them, since the main scan did not count agree() or the agreed wrappers. is_collective now counts them. The scan then finds 8 under guards in _build_body (7 under `pre is not None`, 1 under `keyed or split is not None`); both guards are the same on every rank, and the restored entry says why for each. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at 7baab75: changes requested. One small change is needed in test_0052. The restored entry is still keyed on the whole function, so it hides any new rank-local guard in
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
…ted self-test (#874) H1's review of #1225: keyed on (path, function), the entry for the 400-line _build_body waved through any guarded agreement point in it. An ACCEPTED / IN_FLIGHT key may now name the guard, (path, function, guard text), and covers that guard only; _build_body's entry is two such keys, `pre is not None` and `keyed or split is not None`, each with its reason. The stale-entry check understands both key forms. A self-test plants a rank-local guard (a local array's size) around an agree() in a _build_body snippet beside the accepted guard: the planted one is flagged, the accepted one is not. The base scan classes `comm.rank == 0` as rank-uniform (it is in UNIFORM_TOKENS), so that guard is not a finding at all; that is a separate gap, noted in the PR. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at d651d32: ready to merge on green from this review. The guard-keyed entries do what was asked. The rank-token gap below predates this PR, so it should go in its own follow-up rather than hold this one. My earlier statement was correct for
1. Medium (predates this PR): the scan treats rank guards as uniform. UNIFORM_TOKENS has listed
Suggested fix:
The rest of UNIFORM_TOKENS looks right: sizes, Checks at d651d32:
Run on cores 80 to 83. Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
The coarse-side loop in custom_mg.build calls the collective fault_mg.as_built_nodes once per level whose coarse side moved with the finest. It now has an agreement point in front, as the fine-side loop has since #1225: a failure on one rank after a coarse-side check is raised on every rank at the next level's agreement point, where it hung the others. - test_0874_agreed_custom_mg_build_parallel: a refined triangle box whose top wall has risen (two fine-side and two coarse-side checks per build, probed serially); the failure is forced on the last rank at the first coarse-side check, and must be the same CollectiveBuildError on every rank with the agreement calls paired. - test_1240: the iteration count is 4 serially and 5 at np 2 and 3 (measured by the reviewer); above np 3 it is bounded by 5. - _plex_topology: inherited_vertices is collective on the DM's communicator (it creates a DMPlexTransform there); the module docstring said every function was rank-local. Underworld development team with AI support from Claude Code
The always-on np 3 and np 4 runs took 3.4 minutes on shard 6, not the 20 estimated for them: on #1225's shard 4 the np 2 batches were 26.5 of the 68.6 minutes. Sharded, the batches of tests/parallel/test_*.py now alternate: even-numbered on shard 4, odd on shard 6. The batch boundaries are the unsharded ones, and an unsharded run still runs every batch. The comments that carried the 20-minute figure are corrected. Underworld development team with AI support from Claude Code
Addresses #874:
custom_mg.build, phases 1 to 3, on the mechanism of #1218. Review: H1 (review and parallel test runs on a 96-thread Linux workstation); W1 (the session that owns the convergence and integration work, andcustom_mg) for the design.What changes
CustomMGHierarchy.buildnow runs its body (_build_body, unchanged apart from the agreement points) inside oneagreed_build("custom_mg.build")context. A rank-local exception on one rank is raised on every rank as the sameCollectiveBuildError, at the next agreement point or at the build's end.build_transfers) retries with the RBF builder before degrading.set_custom_fmgregistration surfaces it, as before.Phase 1: set-up. There is an agreement point before each collective, and one at the phase's end. The collectives are:
_get_coords_for_basisbuilds a basis DM);allreducewrapper;as_built_nodes);Phase 2: the per-level loop's own body. Each level starts at an agreement point, and there is one before each collective the body makes:
Phase 3: the node-cloud builders' insides.
_agreed_node_transfer: its verdict is nowfault_contact._collective_raise, the library's one verdict protocol (agreed_build: collectives that agree on failure, proved on the FAC patch split (#874) #1218), instead of an allgather of its own on the solver's communicator. It therefore pairs with anagreed_buildexit or anagree()on another rank._assemble_node_transfer: it has agreement points before its allreduce (the agreed wrapper) and before the collectivecreateAIJ._gather_coarse_cloud's allgathers and_count_zero_columns_parallel's allreduce go through the agreed wrappers.Not yet converted: the fault transfers (provenance, cell-located). They keep their per-site guards from #1216, which are agreement points already. The insides of those guarded blocks would be the last
custom_mg.buildphase.test_0052: an agreement point (agree(), an agreed wrapper) now counts as a collective in the guard scan, because every rank must reach each one (H1's review). The scan then finds 8 under guards in_build_body:pre is not None;keyed or split is not None.Both guards are the same on every rank. The accepted list now takes a key per guard,
(path, function, guard text), so only these two guards in_build_bodyare accepted, and any other guarded agreement point there is flagged (H1's second review). A self-test plants a rank-local guard beside an accepted one, and only the planted one is flagged. The reasons:pre: it walks attributes thataddon_partitionsets on every rank together.keyed: it is the hierarchy's ownfac_zone.is_split_level, whose fault-pair dict has a key per fault on every rank, and from the allreduced FAC kill flags.Noneonly on the cover gate's allreduced counts.A separate gap, not changed here: the base scan lists
comm.rankamong its uniform tokens, so a guard such asif comm.rank == 0:is not reported at all, whatever it guards.Behaviour:
buildused to escape as itself, on that rank alone. It now arrives as the sameCollectiveBuildErroron every rank, so it is retried and then degraded with a warning, as an agreed builder failure already was.CollectiveBuildError, chained from the original.Test
tests/parallel/test_0874_agreed_custom_mg_build_parallel.py(min_size 2) re-runsbuildon the hierarchy and solver of a real solve. Each case forces one failure on the last rank, at a rank-local step just after a collective has returned. It asserts that every rank raises the sameCollectiveBuildError(builder_failureset), and that the agreement calls per rank are paired.createAIJ(phase 3)A twelfth case rebuilds cleanly and checks that the transfers' sizes are unchanged and the agreement counts paired. Results: 12 passed at np 2, 3, 4 and 5, on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).
Neighbours:
test_0874files,test_1089,test_1095,test_1101,test_1111,test_1114,test_1120,test_1131,test_1139,test_1147,test_1152,test_1176). Files after phases 1 and 2: Files: everytest_0874file,test_1064,test_1089,test_1095,test_1096,test_1101,test_1111,test_1114,test_1120,test_1131,test_1139,test_1147,test_1152,test_1173,test_1176.test_0052stale entry, now fixed (8 passed). Files:test_0052,test_1087,test_1111,test_1120,test_1176, thetest_1022files,test_1145,test_1101,test_0078.scripts/check_test_coverage.py: OK.Underworld development team with AI support from Claude Code