Skip to content

Empty-rank support, layer 2: evaluate/points_in_domain, radii/centroid reductions, gather_data NaN-stripping #405

Closed

Description

@lmoresi

Umbrella follow-up from the public adversarial review of the #399/#400/#351/#386 batch (2026-07-24). That batch makes starved-rank meshes constructible and solvable (PETSc handles empty ranks fine), fixes the nearest-centroid particle mis-route, and makes the kd-tree sentinel guards honest. The next layer breaks at the first point evaluation:

  1. uw.function.evaluate on a starved rank: points_in_domain calls get_max_radius, which does self._radii.max() on an empty array → ValueError on the starved rank while populated ranks sit in gather_data → deadlock. get_min_radius fails identically and feeds every solver's estimate_dt and penalty scaling. Needs empty-safe local reductions with defined semantics (e.g. points_in_domain short-circuits to all-False with no radii access; min/max radius return identity elements and callers reduce globally).
  2. Consequence for field-valued metrics: mesh_metric_mismatch skips evaluate on starved ranks (it must — see 1), so a metric containing MeshVariable data deadlocks at np>1 with a starved rank. Documented as a known limit in the function; lifts automatically once (1) is fixed.
  3. gather_data silently strips NaN rows (utilities/_utils.py): any consumer whose local reduction produces NaN on an empty rank gets a compacted table whose row index no longer equals rank — this was the mechanism behind the particle mis-route. Either stop stripping (return the full table and let callers mask) or make the stripping opt-in and loudly documented.
  4. Observed hazard class: when a rank-asymmetric raise occurs and user code catches it, the survivors' pending collective pairs with the next collective the failed ranks enter — both 'succeed' with garbage (observed live: a 1-row centroid table with no error). Worth a note in the parallel-patterns doc; the cure is the same as everywhere — no rank-asymmetric raises around collectives.
  5. Smaller members of the family: MeshVariable's rbf path and the monotone-clamp kNN (functions_unit_system.py) index empty source arrays without a guard (SwarmVariable's rbf path IS guarded).

Related: #314 (global_evaluate np4 hang on empty-interior ranks) is likely the same family seen from the DMInterpolation side — a fix for (1) should be validated against #314's reproducer.

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Aug 13, 2026

    @lmoresi
    MemberAuthor

    Triage 2026-08-14: kept separate from #314/#513 and raised in priority — this fires before their path is reached, and it is a rank-asymmetric ValueError, not a collective-count divergence.

    All five sub-items are unfixed at development @ e475246f:

    • _radii.min()/.max() — discretisation/discretisation_mesh.py:6512, 6527 (contrast get_mean_radius at :6531-6560, which was made empty-safe: the pattern to copy)
    • utilities/metrics.py:167-180
    • utilities/_utils.py:236-238
    • function/functions_unit_system.py:700-711
    • discretisation/discretisation_mesh_variables.py:936-945

    Priority argument: get_min_radius feeds estimate_dt and penalty scaling at 14 call sites, and sits under Swarm.migrate as well as under evaluate — so a zero-cell rank takes down ordinary time-stepping, not just point evaluation. Recommended fix order for the empty-rank family: this first, then #314, then #512's item 1 falls out.

    Underworld development team with AI support from Claude Code

  2. lmoresi commented on Aug 14, 2026

    @lmoresi
    MemberAuthor

    Fixed by PR #557, merged to development as c1ef107.

    All five listed sites plus five found by the pattern hunt: Mesh.quality() chose its branch from rank-local evidence, so a starved rank ran 3 reductions where its peers ran 11 — a deadlock on any simplex mesh with an empty rank; physical_bounds/physical_extent reduced over each rank's own nodes, so every rank reported a different domain size; and three estimate_dt paths reduced before their allreduce.

    Fail-before evidence is the asymmetry itself: at np=2 one rank raised and the job hung; at np=4 three ranks raised, one did not, and the job hung.

    Also closed on the way past: SNES_AdvectionDiffusion.estimate_dt had been returning a 0-d ndarray since before this branch (the np.squeeze scalar contract only ever held by accident — see the PR for the mechanism), now pinned by tests/test_1007_estimate_dt_scalar_contract.py.

    Item 2 of this issue does not lift: measured at np=4 on a starved mesh, radii/points_in_domain/quality/estimate_dt all work, but any mesh-variable sub-DM path still dies below UW3 with MPI_ERR_BUFFER out of DMCreateSubDM_Plex → DMClone. The KNOWN LIMIT comment records the measurement and names #551 (formerly #314) as the blocker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions