Console scripts: abort all ranks on an uncaught exception (issue #807) - #815
Open
DLWoodruff wants to merge 2 commits into
Open
Console scripts: abort all ranks on an uncaught exception (issue #807)#815DLWoodruff wants to merge 2 commits into
DLWoodruff wants to merge 2 commits into
Conversation
…o#807) The pip entry points bypass python -m mpi4py, whose runner calls MPI_Abort when a rank raises, so an exception on one rank could leave the others blocked in a collective and hang the whole mpiexec job. Wrap the three console-script targets in mpisppy.entry_points so they install the same protection; serial runs re-raise normally and the no-mpi4py mock comm (which has no Abort) is left alone. Also switch the last doc examples to the python -m mpi4py form and update the notes that recommended it over the console scripts, since the two are now equally safe. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #815 +/- ##
==========================================
+ Coverage 76.33% 76.38% +0.04%
==========================================
Files 170 171 +1
Lines 22628 22650 +22
==========================================
+ Hits 17274 17301 +27
+ Misses 5354 5349 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The wrappers' bodies (real import + call) were only checked as callable, leaving them unexecuted. Drive each real wrapper end-to-end on its cheap serial path -- no arguments (and one rank) makes every wrapped main print usage and raise SystemExit, which the wrapper must pass through -- so a broken import target fails in the test suite instead of on a user's command line. entry_points.py is now at 100% statement coverage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Closes #807.
The pip console entry points (
mpi-sppy-generic-cylinders,mpi-sppy-mrp-generic,mpi-sppy-one-sided-test) bypasspython -m mpi4py, whose runner prints the traceback and callsMPI_Abortwhen a rank raises. Without that, an uncaught exception on one rank leaves the other ranks blocked in a collective and the wholempiexecjob hangs — which is why the docs recommended the-m mpi4pymodule form over the console scripts.This PR wraps the three entry-point targets in a new
mpisppy/entry_points.py: on an uncaught exception with world size > 1, print the traceback and callMPI.COMM_WORLD.Abort(1), replicating the mpi4py runner's behavior (the "create our own script" idea from the issue, which turned out to need no special launcher — just a ~15-line wrapper). Serial runs re-raise normally so tracebacks and exit codes are unchanged,SystemExit(argparse--help/usage errors) passes through untouched, and the no-mpi4py mock comm inmpisppy.MPI(which has noAbort) is left alone.Verified end-to-end with a two-rank probe where rank 1 raises while rank 0 waits in a barrier: bare, the job hangs until an external timeout kills it; wrapped,
MPI_ABORTfires immediately. Also smoke-testedmpiexec -n 2 mpi-sppy-one-sided-testand a 3-rank farmer run ofmpi-sppy-generic-cylinders(both clean), plus new serial unit tests for the wrapper (wired intorun_coverage.bashandtest_pr_and_main.yml).Docs: the issue's other half (prefer
python -m mpi4pyin docs/examples) was mostly done in #803 — 17 of 20mpiexec ... pythondoc invocations already used it. This PR converts the two genuine stragglers (debug_utils.rst, the L-shaped example ingeneric_cylinders.rst) and updates the notes that steered users away from the console scripts for multi-rank runs, since both forms are now equally safe.🤖 Generated with Claude Code