Repository navigation
Conversation
ADIOI_LUSTRE_Exch_and_write() jumps to the function epilogue with `goto over` as soon as a write fails on the local rank. The loop it leaves contains point-to-point exchanges that every rank must take part in, and ADIOI_LUSTRE_WriteStridedColl() ends with a collective MPI_Allreduce on error_code. A failure seen by a subset of ranks therefore deadlocks the job: the failing ranks reach the Allreduce while the rest stay blocked in MPI_Waitall inside the loop. Record the first error instead of leaving immediately, agree on it with an MPI_Allreduce at the end of each iteration, and have every rank break out of the loop together. The deferred error is restored at `over:` so the caller's existing collective reduction reports it on all ranks. Reproduced with a Lustre block quota: the job hangs indefinitely where it should return MPI_ERR_IO. With this change the same run returns the error on every rank in about a second.
wkliao
reviewed
Oct 13, 2026
| * the loop at the same iteration: no deadlock, and no further | ||
| * iterations spent on writes that cannot succeed. */ | ||
| local_failed = (deferred_error != MPI_SUCCESS) ? 1 : 0; | ||
| MPI_Allreduce(&local_failed, &any_failed, 1, MPI_INT, MPI_MAX, fd->comm); |
Contributor
There was a problem hiding this comment.
This line will add max_ntimes number of calls to MPI_Allreduce(), which can be very expensive.
Collaborator
|
@sihara In order for us to accept and properly credit your contribution, could you sign the contribution license agreement http://www.mpich.org/documentation/contributor-docs/? |
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.
Pull Request Description
Fixes #7993
What this changes
Four error paths in
ADIOI_LUSTRE_Exch_and_write()didgoto over, exiting thewrite loop on a single rank. Because the loop body performs point-to-point
exchanges that every rank must take part in, and the caller ends with a
collective
MPI_Allreduceonerror_code, one rank leaving early deadlocks allthe others (see linked issue for stacks and a reproducer).
This patch:
deferred_errorinstead of jumping out;breaks on all ranks at the same iteration;
over:, so the existing post-loopMPI_Allreducereports it on every rank.Behaviour
MPI_ERR_IOon all ranksDesign note for reviewers
Step 2 adds one
MPI_Allreduceof a singleintper iteration. We have notmeasured its cost cleanly — our runs are at 512 ranks / 2242 iterations / ~9.6 TB
and this system has a ~10% run-to-run spread, so we can say only that we did not
see an effect that stands out above that, which is a weak bound. On much larger
rank counts you may prefer:
count by N), or
MPI_Iallreduceoverlapped with the following iteration.Happy to rework it either way. Without step 2 the deadlock is still fixed, but a
failed job runs to the end of the loop before reporting — on our reproducer that
was 1757 further iterations.
Testing
Reproduced and fixed on stock MPICH 5.0.2, built from the release tarball
with
--with-file-system=lustre+ufs, against Lustre 2.14.0 (ldiskfs, 8 OSTs).Reproducer:
romio_quota_deadlock.c(attached in the issue) — ~60 lines, noIOR needed, 2 client nodes. Ranks are interleaved in the file to force
two-phase collective buffering, then a single
MPI_File_write_allis issuedwhile the user's block quota is exhausted partway.
patch -p1applies cleanly to 5.0.2;makeandmake installboth exit 0.The same four
goto overstatements and the post-loopMPI_Allreducearepresent and identical on
main(595/634/649/654 and 323), so the patch isoffered against
main.Note one trap for anyone reproducing: the access pattern must be interleaved.
With each rank writing a single contiguous region, ROMIO takes
ADIOI_LUSTRE_IOCONTIGand never enters the affected code path.Separately, this was originally found at scale on OpenMPI 5.0.9's vendored
romio341 (a MPICH 3.4.1 snapshot) with IOR ior-hard on 512 ranks, where 54 ranks
took the error exit and 458 blocked in
MPI_Waitall.Author Checklist
Particularly focus on why, not what. Reference background, issues, test failures, xfail entries, etc.
Commits are self-contained and do not do two things at once.
Commit message is of the form:
module: short descriptionCommit message explains what's in the commit.
Whitespace checker. Warnings test. Additional tests via comments.
For non-Argonne authors, check contribution agreement.
If necessary, request an explicit comment from your companies PR approval manager.