Repository navigation
Lazy coordinate fields: an np 2 empty-rank case and the notes from #1271's review - #1297
Conversation
's review - test_1107_mesh_load_after_a_solve_on_an_empty_rank_parallel gains a case that runs from np 2, as CI does: a gmsh box whose cells all go to rank 0 (a shell partition set on the loaded DM), a viscoelastic solve, the ranks' next tag compared, and a second gmsh load. It fails at np 2 without #1271. The right-triangle cases keep their np >= 3 skip. - dm_force_coordinate_field's docstring states both effects: the field made on every rank, and every coordinate-DM label but depth and celltype removed. clone_dm_hierarchy says why the strip loses nothing there. - _rebuild_level_coordinate_field's docstring no longer says a clone inherits the field. - Mesh.remesh's region-label branch is rank-local above the metric; a TODO(BUG) says so (it matters once a parallel remesher is in the build). 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)) Review of #1297 at 831147eVerdict at 831147e: ready to merge on green from this review. We confirm the author's main result. None of the other clone and sub-DM sites listed in the #1271 review drifts the tag counter. We checked each one we could reach at np 3 and at np 2, with a rank that holds no cells, on the branch and on development. The tag spread was 0 after every operation and after the gmsh load that followed. Branch and development matched in every count. The new np 2 case fails without #1271 and passes on the branch at np 2, 3 and 4. The Method
1. Tags at each siteTags used = the tags each rank took during the operation (the same on every rank in every row). Spread = the largest minus the smallest next tag over the ranks: first after the operation, then after a following gmsh load. Branch and development gave identical numbers in every cell. Cells per rank: plain box 175 / 171 / 0 (np 3) and 346 / 0 (np 2); refined box 348 / 300 / 0 and 648 / 0; faulted base 700 / 684 / 0 and 1384 / 0.
2. The new test
So the np 2 case catches the bug the way CI runs the file. It fails on the tag check before the second load, so it fails rather than hangs. The fixture shell-partitions each rank's local cells to rank 0 and checks that rank 0 holds every cell. It is function-scoped, so the patch is undone after the test. Its rank-local reads are symmetric. 3. The
|
| labels on the coordinate DM | |
|---|---|
mesh.dm |
celltype, depth |
| level 0 | depth |
| levels 1 to n | All_Boundaries, Bottom, Elements, Left, Right, Top, UW_Boundaries, celltype, depth |
| their solver clones | celltype, depth |
The same holds on head and on development. So the strip does remove the boundary labels from the solver clones of every refined level, the finest included. This is the observation in finding 2 of the Solver DM clones create their coordinate field on every rank #1271 review. The comment's conclusion, that nothing a solver reads is lost, is supported by the outcomes: no test changed with Solver DM clones create their coordinate field on every rank #1271, and the 17 files and 10 serial files above agree. Only the reason is wrong. Suggested wording: "...also strips every label but depth and celltype from the clone's coordinate DM. On a refined mesh the levels' coordinate DMs carry the boundary labels, so the clones lose them; the solver reads its labels from the clone itself, not from its coordinate DM (Parallel bug - Calculating a boundary integral causes the next Stokes solve to hang #96)."
Seen in passing, not this PR
These behave the same on head and on development. We list them so they can be filed if wanted.
-
evaluate_gradient(T, pts)with points on a rank that holds no cells raises "An error was encountered attempting to find the closest cells to the provided coordinates" on that rank only, at np 2 and np 3. The other ranks return. In a script, that is a rank-local exception. With no points on the empty rank, the call works. -
read_timestepon a file written bywrite_timestep(..., create_xdmf=False, petsc_reload=True), read into a variable with a different name: rank 0 alone readsfields/Twith h5py. The file has nofieldsgroup, so rank 0 raisesKeyError. The other ranks wait in the followingbcast, and the run hangs (exit 124 at np 2 and np 3, with or without an empty rank). Withcreate_xdmf=Truethe same read works. -
read_checkpoint(file, data_name="T")into a second variable on the mesh that wrote it gives the wrong field at np 3. Against ∫T² = 0.203:run ∫(T_read - T)² np 3, cells 175 / 171 / 0 0.248 np 3, every rank holding cells 0.198 np 1 0 np 2 0 read_timestepfrom the same file is exact at every np. This may be a use the reader does not support. It needs a look.
Run and not run
Run:
- the site probe above at np 3 and np 2 with an empty rank, head and development
- the new test at np 2, 3 and 4 on head, and at np 2 and 3 without Solver DM clones create their coordinate field on every rank #1271
- the 17 parallel files at np 2 and 3 on both (test_0780 at np 4)
- 10 serial files on both
- the coordinate-DM label check on both
Not run:
- the sites listed as not reached in section 1
- a 3-D mesh
- a mesh from a source other than gmsh (the partition hook acts on gmsh loads only)
- the full serial suite
- CI
Logs kept by the reviewer.
Underworld development team with AI support from Claude Code
…ver keeps its own From the review of 831147e: on a refined mesh the levels' coordinate DMs carry the boundary labels, so the strip removes them from the clones' coordinate DMs; the solver reads its labels from the clone itself (#96). The wording is the reviewer's. Underworld development team with AI support from Claude Code
The follow-ups from the review of #1271 (and the lows on #1287), with no issue. Review: H1, the session that reviews pull requests and runs the parallel tests on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).
The other clone and sub-DM sites: probed, no drift found
#1271 fixed the lazy coordinate field on the solver's clones. The review listed other sites that clone a DM or make a sub-DM, and so could create the field lazily too. Each was reached through the public operation that uses it, at np 3 and at np 2, on development with #1271. Every gmsh mesh was given a test-only shell partition that leaves the last rank with no cells. The next tag on
COMM_WORLDwas read on every rank before and after each operation:gradient_evaluation)gradient_evaluation)project_to_degree(field_projection: clone and sub-DM)read_timestep(mesh-variable sub-DMs and clones)boundary_flux(boundary_flux)custom_mglevels)add_fault(fault_split,line_cut,edge_split)node_redistribution(the mover's frozen DM)custom_mgwith fault levels)Changes
test_1107_mesh_load_after_a_solve_on_an_empty_rank_parallelgains a case that runs from np 2, as CI does: a gmsh box whose cells all go to rank 0 (a shell partition set on the loaded DM, through a fixture that patches_from_plexh5), a viscoelastic solve, the ranks' next tag compared, and a second gmsh load.dm_force_coordinate_fielddocstring. It now states both effects: the coordinate field is made on every rank that calls it, and every label of the coordinate DM exceptdepthandcelltypeis removed.dm's own labels are untouched.clone_dm_hierarchysays why the strip loses nothing there: the clone's coordinate DM is a clone of the level's own, whose labels were stripped when the level was built (Parallel bug - Calculating a boundary integral causes the next Stokes solve to hang #96)._rebuild_level_coordinate_fielddocstring. It said a solver's clone inherits the field. It does not (DMClonecopies the coordinates, not theDMField); the docstring now says so and points toclone_dm_hierarchy.Mesh.remeshregion-label branch. It is rank-local above the metric: a rank with no cells neither creates_CellRegions_nor setsrgLabel_name, while the others passrgLabel="_CellRegions_"toadaptMetric. ATODO(BUG)says so. It matters only once a parallel remesher is in the build.Finding, not fixed here
At np 2 with every cell of a refined base on one rank (cells 168 / 0),
add_faultraises the sameCollectiveBuildErroron both ranks: "84 fine cell(s) have no local parent cell on the level below; the add-on levels are not co-partitioned". So it is agreed, not a hang. At np 3 with one empty rank (80 / 88 / 0), and at np 2 with cells on both ranks, the same call works. A DM with every point on one rank reads as not distributed, whichaddon_partitionalready notes for the case where the partition would put everything on one rank. This looks like the same edge, met earlier. It is reported separately.Underworld development team with AI support from Claude Code