Repository navigation
global_evaluate answers each point from a rank whose cell contains it (#1178) - #1258
Conversation
…ng rank (#1178) On development at np 2, 3 and 4, 30 to 57 of 604 points per asking rank on the sheared box are off the exact P1 field, by up to 3.3e-4. Underworld development team with AI support from Claude Code
) After the evaluation swarm's migration, the points a rank holds without any local cell containing them are gathered, every rank tests them for exact containment, and each goes to the lowest rank that contains it. A point no rank contains keeps the face-tolerance claim. The interpolation is unchanged. 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)) 6ac2ff5: ready to merge on green from this review. The fix does what it says at every rank count and layout tried. Finding 1 (cost) does not block, but the PR text should be corrected. How it was run
ResultsThe #1178 probe from the earlier sweepThe mesh is the sheared 3-D box (cellSize 1/6) with a P1 field linear in x, y and z. The probe uses 292 points at offsets 1e-8 to 1e-4 from interior edges. Every rank asks for every point. The table gives the worst error against the exact field.
The PR's new test
This matches the PR's description. Seam, edge, vertex and boundary casesI wrote a separate probe for these. Each rank asks for its own permutation of the same point sets, and the answers are put back in the original order before they are compared. The point sets are:
The probe evaluates a P1 field (linear) and a P2 field (quadratic) on four meshes. Both fields are exact in the element:
The table gives the worst difference from np 1 over the inside sets, taking the worst of the default, band and rand7 layouts. In brackets is the number of point answers off by more than 1e-12, summed over ranks.
Points no rank contains keep the face-tolerance claim. On tri2 and tet3, the outward sets (1e-8 to 5e-2 outside) give bit-identical answers on the PR and on development. This holds at np 2, 3 and 4 for every layout, emptyband included. Both differ from serial by up to 0.2 there. That is the existing extrapolation, and it is unchanged. Every point is evaluated exactly once, and where it is contained. I wrapped
Result order. Each rank's answers, put back in its own order, match np 1. So the order returned to the caller is unchanged. Collective safetyReading the code:
Tested, on all four meshes, with no hang and correct answers:
Other checks
CostThe probe times
The 1e6 np 4 runs also show the gain: the worst error drops from 2.2e-5 (2-D) and 3.6e-5 (3-D) on development to 1.3e-15 and 2.7e-15 on the PR. Neighbouring tests (PR build)
Findings
What was run and not run
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
On one rank the kept patch stays within one velocity iteration of a fresh registration. At np 2 it takes 19, 19, 20 against 18, 17, 19 for the recomputed zone, and exactly the count of a registration made after the move with its own mask, so the gap is zone drift, not state carried from before the move. Before this branch the parallel mover moved the mesh up to 3.4e-3 off the serial one and inflated the fresh count, which hid the gap. Underworld development team with AI support from Claude Code
global_evaluatenow answers each point from a rank whose cell contains it. This is the core evaluation path; the change is confined to which rank answers a point (the ownership claim). The interpolation itself, and the refusals before the migration, are unchanged. Fixes #1178.The defect. The evaluation swarm's migration lets a rank keep a point that none of its cells contains, when the point is within the evaluation face tolerance (
Mesh._EVAL_FACE_TOL, a slab of about 1e-5) of one of its cells. Near a partition seam the neighbour rank's cell contains that point. The keeping rank evaluated it in its own cell with the reference coordinates clamped onto the face, an error of about |grad f| times the point's distance from that cell. The parallel review desk measured, on #1123's sheared box with points 1e-8 to 1e-4 off interior edges: up to 2.1e-4, 1.0e-4 and 4.1e-4 at np 2, 3 and 4, where serial is 1.8e-15.The fix (
_hand_points_to_containing_rankinfunction/_function.pyx, called byglobal_evaluate_ndstraight after its migration):Mesh._contained_in_local_cells: the exact walk of Exact point location on simplex meshes: barycentric coordinates and a face-crossing walk (#1123, register row 14) #1175 on a simplex mesh, containment to rounding,_EVAL_CONTAIN_TOL, on other meshes);Mesh._robust_owning_cellsandpoints_in_domainare not changed, so a swarm's own claims and the other callers of the face-tolerance claim are as before. (The parallel review desk's probe counts claims by_robust_owning_cells; that count is unchanged. What changes is which rank evaluates.)What a user's run does now. In parallel,
global_evaluateof a field at points near a partition seam returns the value from the containing cell, the same as serial to round-off, on every asking rank. Development returned a value from a neighbouring cell for some of them. This was not limited to sheared meshes: on a plain 3-D box (cell 1/20) with 1e6 uniform points at np 4, development's largest error for a linear P1 field is 1.5e-5; this branch gives 8.9e-16.Test
tests/parallel/test_1178_global_evaluate_seam_ownership_parallel.py(level 2, tier B): the sheared box ofsheared_box_fixture.py, a P1 field linear in x, y, z, one point on each of the 604 interior edges, moved 1e-8, 1e-6, 1e-5 or 1e-4 in a random direction. Every rank asks for every point. The baseline is exact: the element represents the field, so every value must equal it to round-off; the bound is 1e-12 (serial gives about 1e-15; a point evaluated in a non-containing cell is off by 1e-8 to 4e-4).The file runs in the MPI phase of
scripts/test.shthrough thetests/parallelglob (coverage check: all 492 files reachable).Cost
global_evaluateof a P1 field, N points in total spread over the ranks, uniform in a box; median of three calls, slowest rank (cost.py):At one rank the new step returns at once, so the np 1 differences are run-to-run noise. At np 4 the cost is not unchanged: the parallel review desk's measurements (best of three, repeated in interleaved sets; slowest rank) put the overhead at:
My own np 4 table above does not show it; theirs, with more repeats, does, and theirs is the one to rely on. The extra work is one exact containment test of the points a rank already holds and a gather of the uncontained ones. Points just outside the domain are in that gathered set on every call, because no rank contains them, which is why they cost most. The gathered set goes to every rank, so it grows with the rank count; replacing it with a neighbour-only exchange is a follow-up. In return, the worst error at 1e6 points on 4 ranks drops from 2.2e-5 (2-D) and 3.6e-5 (3-D) to 1.3e-15 and 2.7e-15.
A second bug this fixes: the parallel MMPDE mover
The MMPDE mover evaluates through
global_evaluate, so on development it read wrong values at partition seams too, and moved the mesh differently in parallel than in serial. Ontest_1152's split-level fixture at np 2, against a serial run (nodes matched to their nearest serial node):(The growth over moves on this branch is the iterative mover's own drift.)
test_1152's split-level bound
test_1152_fac_zone_survives_a_mover_parallel.py::test_a_kept_zone_patch_matches_a_fresh_registration[zone_on_a_split_level]failed on this branch at np 2 on CI,(2, {'fresh': 17, 'kept': 19}). Velocity iterations, kept / fresh (zone recomputed), moves 1 to 3:The kept count is the same on both builds; the fresh one moved to the serial value, because the zone it is recomputed from is now right. A registration with the kept solver's own mask takes exactly the kept count, so the kept solver carries nothing partition-dependent from before the move: the gap is the zone drift the patch is kept despite (the lead's ruling of 2026-11-10), which on development the inflated fresh count hid. The bound is now one iteration on one rank (unchanged) and two on several, with these counts in the test (03f2263). Whether the kept patch should cost one or two iterations more in parallel than in serial is a separate question for the custom multigrid.
What was run
On a 96-thread Linux workstation (single system image, Intel Xeon Gold 6240R, MPICH):
scripts/check_test_coverage.py#1249's non-finite refusal and the far-outside refusal run before the migration and are untouched; their tests (1249, 0786) pass at np 2 and 4.
Not run
Above np 4; a mesh with an empty rank in the new test (test_1076 covers
global_evaluatewith an empty rank and passes); the full suite; macOS.For the parallel review desk (H1).
Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)
level_*andtier_*markers (S8)maybe_/try_/do_) and no commented-out code (S3, S4).array/mesh.X.coords— nowith ....access(...), nomesh.data(S7)pixi.toml/pixi.lockor other dependency changes riding in an unrelated PRUnderworld development team with AI support from Claude Code