Repository navigation
remap_var_set: skip a variable on every rank or none; stop swallowing a rank-local raise (#960) - #1142
Merged
Conversation
… a rank-local raise (#960) The mesh-move field transfer evaluates each REMAP variable with the collective global_evaluate. It skipped a variable on the rank where its new coordinates could not be read, or where the evaluation raised, while the other ranks went into that variable's collectives. At np 2 the ranks then evaluated different variables against each other and hung (T skipped on rank 1, S's collectives matched against rank 0's T). - Whether a variable's new DOF coordinates are unavailable is now reduced over the ranks (one Allreduce, before any evaluation): such a variable is skipped on every rank. - The broad `except Exception: continue` around the evaluation is gone. The monotone fallback for (ValueError, NotImplementedError) stays: it depends on the expression alone, so every rank takes it alike. Any other error now propagates instead of turning into a rank-local skip. A rank-local raise INSIDE global_evaluate still leaves the other ranks waiting in it. Agreeing on such a failure belongs in global_evaluate (the locator rewrite carries it as a requirement). tests/test_0791 runs both cases at np 2 through the MPI supervisor. On development both fail (the ranks hang into the silence limit); with this change the first returns on every rank with the variable skipped on both, and the second shows the error instead of swallowing it. Underworld development team with AI support from Claude Code
…after the move (#960, #994) Removing the broad except made a failure AFTER global_evaluate's collectives (a rank-local limiter, as in #994's opt-in clamp) propagate on that rank only, so the other ranks went on to the next variable's collectives and hung. Each variable's outcome is now reduced over the ranks right after its evaluation: a variable that failed anywhere keeps its values on every rank, the move and the other variables complete, and remesh_with_field_transfer then raises the same RuntimeError on every rank (after its hooks, the stale-vector mark and the move-version count). The failing rank prints its own error first. remap_var_set(raise_on_failure=False) returns the failed names instead. A raise BEFORE the collectives, on one rank, still leaves the other ranks inside global_evaluate (its message now reaches the output). tests/test_0791 gains the after-collectives case: on development it completes with T transferred on one rank and not the other; at 1367f3d it hangs; here every rank raises, T keeps its values on both ranks and S is transferred. Underworld development team with AI support from Claude Code
… H4's review) With REMESH_MONOTONE off (the default) the (ValueError, NotImplementedError) fallback was an identical second call, so a ValueError on one rank re-entered global_evaluate on that rank alone. The fallback now applies only when the limiter is on, where the refusal it handles depends on the expression alone; otherwise the error is a failure and is agreed across ranks like any other. Underworld development team with AI support from Claude Code
…ailure reaches the caller (#960, H4's re-check) - Whether REMESH_MONOTONE applies to a variable is decided before the evaluation, from the expression alone (one MeshVariable or a component of one; "pick" only on one rank), so every rank answers alike. Nothing is caught for a retry: with the limiter on, a ValueError from it on one rank used to send that rank alone into a second global_evaluate (a hang at np 2). Every error is now a failure, agreed across the ranks. - The DDt on_remesh hook calls remap_var_set with raise_on_failure=False and records the failed names on the mesh. The hook dispatcher does not let a hook's exception through, so a failed history transfer used to be silent; remesh_with_field_transfer now raises for it on every rank, with the generic pass's failures, after the move is complete. tests/test_0791 gains the limiter case (REMESH_MONOTONE=clamp, the limiter raising on rank 1): it hangs at 79f7951 and passes here. Underworld development team with AI support from Claude Code
…r a stale failure list (#960) The fifth case is the second review's probe: rank 1 fails once inside the semi-Lagrangian DDt's on_remesh remap (its ALE opt-out path), after the evaluation's collectives. At 79f7951 neither rank raises; now both raise after the move, the failed history keeps its values on both ranks and the others transfer, the same on every rank. remesh_with_field_transfer clears the failure list at the top of its outer call, so a list left by an earlier call cannot raise on a later one. Underworld development team with AI support from Claude Code
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #960 Part 1: the mesh-move field transfer no longer lets one rank's failure pair the other ranks' evaluations with the wrong variables. Size S,
remesh.pyonly. It does not touch solver defaults,petsc_generic_snes_solvers,rotated_bc.pyor the custom multigrid.From H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), as the probe-pass S fix for #960. Branched from development 70b240c.
The defect
remap_var_setevaluates each REMAP variable at its new DOF coordinates withglobal_evaluate, which is collective. It skipped a variable on the rank where something went wrong, while the other ranks went into that variable's collectives. There were two such paths:target is None: continue);except Exception: continue).Measured at np 2 with a forced raise on rank 1: rank 1 skipped T and went on to S, and its collectives for S were matched against rank 0's for T. The ranks thus exchanged data belonging to different variables without any error, and then hung (record on #960).
The change
Allreducebefore any evaluation starts, and such a variable is skipped on every rank. The callers pass a list, sovars_has the same order on every rank.Allreduceright after each evaluation tells every rank. A variable that failed anywhere keeps its pre-move values on every rank, and the move and the other variables complete.remesh_with_field_transferthen raises the sameRuntimeErroron every rank. It does so after its hooks, the stale-vector mark and the move-version count, so the mesh is left consistent.remap_var_set(raise_on_failure=False)returns the failed names instead, for callers that finish their own steps first.REMESH_MONOTONEapplies is decided before the evaluation, from the expression alone: one MeshVariable or a component of one, with "pick" only on one rank. Every rank answers alike, so nothing is caught for a retry. AValueErrorfrom the limiter on one rank used to send that rank alone into a secondglobal_evaluate, which hung at np 2 (H4's probe). It is now a failure like any other.remesh_with_field_transferclears the failure list at the top of its outer call, so a list left by an earlier call cannot raise on a later one.on_remeshhook callsremap_var_set(..., raise_on_failure=False)and records the failed names on the mesh. The hook dispatcher does not let a hook's exception through, so a failed history transfer used to be silent. It is now raised on every rank with the rest (H4's review).IndexErrorin the opt-in clamp. That error comes after the collectives, so the variable now fails on every rank instead of being kept stale on one.Not fixed here, by design: a raise on one rank BEFORE
global_evaluate's collectives still leaves the other ranks waiting inside it.global_evaluateto agree on a failure before each of its collective phases. The locator rewrite carries that as a requirement.Test
tests/test_0791_remap_var_set_rank_local_failure.pyis a serial driver. It runs its five np 2 cases in subprocesses throughscripts/mpi_supervisor.pywith a 40 s silence limit, so a regression fails instead of hanging CI. The fixture: a 1/16 simplex box, with T (P2, a tanh front) and S (P1, linear), moved by a smooth interior deform.get_max_radius, rank 1 innuke_coords_and_rebuild) and the supervisor stops the job at 40 sREMESH_MONOTONE=clamp, the limiter raises on rank 1on_remeshhook's remap (its ALE opt-out path)global_evaluateraises on rank 1 before its collectivesThe first head of this branch (1367f3d) failed the second case: it hung, because the error propagated on rank 1 only. That is why each variable's outcome is now agreed.
Checks
REMESH_MONOTONE=clamptest_0052_collective_guard_scan: 5 passed.scripts/check_test_coverage.py: OK. The new file sits in thetest_07*batch.Refs #960.
Underworld development team with AI support from Claude Code