← Back to Pull requests

Add `Communicator::abort()` to notify all ranks of an unrecoverable error #1348

Open
unknown opened this pull request with 587 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 26, 2026 16:28 UTC
Author

When an operation fails on one rank, e.g., a collective that raised an exception (see https://github.com/rapidsai/rapidsmpf/issues/1259 and https://github.com/rapidsai/rapidsmpf/pull/1347), the other ranks may wait forever for messages that will never arrive. Communicator::abort(reason, terminate=false) (Python: Communicator.abort()) marks the communicator as aborted on this rank and notifies the other ranks, best effort, which mark it as aborted too. From then on, communication through the communicator throws communicator_aborted (Python: rapidsmpf.error.CommunicatorAborted, see https://github.com/rapidsai/rapidsmpf/pull/1327), including from the operations waiting on it: the shuffler and the collectives check the abort on every iteration of their progress function, so every rank gets an exception it can handle.

  • The other ranks are notified with a message on a reserved tag with MPI (see below), and with a control message with UCXX. Single has no other ranks.

  • After a failed operation, this rank has usually aborted the communicator already, by destroying the operation's in-flight futures (see https://github.com/rapidsai/rapidsmpf/pull/1327). abort() then still notifies the other ranks, unless they were notified already or another rank aborted the communicator, which notified them. Without abort(), such an abort is notified the first time throw_if_aborted() observes it, since a destructor cannot notify.

  • Each rank only records the first abort reason it receives, so the reason passed to abort() is best effort. It is always printed to stderr.

  • With terminate=true, the processes of all ranks are terminated instead, without unwinding: MPI_Abort() with MPI, and every rank terminating upon receiving the abort message with UCXX. The other ranks are not notified cooperatively first, so that they don't start unwinding.

  • Receiving notifications: MPI::poll_abort() probes for them every 16 calls of throw_if_aborted(). With UCXX, the worker's progress thread receives them, and in polling mode UCXX::poll_abort() progresses the worker every 16 calls.

  • MPI::wait() and wait_all() test instead of blocking, so that they fail once aborted.
  • throw_if_aborted() is now public, since the operations call it. The new protected poll_abort(), notify_abort() and mark_aborted() have default implementations, so there is no breaking change: backends that don't override them only abort locally.

    RapidsMPF never calls abort() itself: errors are reported as exceptions, and it is up to the application to decide whether an error is recoverable or whether the communicator must be aborted.

    MPI abort notifications use the largest MPI tag. The other ranks are notified with a message on MPI_TAG_UB of the user's communicator. If it lies above the range of rapidsmpf's Tag (2^23 - 1, a 20-bit OpID and a 3-bit stage), as with Open MPI's default ob1 PML (2^31 - 1),
    this is invisible to rapidsmpf users. If it doesn't, e.g., with OpenMPI's UCX PML, where MPI_TAG_UB is exactly 2^23 - 1, the largest Tag (the last stage of the largest OpID) is reserved for the notifications, and MPI sends and receives on it throw std::invalid_argument. Notifications that are never received stay unmatched on the communicator, where an application using MPI_TAG_UB or MPI_ANY_TAG on the same communicator could receive them.

    This is open for discussion. Alternatives considered:

  • Notify over a dedicated, duplicated MPI communicator, on which any tag can be used, so no Tag is reserved. However, MPI_Comm_dup is collective, which would make constructing rapidsmpf::MPI collective, and the duplicate must be freed while MPI is still usable.

  • Shrink the range of Tag by one bit when MPI_TAG_UB has no headroom. That changes the limits of OpID/StageID depending on the MPI configuration, which is surprising, and affects all backends.

  • Don't propagate aborts when no tag is available. A rank that aborts then only logs that its peers are not notified, and they may hang.
  • Tests check that operations throw once aborted, also unfinished ones without pending communication, and that aborts reach all ranks with MPI and UCXX: an explicit abort, an abort caused by destroying in-flight communication, and abort() after such an abort, with no other check that would notify the peers. In Python, child processes check cooperative aborts and termination with UCXX and Single, and an MPI test checks propagation.

    Closes #1259 .

    Note for reviewers: depends on https://github.com/rapidsai/rapidsmpf/pull/1347 and the only novel change is https://github.com/rapidsai/rapidsmpf/commit/385909107c48270ed9745fe97c6c06a96dd8a113 .

    Diff: 587 lines (+440 / -147) across 7 files Reviewer: wence- Review duration: 7272m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 587 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.382
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1348"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 49.9% (MEDIUM) · Higher = larger blast radius
    49.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.6% · Safe to merge
    26.6%