Skip to content

[https://nvbugs/6541343][fix] Add slurm_wait_all_ranks() — a job+step-keyed marker barrier on the shared… - #17367

Open
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6541343
Open

[https://nvbugs/6541343][fix] Add slurm_wait_all_ranks() — a job+step-keyed marker barrier on the shared…#17367
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6541343

Conversation

@trtllm-agent

@trtllm-agent trtllm-agent commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: The install lock is node-local ($resourcePathNode=/tmp), so nothing fences ranks across nodes before pytest; the 300s PMIx fence timeout on import tensorrt_llm's module-scope MPI collective then aborts every rank when one node installs late.
  • Fix: Add slurm_wait_all_ranks() — a job+step-keyed marker barrier on the shared $jobWorkspace counting SLURM_NTASKS rank markers — immediately before eval $pytestCommand, placed after the SLURM_* wipe so single-node/disagg paths no-op.
  • Original test: pytest tests/integration/defs/accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[throughput] -v
  • Automated fix generated by repair-bot

Test plan

  • Verify fix on the same GPU type as the original failure
  • Check for regressions in related tests

Links

Dev Engineer Review

  • Added slurm_wait_all_ranks() in jenkins/scripts/slurm_run.sh.
  • The barrier uses job- and step-specific readiness markers under $jobWorkspace.
  • The barrier waits for all SLURM_NTASKS ranks before pytest starts.
  • Single-rank and workspace-less runs skip the barrier.
  • The 3600-second timeout exceeds the pip installation retry budget.
  • Rank 0 reports barrier progress.
  • Dead or missing ranks produce a clear failure instead of an indefinite wait.
  • Marker isolation prevents cross-job and cross-step synchronization.
  • The barrier runs after the SLURM_* environment reset and does not affect single-node or disaggregated paths.
  • No public or exported declarations changed.
  • No configuration or test-list files changed.

QA Engineer Review

No test changes.

The only install lock lives under $resourcePathNode (/tmp) in
slurm_install.sh, which is node-local, so its wait loop fences just the
$SLURM_LOCALID peers on the same node -- a node can never observe another
node's lock. Nothing then stops slurm_run.sh from reaching
`eval $pytestCommand` on one node while another is still installing, and the
per-rank work in between skews the ranks further: non-zero ranks cover rank
0's coverage-config write with a blind `sleep 30`, and slurm_setup_runtime_env
shells out to pip3.

Pytest's first action is `import tensorrt_llm`, whose module-scope MPI
collective must be entered by every rank. Under --mpi=pmix, which is added
exactly when nodeCount > 1, that collective has a 300s fence timeout, so a
node whose pip3 install stalls (up to the 2700s retry budget) makes the
collective abort every rank rather than merely run late. The ranks die between
pytest setup and teardown, which leaves the nodeid in unfinished_test.txt and
makes generate_timeout_xml.py synthesize the "Test terminated unexpectedly"
this bug reports -- there is no traceback for the test body. Note that
PMIX_MCA_gds=hash does not mitigate this: a fence that times out never
exchanges the modex regardless of GDS mode, and the pml_ucx errors seen
alongside it are downstream of the same missing exchange.

Add a marker barrier on the shared $jobWorkspace immediately before
`eval $pytestCommand`. It counts SLURM_NTASKS rank markers rather than nodes,
so the fenced set is exactly the set that enters the aborting collective, and
placing it after the block that wipes SLURM_* keeps it a no-op for
single-node and disaggregated benchmark/server runs, which reach it with
SLURM_NTASKS unset. The marker directory is keyed per job and per step because
$jobWorkspace outlives a step, so a later step must not be released by an
earlier one's markers. The wait is bounded above the 2700s pip3 budget so a
genuinely dead rank fails the stage with a clear message instead of hanging
until the partition walltime.

Verified by asserting elapsed seconds, since a no-op barrier also returns 0:
single rank, unset workspace and unset SLURM_NTASKS return at 0s; a peer 25s
late makes rank 0 block 30s; a dead rank fails bounded with rc=1; markers from
another job and from an earlier step of the same job both correctly time out;
all ranks concurrent release at 0s; and only rank 0 logs progress. A live
2-node 8-rank probe with rank 7 delayed 20s converged every rank on both nodes
at 20-30s. The target test then passed end to end on a 2-node 8-rank pmix
launch (1 passed, 399.82s) with no PMIx fence errors, reaching all three
accuracy phases: GSM8K 94.845 against a 92.217 threshold and CnnDailymail
rouge1 30.240 against 26.716.

Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The Slurm runner adds a shared barrier before pytest. Each rank writes a readiness marker in a job- and step-specific workspace directory. Rank 0 reports progress. The barrier bypasses single-rank or workspace-less runs and times out after 3600 seconds.

Changes

Slurm barrier

Layer / File(s) Summary
Readiness barrier before pytest
jenkins/scripts/slurm_run.sh
Adds slurm_wait_all_ranks, which coordinates ranks through shared readiness markers, reports progress from rank 0, skips unsupported runs, and enforces a 3600-second timeout before pytest execution.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SlurmRank
  participant JobWorkspace
  participant Pytest
  SlurmRank->>JobWorkspace: Create rank readiness marker
  SlurmRank->>JobWorkspace: Wait for all configured rank markers
  JobWorkspace-->>SlurmRank: Return readiness progress
  SlurmRank->>Pytest: Start pytest after barrier
Loading

Suggested reviewers: bowenfu, dpitman-nvda

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the required NVBugs and fix format and clearly identifies the new Slurm barrier.
Description check ✅ Passed The description explains the root cause and fix, identifies testing, and links the bug; the required information is mostly complete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@jenkins/scripts/slurm_run.sh`:
- Around line 75-85: Add the standard NVIDIA copyright header to the top of
slurm_run.sh, using 2026 as the latest modification year. Preserve the existing
script content and behavior unchanged.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 87e29a98-56b2-458d-aa3f-d764e78df970

📥 Commits

Reviewing files that changed from the base of the PR and between 1745a6e and 01809cd.

📒 Files selected for processing (1)
  • jenkins/scripts/slurm_run.sh

Comment on lines +75 to +85
# The install lock in slurm_install.sh lives under $resourcePathNode (/tmp), so it
# is node-local: its wait loop only fences $SLURM_LOCALID peers on the same node,
# and a node can never observe another node's lock. Nothing else stops one node
# from reaching `eval $pytestCommand` below while another is still installing, and
# the per-rank work above skews the ranks further (non-zero ranks cover the
# coverage-config write with a blind `sleep 30`, and slurm_setup_runtime_env shells
# out to pip3). Pytest's first action is `import tensorrt_llm`, whose module-scope
# MPI collective must be entered by every rank; under --mpi=pmix -- added exactly
# when nodeCount > 1 -- that collective has a 300s fence timeout, so the skew
# aborts every rank instead of merely running late. Fence every rank on the shared
# $jobWorkspace so they enter pytest together.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,25p' jenkins/scripts/slurm_run.sh

Repository: NVIDIA/TensorRT-LLM

Length of output: 1013


Add the NVIDIA copyright header

jenkins/scripts/slurm_run.sh has no NVIDIA copyright header. Add the header with 2026 as the latest modification year.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@jenkins/scripts/slurm_run.sh` around lines 75 - 85, Add the standard NVIDIA
copyright header to the top of slurm_run.sh, using 2026 as the latest
modification year. Preserve the existing script content and behavior unchanged.

Source: Coding guidelines

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants