Skip to content

Coarse wraps and fault_split meshes keep a one-rank partition (UNFILED 44) - #1307

Open
lmoresi wants to merge 1 commit into
developmentfrom
bugfix/coarse-wrap-keeps-one-rank-partition
Open

lmoresi wants to merge 1 commit into
developmentfrom
bugfix/coarse-wrap-keeps-one-rank-partition

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member

A fix for a finding with no issue (UNFILED 44 in the dev hub's list). 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 failure

At np 2, take a refined base (UnstructuredSimplexBox, cellSize 0.25, refinement=1) whose cells all sit on rank 0 (cells 168 / 0, from a shell partition of the loaded gmsh DM). add_fault on (0.3, 0.45)–(0.7, 0.55) then refused on both ranks with:

addon_partition: 84 fine cell(s) have no local parent cell on the level below; the add-on levels are not co-partitioned

At np 3 with one rank empty (80 / 88 / 0) the same call worked, and so did np 2 with cells on both ranks.

The cause

A DM with every cell on one rank reads as not distributed (DMPlexIsDistributed is false on every level). The Mesh constructor distributes such a DM afresh unless _preserve_partition is set.

  • The coarse wraps: Mesh._wrap_coarse_level wraps each coarse level of the hierarchy as a Mesh for the add-on partition. Wrapping it redistributed the level, so the wrap no longer nested under the finer one.
  • The cut mesh: with the wrap fixed, the cut mesh that fault_split.add_fault builds was distributed afresh the same way (88 cells this time).
  • How it was found: a spy on DMPlex.distribute caught exactly these two calls, and no others.

The change

Four Mesh(...) constructions now pass _preserve_partition=True, as extract_region and extract_surface already do:

  • the coarse-level wrap;
  • fault_split's cut mesh;
  • fault_split's second-fault child;
  • fault_split's split child.

Each wraps a DM derived from an existing mesh's partition, which it must keep. When the DM is distributed, the flag changes nothing. At np 1 every DM reads as not distributed, and distribute() there is a no-op.

Test

tests/parallel/test_1300_add_fault_on_a_base_one_rank_holds_parallel.py uses a fixture that puts every cell of the loaded gmsh DM on rank 0. Its three cases check:

  • each coarse wrap keeps its level's cells per rank;
  • add_fault partitions the add-on (fault pairs > 0);
  • the faulted mesh solves (Stokes in simple shear with a frictionless fault; finite velocity, peak > 0.1).
run development this branch
np 2 3 failed 3 passed
np 3 (two ranks empty) 2 failed (the solve case added later) 3 passed

Regression

These runs used a Python overlay of this change on a current build.

  • Serial: the 107 test files that use add_fault, fault_mg, custom_mg or refinement=: 993 passed, 5 skipped, 1 xpassed, 1 failed.
    • The failure is test_0949_refinement_says_which_walls_are_left_off::test_a_crease_that_holds_vertices_back_names_the_walls_and_the_remedy. It fails identically without this change (the message no longer names ['Lower']), so it is not this PR's; it is reported separately.
  • np 2: the 59 parallel files that use them: all pass (392 passed, 18 skipped).

Underworld development team with AI support from Claude Code

…D 44)

A DM with every cell on one rank reads as not distributed
(DMPlexIsDistributed), and the Mesh constructor distributed it afresh. At
np 2, a refined base with every cell on rank 0 lost the nesting of its coarse
wraps (Mesh._wrap_coarse_level), and add_fault refused: "84 fine cell(s) have
no local parent cell on the level below; the add-on levels are not
co-partitioned". With the wraps fixed, the cut mesh fault_split builds was
distributed afresh the same way. np 3 with one rank empty worked, since two
ranks then held cells.

The coarse-level wrap and fault_split's three Mesh constructions (the cut,
the second-fault child, and the split child) now pass
_preserve_partition=True, as extracted submeshes already do: each wraps a DM
derived from an existing mesh's partition, which it must keep.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 20, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
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.

3 participants