Repository navigation
Split-level transfer: the recorded parent's rows where a fault copy has no fine image (#1120) - #1206
Conversation
…as no fine image (#1120) Between two split levels the cell-located transfer reads each fine node in the coarse cell that holds its fine cell's centroid. Next to the fault the coarse cut leaves thin pieces, and a coarse fault copy on such a piece got no fine image on its own side: its column was empty, the rotated pair's mean and jump columns were proportional, and the Galerkin level was singular (3 null directions at rest on the issue's fixture). add_fault now records each split cell's host cell: a label on the host's cells that the cut's DMPlex transform and the split carry to every cell made from it (_cut_parent, _cut_host). In the transfer, a copy column whose norm is below _WEAK_COPY (0.1) of the median copy column takes, for the rows that reach it, the recorded parent's row: the cut pieces of the coarse host cell its fine host cell nests in, less those across the fault (a cell with none borrows its face neighbours'), the one that holds the node best. Every other row stays as located: the parent rule everywhere put nodes in thin cut pieces and cost 9 to 28 % more velocity work. Serial and parallel; in parallel the copy column norms are summed over every rank's owned rows. Tests: tests/test_1120_split_transfer_fault_copies.py (at rest, and with every add-on level moved by 0.002 and 0.015; the threshold's measured gap) and tests/parallel/test_1120_split_transfer_fault_copies_parallel.py. test_1176's at-rest iteration count goes from 5 to 6 on the last velocity application; the total over the solve is unchanged (116). 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 on head f9dfb4a: changes requested. The hybrid transfer is correct and does what it claims. On the issue's fixture I reproduced every number in the PR body, and the fixed outcome does not depend on the partition. But two parallel tests that pass on development fail on this branch, because they pin the old behaviour. Both need their expectations updated in this PR. There is also one medium point on the production configuration, for the integration lead (W1, the session that owns the convergence and integration work) to rule on. Findings1. Blocking:
|
| child moved (axis, amplitude) | pairs/null dev -> PR | #1101 merges dev -> PR | total velocity its dev -> PR | copies empty dev -> PR | parent rows taken |
|---|---|---|---|---|---|
| y, 0.002 | 4/4 -> 0/0 | 0 -> 0 | 117 -> 117 | 4 -> 0 | 15 |
| y, 0.005 | 13/13 -> 3/4 | 2 -> 7 | 129 -> 131 | 23 -> 6 | 53 |
| y, 0.01 | 15/64 -> 7/51 | 6 -> 6 | 134 -> 131 | 33 -> 13 | 57 |
| y, 0.015 | 13/55 -> 6/56 | 23 -> 22 | 123 -> 137 | 43 -> 20 | 32 |
| x, 0.002 | 5/6 -> 0/0 | 2 -> 0 | 117 -> 116 | 11 -> 0 | 39 |
| x, 0.005 | 8/16 -> 3/14 | 5 -> 4 | 153 -> 152 | 15 -> 5 | 30 |
| x, 0.01 | 5/20 -> 5/19 | 19 -> 19 | 117 -> 117 | 10 -> 10 | 3 |
| x, 0.015 | 8/45 -> 8/45 | 41 -> 41 | 133 -> 133 | 13 -> 13 | 0 |
- Better: small moves are fixed outright (0.002 on either axis goes to 0/0).
- Worse: y 0.015 costs 11 % more velocity work (123 to 137), and its null count goes up by one, as the PR body already notes (55 to 56).
- Silent no-op: at x 0.015 the hybrid flags 13 weak copies but takes no rows (
rows: 0), and nothing reports it.
Nothing here fails a solve. W1 should decide whether to ship the repair ungated, or to restrict it to split pairs whose coarse level sits where the fine level was built, until the coarse levels follow the fine mesh. Either way, the PR body should state the measured effect in this configuration.
4. Low: the host-cell label can be left on a live mesh
- Where the label goes:
_mark_host_cells(dm)labels the dm that_track_fault_records(mesh)returns. For a mesh with no earlier fault, that ismesh.dmitself, not a clone. - Where it is removed: only at the end of a successful
add_fault. - What leaves it behind: any exception in between, such as the collective seam refusals or a failure in
pull_vertex_ontoorcut_along_lines. Insplit_tail_levelsthis is a normal path: a level the replay cannot carry stays welded, and the exception is caught, soUW_HostCellstays on a level that remains in the hierarchy. - Consequence: checkpoints then write the label, and refinement inherits it.
- Fix: a
try/finallyaround the cut, or marking a clone, closes this.
5. Low: the no-repair paths are silent
The repair does nothing, with no warning, in these cases:
- there is no record (
cut=Falselabel-embedded faults, 3-D sheets, since_add_fault_sheetsreturns before the marking, and a mesh rebuilt without_cut_parent); - the record's length does not match;
- no parent row reaches a weak copy (finding 3, x 0.015);
- stranded cells leave a copy weak.
The only trace is the module global fault_mg.last_parent_rows, which each build overwrites. Suggestions:
- record the post-repair weak-copy count in the hierarchy's build notes, next to the custom MG: two coarse DOFs whose only fine image is the same fine node make the Galerkin operator singular (zero pivot in level SOR) when a coarse level is not nested in the level above #1101 merges;
- warn once when weak copies remain;
- say in the PR body that the repair is 2-D only.
6. Nit: two collective-hygiene gaps (in the #874 sense)
These sit in _recorded_rows_where_weak_parallel:
- the per-rank norm accumulation, between the
allgatherand theAllreduce, is outside thetry/_collective_raisepattern; - so is
_built_cell_table, which holds anallreduceof its own (_moved_off_transfer_geometry).
Both are pure array work on arrays that have already been checked, so the risk is low. But a rank-local exception in either would leave the other ranks waiting. Moving them inside the guarded block keeps the function uniform.
Confirmed correct
- Rows changed: parent rows replace only the rows whose recorded-parent row reaches a weak copy column, with weight above 1e-13. Every other row stays located.
- At rest, 10 rows change (serial and every parallel run).
- With every add-on level moved, 14 to 41 rows change, depending on the move.
- After the repair, no fixture in which every add-on level moves together (or none moves) has an empty or weak copy. No sound copy dropped below the threshold: the lowest post-repair ratio is at or near the smallest kept located ratio in every such case. Finding 3 covers the finest-only moves, where weak copies remain.
- The weak decision is collective:
- the copies' global columns are allgathered, and the norms are summed by
Allreduceover owned rows only; - the
_split_recordavailability is reduced withMINbefore the collective_built_cell_table; - every rank reached the same verdict (weak 8 columns, 10 rows, 0 stranded) in all 12 parallel runs below.
- There is no rank-local early return before a collective in the new code. The two
_collective_raisecalls bracket the rank-local work, withCollectiveBuildErroras the error class.
- the copies' global columns are allgathered, and the norms are summed by
- The label survives: it gets through the pull, the cut transform and the split on every rank, ghost cells included. The record had no
-1entry on any rank in any run, including the runs with an empty rank. In serial, every one of the 1470 split cells has a host, and the record covers every host cell (the PR's record test passes). - A cell with no recorded parent: it gets no candidates of its own and borrows its face neighbours'. A node with no candidate in its whole star keeps its located row. None occurred at rest; up to 3 stranded cells occurred in the moved and three-level cases, without leaving a weak copy.
- Partition independence: I ran np 2, 3 and 4, each with the default partition, two random partitions (seeds 1 and 7) and an empty-band layout. At np 3 and 4 the empty-band layout left one rank with no cells on the split mesh. In every run:
- located alone: 284 copy columns, 8 empty (4 copies × 2 components);
- this branch: 0 empty, 0 weak;
- pairs/null 0/0 on level 2, with smallest eigenvalue ratio 2.0073e-4 to 2.0077e-4 (serial: 2.0073e-4).
- Repaired rows across partitions: the 10 repaired rows match to 1e-9 between the default and seed-7 partitions at np 3, by fine-node coordinates.
- Separately, I found 15 fine nodes within 0.022 of the trace whose located rows differ between those two partitions. They differ identically on development, so this is pre-existing, not from this PR. It may interest the reproducibility issue Gradient density metric: the percentile ranking amplifies the projection's partition-dependent convergence in the flat region (follow-up to #1132, #1158) #1166.
- The PR's tables reproduce exactly:
- development: pairs/null 3/3, 2/2 and 7/8, with totals 116, 132 and 125;
- this branch: 0/0 throughout, with totals 116, 131 and 129;
- copy columns: 4, 5 and 13 flagged, with largest flagged 0, 0 and 0.069, and smallest kept 0.255, 0.221 and 0.379.
- Threshold on other fixtures: 13 split pairs on 8 fixtures. The variants were move amplitude 0.002, 0.005, 0.01, 0.015 and 0.03, two other traces (at rest and moved 0.015), and a three-level add-on.
- The pooled gap is 0.069 (largest flagged, the PR's fixture moved 0.015) to 0.182 (smallest kept, the three-level add-on's lower split pair at rest).
- So 0.1 still sits inside, at 1.45× above the lower edge and 1.8× below the upper edge. The upper edge is tighter than the PR's 0.221.
- Three more variants did not split any coarse level, so they did not exercise this code: base cell size 0.08 or 0.12, and a near/far size ratio of 3.
- The threshold mutants fail as claimed: 0.06 fails 2 tests (moved 0.015), and 0.25 fails 1 (moved 0.002).
- test_1176 serial change: justified. The total is 116 on both, and the last application goes from 5 to 6. The test still separates a kept transfer (6) from a rebuilt one (13), so the change hides no regression. Applying it to the parallel file (finding 1) gives the same result.
What was run
The PR touches Python only. I ran it as an overlay of the PR head on a development build at 176958a, from which it differs only in .py files. Development is an overlay at the merge base fafbecb. Every parallel run went under scripts/mpi_supervisor.py. Logs kept by the reviewer.
The PR's own tests:
tests/test_1120_split_transfer_fault_copies.py(serial): 7 passed on the branch, 7 failed on development (4 empty at rest, 5 at 0.002, 12 empty and 1 weak at 0.015; record and threshold attributes missing).tests/parallel/test_1120_..._parallel.py: passed at np 2, 3 and 4. It fails on development at np 2 (8 empty reduced columns).
Neighbour tests:
- Serial: 162 passed and 1 skipped (
test_1111mesh fingerprint) overtest_1087,1174,1176,0844_line_cut,1111,0858_fault_network_realisations,1120,0874_repair_drops_parent_maps,1096,1097and1173. Alsotest_1022andtest_1145: 7 passed. - Parallel np 2: 40 passed, 2 skipped (min_size 4), 1 failed (finding 1). Files: all four
test_0874files,1089,1096, both1097files,1099,1173and1176_custom_mg. - Parallel np 3 and np 4: 30 passed and 1 failed each (finding 1). Files:
0874_fault_mg_collective_failures,0874_provenance_and_parent_collective,1089,1173,1176_custom_mg,1096and1120. - Parallel np 3, more files: 22 passed, 1 failed (finding 2). Files:
1095,1111_custom_mg_cut_of_a_moved_child,1139,1147and1152. test_1111_custom_mg_cut_of_a_moved_child+test_1101, np 2: development 19 passed; this branch 18 passed, 1 failed (finding 2).- Parallel test_1176 split-level test: on development, passed at np 2, 3 and 4. On this branch with the at-rest count set to 7, also passed at np 2, 3 and 4.
Probes:
- copy-column norms, located alone and hybrid;
- the hybrid's record;
- the Galerkin levels' null directions and proportional rotated-transfer column pairs;
- total velocity iterations, counted with a monitor on the velocity sub-solve;
- runs serial, and at np 2, 3 and 4 under the partitions above.
Not run:
- np 5 and np 8;
- the 3-D sheet path (not touched; no record there);
- the full test suite;
- the
test_0874mirrored-cut and nested-verdict files at np 3 and 4.
Underworld development team with AI support from Claude Code
…giene H1's review of #1206: - The repair's per-level record (fault_mg.last_parent_rows, now with the copies still weak afterwards) is kept on the hierarchy and carried by record_repairs to solve_report.config["multigrid_hierarchy"] ["unrepaired_fault_copies"], next to the #1101 merges, with a once-per-session warning. A pair with no record (3-D sheets, label-embedded faults) is reported the same way. Not pc_fallbacks: the hierarchy installed is the one requested, as for the #1101 merges. - tests/parallel/test_1176: the at-rest count goes 6 to 7 at np 2 to 5 (last application; totals barely move). - tests/parallel/test_1111: the expectation pins the fixed behaviour (no merge and nothing weak at 0.002; unrepaired copies reported at 0.005 and up; no merge at axis 0, 0.005), so lost fine images fail it; the 0.002 count is 7 at np 4 (total 140 to 142). - The host-cell label goes on a clone, never on the live DM. - The parallel repair's rank-local steps (the column sums, the record, the hosts' tables) are under the collective guard; the hosts' move check, which is collective, runs before it on every rank. - The threshold's comment adds H1's pooled gap (0.069 to 0.182). 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 on head d4f6120: ready to merge on green from this review. Both blocking items and all the lows from the first review are fixed. Two new points came up. Neither blocks, and both sit in the configuration the PR states it does not fully recover (only the finest level moved). I suggest a follow-up issue for them. I tested a fresh build of d4f6120, since it touches a Item by item
New, not blocking (follow-up)
What was run (build of d4f6120; logs kept by the reviewer)
Underworld development team with AI support from Claude Code |
The file has no min_size mark, so CI also runs it serially, and there the case gives 4 merged unknowns and 7 unrepaired copies (reproduced here; the same on development's merges, not a regression). Serially the moved child is its own host and is nested on its as-built geometry; in parallel the add-on partition's copy, made after the move, is nested where it stands. That is required case 2a of the coarse-levels design note. The other expectations (nothing at 0.002, unrepaired copies reported at 0.005 and up) hold at every rank count, serial included. Serial, np 2 and np 3: 7 passed. Underworld development team with AI support from Claude Code
…t as nodes H1's review of #1216 and point (B) of the #1206 review. - provenance_transfer_parallel: every statement from the fetched parents to the weights (the reshapes, Xw, reference_vertices) is under one guard that every rank enters, a rank with no owned node too. - cell_located_transfer_parallel: the opening reads under one guard, the node tables (collective) read first, as in the provenance transfer. - level_pair_rotation: the guard catches any exception (an IndexError from an offset escaped it) and covers the CSR build ahead of createAIJ. - level_wall_rotation: the per-node blocks and the CSR build are guarded. - inherit_provenance and _base_parent_addresses: the host's record is checked (one entry per cell) and indexed under the guard, before the collectives. - _carried_reference: a failure reading the table refuses on every rank. - The parallel fault-copy repair counts copy NODES (by their global columns), as serial does, not node x component columns. Every guard raises a CollectiveBuildError on every rank (addon_partition's RuntimeError where its checks raise one). Tests: a forced failure on the last rank at each site (test_0874_provenance_and_parent_collective_parallel.py, now 24 cases, the _resolve_parents ones over both records), and the node count checked against the located transfer (test_1120 parallel). Development hangs or aborts on every new case at np 2. Underworld development team with AI support from Claude Code
Fixes #1120. The fix is 2-D only:
add_fault's 3-D sheet path (_add_fault_sheets) and label-embedded faults (cut=False) carry no record, and their split-level transfers are unchanged. Review: W1 (convergence and integration work) for the design, H1 (review and parallel test runs on a 96-thread Linux workstation) for the review.The defect
On a fault cut into an adapt child, the transfer between two split levels (
fault_mg.cell_located_prolongation, andcell_located_transfer_parallelin parallel) reads each fine node in the coarse cell that holds its fine cell's centroid.Next to the fault, the coarse cut leaves thin pieces. A coarse fault copy on such a piece got no fine image on its own side, so its column was empty. After the pair rotation, the copy's mean and jump columns are then proportional, and the Galerkin level is singular. At rest the issue's fixture has 3 such pairs and 3 null directions.
The fix
fault_split.add_faultlabels each cell of the mesh being cut with its own index (UW_HostCell). The cut's DMPlex transform and the split hand the label to every cell made from it._cut_parent(the host's local cell for each cell) and_cut_host; then the label is removed._WEAK_COPYof the median copy column. For the rows that reach such a column, the transfer takes the recorded parent's row.CollectiveBuildErroron every rank.Tolerances
_WEAK_COPY = 0.1is dimensionless and relative to the copies' own column norms. It bounds how little fine image a coarse fault copy may have before it is repaired. Measured on the fixture as a fraction of the median copy column, with the located rule alone:test_the_weak_copy_threshold_sits_in_the_measured_gapfails if the value leaves the gap. The mutants 0.06 and 0.25 each fail."Holds it best" means the largest smallest barycentric coordinate of the node in the candidate. There is no tolerance; equal scores keep the first in sort order.
The clamp is
_clamp, unchanged. It clips negative barycentric coordinates to 0 and renormalises.The nesting of the two host levels locates each fine host cell's centroid on the grids they were built on (
locate_in_cells_exhaustive). A centroid more than_INSIDE_TOL(1e-8, barycentric, unchanged) outside every coarse host cell gets no nested parent. On the fixture none does."Reaches a weak copy" means a weight above 1e-13, the transfer's existing cutoff.
Coordinate matches
There are none for identity.
_fault_point_pairs.The one geometric step is the nesting of the two unsplit host levels. That is a centroid, which is not a mesh entity, located on adapt levels that nest exactly in their built geometry.
What this PR does not do, and how it reports it
Full recovery needs the coarse levels to follow a move of the fine mesh. That is W1's design note on coarse levels following the fine mesh, which awaits Louis. Until then, only the finest add-on level moves in production, and the repair runs there too.
H1 measured that configuration serially on the issue's fixture: only the child moved, before the cut. "Weak copies" counts empty copy columns.
No silent path. Copies the repair leaves weak are now reported:
solve_report.config["multigrid_hierarchy"]["unrepaired_fault_copies"], next to the custom MG: two coarse DOFs whose only fine image is the same fine node make the Galerkin operator singular (zero pivot in level SOR) when a coarse level is not nested in the level above #1101 merges (merged_coarse_unknowns), with a once-per-session warning that names the entry.pc_fallbacks: the hierarchy installed is the one requested, and the custom MG: two coarse DOFs whose only fine image is the same fine node make the Galerkin operator singular (zero pivot in level SOR) when a coarse level is not nested in the level above #1101 merge record moved out ofpc_fallbacksfor that reason. Apc_fallbacksentry would also fail tests that assert no fallback.The tests move every add-on level by hand, by the same field, before the cut, because production doesn't move the coarse levels yet.
Pre-existing, not touched by this PR: H1 found 15 fine nodes within 0.022 of the trace whose located rows change with the partition (default against seed-7 partition at np 3). They change identically on development. This may matter to #1166.
Tests
tests/test_1120_split_transfer_fault_copies.py(serial):tests/parallel/test_1120_split_transfer_fault_copies_parallel.py(min_size 2): the same copy check on the parallel transfer of the partitioned fixture, with column norms over the global matrix.The tests find the copy nodes with their own lookup, not the code under test.
Results on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH):
Solver work on the issue's fixture, serially:
vel_its_last, which samples only the last application.Other runs:
test_1087,test_1174,test_1176,test_0844_line_cut,test_1111,test_0858_fault_network_realisations,test_1120(8 tests now, including the unrepaired-copies report),test_0874_repair_drops_parent_maps,test_1096,test_1097,test_1173, thetest_1022files andtest_1145.test_1111's skip is its own mesh-fingerprint check.test_0874files,test_1089,test_1095,test_1096, bothtest_1097files,test_1099,test_1101,test_1111,test_1120,test_1139,test_1147,test_1152,test_1173,test_1176.test_0874_fault_mg_collective_failures,test_0874_provenance_and_parent_collective,test_1089,test_1096,test_1101,test_1111,test_1120,test_1173,test_1176.test_1111andtest_1176's split-level test pass, and so doestest_1120(np 2 to 5).scripts/check_test_coverage.py: OK.Changed expectations.
tests/parallel/test_1176_custom_mg_transfer_after_a_move_parallel.py,SPLIT_COUNTS: the at-rest last-application count goes 6 to 7 at np 2 to 5. The total barely moves (np 2: 141 to 144 over 18 applications; np 3: 149 to 153 over 19). This is the same effect as the serial file.tests/parallel/test_1111_custom_mg_cut_of_a_moved_child_parallel.py: this test required a custom MG: two coarse DOFs whose only fine image is the same fine node make the Galerkin operator singular (zero pivot in level SOR) when a coarse level is not nested in the level above #1101 merge at every amplitude of at least 0.005. It now pins the fixed behaviour:Development fails all 7 cases at np 2. A copy that loses its fine images again fails here.
Serial
test_1176,test_a_split_level_solve_after_a_move_keeps_its_iterations:[5, 6, 6, 6]to[6, 6, 6, 6].Underworld development team with AI support from Claude Code