Skip to content

[https://nvbugs/6561777][fix] Add slurm_wait_all_ranks(), a job+step-keyed marker barrier counting… - #17370

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

[https://nvbugs/6561777][fix] Add slurm_wait_all_ranks(), a job+step-keyed marker barrier counting…#17370
trtllm-agent wants to merge 1 commit into
NVIDIA:mainfrom
tensorrt-cicd:repair-bot-bug6561777

Conversation

@trtllm-agent

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

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause: slurm_install.sh's only install lock lives on the per-step tmpfs /tmp, so it is node-local; one node reaches eval $pytestCommand while another still installs, and the pmix 300s fence timeout then aborts all 8 ranks instead of merely running late.
  • Fix: Add slurm_wait_all_ranks(), a job+step-keyed marker barrier counting SLURM_NTASKS rank markers on the shared $jobWorkspace, placed after the SLURM_*-wipe block so single-node/disagg paths stay a 0s no-op; also remove this bug's own waiver line.
  • Original test: pytest tests/integration/defs/accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[latency_adp_lmtp] -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() with job- and step-specific markers in the shared $jobWorkspace.
  • The barrier applies only to multi-rank jobs with a shared workspace.
  • The barrier waits for all SLURM_NTASKS markers and times out after 3600 seconds.
  • Rank 0 logs barrier progress.
  • The barrier placement preserves no-op behavior for single-node and disaggregated paths.
  • The implementation addresses asynchronous pytest startup caused by node-local installation locks.
  • Review should verify marker cleanup and shell error handling for stale markers and interrupted jobs.
  • Removed the waiver for accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[latency_adp_lmtp].
  • The waiver references nvbugs/6561777; the entry format and test path are valid based on the change summary.
  • No public or exported declarations changed.

QA Engineer Review

  • Modified test-list file: tests/integration/test_lists/waives.txt.
  • Removed the waiver for accuracy/test_llm_api_pytorch.py::TestDeepSeekR1::test_nvfp4_multi_gpus[latency_adp_lmtp].
  • No test-db or qa files were modified.
  • The test is now eligible to run through the normal test selection.
  • Verdict: needs follow-up because CBTS coverage data is unavailable.

TestDeepSeekR1::test_nvfp4_multi_gpus[latency_adp_lmtp] is the fourth test row
attributed to a single multi-node launch defect, alongside nvbugs/6541343,
6561775 and 6561778 -- all from build 2885 on the same GB200 8-GPU 2-node
stage family, all reporting the same "Test terminated unexpectedly" with no
traceback. That string is synthesized, not a crash: generate_timeout_xml.py
fabricates a testcase with it for every nodeid left in unfinished_test.txt, so
it only means the srun step was killed while the test was in flight.

The only install lock lives under $resourcePathNode (/tmp) in slurm_install.sh.
In a pyxis container /tmp is a per-step tmpfs, so that lock is node-local: its
wait loop fences just the $SLURM_LOCALID peers on the same node, and 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 then die between pytest
setup and teardown, which is what leaves the nodeid in unfinished_test.txt.
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. This is the same change already proposed for nvbugs/6541343; it is
carried here byte-identically so whichever lands first makes the other a no-op.

This variant's ISOLATION marker in l0_gb200_multi_nodes.yml does not change any
of the above: runIsolatedTests is only reachable from
runLLMTestlistOnPlatformImpl, the Docker path, so on the Slurm path the marker
is merely stripped and the test shares one slurm_run.sh pytest with its shard.

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 full marker
set releases at 0s; markers from another job, from an earlier step of the same
job, and a dead rank each fail bounded with rc=1 through the ERR trap. On a live
2-node 8-rank pmix launch with rank 7 delayed 20s, ranks on both hosts blocked
20-30s and every rank agreed on the same SLURM_STEP_ID, showing the fence
crosses the node boundary; with no delay all 8 released within one poll
interval. Also un-waive the test, whose body was already healthy.

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

Changes

Slurm CI execution

Layer / File(s) Summary
Multi-rank readiness barrier
jenkins/scripts/slurm_run.sh
Multi-rank jobs with a shared workspace create readiness markers and wait for all ranks before pytest. Single-rank and unset-workspace runs bypass the barrier.
DeepSeek R1 test activation
tests/integration/test_lists/waives.txt
The waiver for the DeepSeek R1 NVFP4 multi-GPU latency ADP/LMTP test is removed.

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

Sequence Diagram(s)

sequenceDiagram
  participant SlurmRank as Slurm rank
  participant SharedWorkspace as Shared jobWorkspace
  participant Pytest
  SlurmRank->>SharedWorkspace: Create readiness marker
  SlurmRank->>SharedWorkspace: Wait for all rank markers
  SharedWorkspace-->>SlurmRank: Report readiness or timeout
  SlurmRank->>Pytest: Execute pytest after readiness
Loading

Possibly related PRs

Suggested labels: ci: full pre-merge approved

Suggested reviewers: bowenfu, emmaqiaoch

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required NVBugs and fix format and clearly identifies the new barrier as the primary change.
Description check ✅ Passed The description explains the root cause and fix, identifies the affected test, and documents validation and the linked bug.
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-127: Add the standard NVIDIA copyright header for 2026 at the
beginning of slurm_run.sh, before the existing script content. Do not alter the
slurm_wait_all_ranks implementation or other script behavior.
🪄 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: 2158a1a7-f8f8-4ba4-9b7f-ab6064d0c30a

📥 Commits

Reviewing files that changed from the base of the PR and between f12c5e5 and 3dd6565.

📒 Files selected for processing (2)
  • jenkins/scripts/slurm_run.sh
  • tests/integration/test_lists/waives.txt
💤 Files with no reviewable changes (1)
  • tests/integration/test_lists/waives.txt

Comment on lines +75 to +127
# The only install lock (slurm_install.sh) lives under $resourcePathNode, a per-step
# tmpfs in the pyxis container, so it fences just the $SLURM_LOCALID peers on one node
# -- nothing stops one node from reaching `eval $pytestCommand` below while another is
# still installing. Pytest's first action is `import tensorrt_llm`, whose module-scope
# MPI collective must be entered by every rank, and 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 on the shared $jobWorkspace so all
# ranks enter pytest together. Must stay below the SLURM_* unset block above, which is
# what makes this a no-op for single-node and disaggregated runs.
slurm_wait_all_ranks() {
# SLURM_NTASKS rather than a node count: this is exactly the set of ranks that
# enters the aborting collective.
local numRanks="${SLURM_NTASKS:-1}"
if [ "$numRanks" -le 1 ] || [ -z "${jobWorkspace:-}" ]; then
return 0
fi

# Keyed per job *and* per step: $jobWorkspace outlives a single step, so markers
# from another job or from an earlier step must not satisfy the count. Slurm gives
# every rank of a step the same step id, so all of them agree on this path.
local readyDir="$jobWorkspace/run_ready_job_${SLURM_JOB_ID:-local}_step_${SLURM_STEP_ID:-0}"
mkdir -p "$readyDir"
touch "$readyDir/rank_${SLURM_PROCID}.ready"

# Bounded above the 2700s pip3 retry budget in slurm_install.sh: a merely slow rank
# still releases the barrier, while a dead one fails the stage loudly instead of
# hanging until the partition walltime kills it.
local timeoutSecs=3600
local deadline=$((SECONDS + timeoutSecs))
local markers ready
while true; do
# Globbed, not `ls | wc -l`: under `set -Eeuo pipefail` a failing `ls` fires the
# ERR trap. The touch above guarantees a match, so no nullglob is needed.
markers=("$readyDir"/*.ready)
ready=${#markers[@]}
if [ "$ready" -ge "$numRanks" ]; then
return 0
fi
if [ "$SECONDS" -ge "$deadline" ]; then
echo "ERROR: rank ${SLURM_PROCID} timed out after ${timeoutSecs}s waiting for" \
"all $numRanks ranks to be ready; ready: $ready/$numRanks"
return 1
fi
# One rank reports progress; all of them would spam the log every 10s.
if [ "$SLURM_PROCID" -eq 0 ]; then
echo "(Waiting for all $numRanks ranks to be ready) ready: $ready/$numRanks"
fi
sleep 10
done
}

slurm_wait_all_ranks

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

header="$(sed -n '1,30p' jenkins/scripts/slurm_run.sh)"
printf '%s\n' "$header"

if ! printf '%s\n' "$header" | rg -q 'Copyright.*(2026.*NVIDIA|NVIDIA.*2026)'; then
  echo "ERROR: jenkins/scripts/slurm_run.sh does not show an NVIDIA copyright header for 2026."
  exit 1
fi

Repository: NVIDIA/TensorRT-LLM

Length of output: 1309


Add the NVIDIA copyright header

jenkins/scripts/slurm_run.sh has no NVIDIA copyright header. Add the header with 2026.

🤖 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 - 127, Add the standard NVIDIA
copyright header for 2026 at the beginning of slurm_run.sh, before the existing
script content. Do not alter the slurm_wait_all_ranks implementation or other
script behavior.

Source: Coding guidelines

@brnguyen2 brnguyen2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving — the comments below are optional touch-ups, not blockers.

The mechanism holds up: $jobWorkspace is under /home/svc_tensorrt/bloom/scripts, which is in the container mount list (getMountListForSlurmTest), so it really is shared across nodes, and the install lock it complements is keyed ..._node_${SLURM_NODEID} on the container-local path. Placement after the SLURM_* wipe does keep single-node stages a 0s no-op. Worth noting srun --kill-on-bad-exit=1 (L0_Test.groovy:1952) already covers the dead-rank case, so the barrier only has to handle slow ranks.

Two things beyond the inline notes:

  • Scope: jenkins/scripts/perf/local/slurm_run.sh has the same structure and perf/local/slurm_install.sh has the same per-node install lock (its build lock is cross-node, the install lock isn't). Multi-node aggregated perf stages should still be able to hit this. Fine as a follow-up, but say so in the description rather than leaving it implicit.
  • Validation: the un-waived test only runs in a post-merge multi-node GB200 stage, so a plain /bot run won't exercise it. Please run that stage explicitly (--stage-list / --extra-stage) and link the result. The sibling test_nvfp4_multi_gpus[latency] waiver (nvbugs/6561778) has a similar signature — worth checking whether it clears too.

mkdir -p "$readyDir"
touch "$readyDir/rank_${SLURM_PROCID}.ready"

# Bounded above the 2700s pip3 retry budget in slurm_install.sh: a merely slow rank

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The justification doesn't hold: 2700s is the timeout of a single retry_command, and slurm_install_setup runs several in sequence (wget 1800, apt, optional ray 2700, opencv 2700, requirements-dev 2700, wheel 2700). Worst-case legal install time is well above 3600s, so a slow-but-alive node can trip the barrier and fail the stage — the outcome this change exists to prevent, just at 3600s instead of 300s.

Either derive the bound from the sum of the install steps (or the job walltime minus a margin), or keep 3600 and reword the comment to say it's a walltime-shaped backstop rather than "bounded above the retry budget".

# MPI collective must be entered by every rank, and 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 on the shared $jobWorkspace so all
# ranks enter pytest together. Must stay below the SLURM_* unset block above, which is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"no-op for ... disaggregated runs" is only true for DISAGG_SERVING_TYPE in {BENCHMARK, DISAGG_SERVER} — those are the only two values the wipe block above matches. A multi-node *Disagg* stage with the variable unset or set to a CTX_*/GEN_* role keeps SLURM_NTASKS and will actually execute the barrier. That looks harmless here (this script is launched by a single srun covering every task of the step, so SLURM_NTASKS agrees with the number of ranks reaching the barrier), but the comment as written would let a future reader assume the barrier can never run on a disagg path, which is the assumption that would break if a role-specific srun --overlap step ever sources this file.

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.

3 participants