Skip to content

[https://nvbugs/6503293][fix] Restore whole-node GPU visibility for default packing - #16893

Merged
zongfeijing merged 1 commit into
NVIDIA:mainfrom
JacobHu-NV:fix/nvbug6503293-tep-gpu-visibility
Jul 28, 2026
Merged

[https://nvbugs/6503293][fix] Restore whole-node GPU visibility for default packing#16893
zongfeijing merged 1 commit into
NVIDIA:mainfrom
JacobHu-NV:fix/nvbug6503293-tep-gpu-visibility

Conversation

@JacobHu-NV

@JacobHu-NV JacobHu-NV commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This pull request updates the logic for setting CUDA_VISIBLE_DEVICES in the Slurm-based benchmarking scripts to better support both default and compact GPU packing modes. The main improvement is that, in default packing mode, each worker is now exposed to the node’s full list of GPUs, which is necessary for certain intra-node communication patterns. The change also ensures that the appropriate GPU list is passed from submit.py to start_worker.sh.

GPU device visibility and environment variable handling:

  • In start_worker.sh, the script now accepts a cuda_devices argument and sets CUDA_VISIBLE_DEVICES to this value in default packing mode, rather than just using SLURM_LOCALID. This exposes the full node GPU list to each worker, which is required for intra-node tensor parallelism with custom all-reduce operations. [1] [2]

Job submission and argument propagation:

  • In submit.py, the script constructs the correct cuda_devices string (a comma-separated list of GPU IDs) for default packing and passes it as an argument to start_worker.sh. In compact packing mode, it sets cuda_devices to "none" as the GPU mapping is handled differently. [1] [2]

Documentation and code comments:

  • Updated and clarified comments in both scripts to explain the rationale for exposing all GPUs per node in default packing and the requirements for different parallelism strategies. [1] [2]

These changes improve the flexibility and correctness of GPU assignment in multi-GPU, multi-node training scenarios.

Dev Engineer Review

  • Restores full-node CUDA_VISIBLE_DEVICES visibility for default GPU packing, enabling intra-node tensor parallelism and custom all-reduce topology checks.
  • Preserves compact packing behavior by passing "none" and retaining the existing GPU-map-based assignment.
  • The new positional argument is consistently passed from submit.py to start_worker.sh, with rank-to-device binding still handled through mapping.local_rank.
  • No configuration, test-list, or test-code changes were made.

QA Engineer Review

No test changes.

…efault packing

Commit db347a9 changed the slurm benchmark workers so each rank only
sees a single GPU (CUDA_VISIBLE_DEVICES=SLURM_LOCALID) in the default,
non-compact packing path. That is safe for DEP (enable_attention_dp=true),
which has no intra-node TP all-reduce, but it breaks TEP
(enable_attention_dp=false): the custom all-reduce topology check calls
cudaDeviceCanAccessPeer() over the node-local ranks, and with only one
visible device the peer ordinals are invalid, so every rank aborts at
executor initialization with

  CUDA runtime error in cudaDeviceCanAccessPeer(...): invalid device
  ordinal (tensorrt_llm/thop/allreduceOp.cpp)

before any KV-cache transfer happens. Restricting visibility to one GPU
also collapses the auto-detected gpus_per_node to 1.

Restore the pre-db347a94847 behaviour for default packing only: submit.py
computes the node's full GPU list again and passes it to start_worker.sh,
which exports it as CUDA_VISIBLE_DEVICES. Each rank still binds to its own
device through mapping.local_rank (= rank % gpus_per_node). The compact
packing path, added for non-divisible EP, is unchanged and keeps deriving
CUDA_VISIBLE_DEVICES from the per-worker gpu_map.

Verified on GB200 with qwen3-235b-fp4 tep4 (tp4 + ep4,
enable_attention_dp=false): before the fix all 4 gen ranks crashed at
executor init; after it gpus_per_node is detected as 4, the worker serves,
and greedy generation returns correct output. A dry run confirms the
compact path still emits its hostfile/gpu_map unchanged.

Signed-off-by: JacobHu-NV <266902545+JacobHu-NV@users.noreply.github.com>
@JacobHu-NV
JacobHu-NV force-pushed the fix/nvbug6503293-tep-gpu-visibility branch from 3fd3be7 to aa28471 Compare July 27, 2026 07:37
@JacobHu-NV
JacobHu-NV marked this pull request as ready for review July 27, 2026 07:42
@JacobHu-NV
JacobHu-NV requested review from a team as code owners July 27, 2026 07:42
@JacobHu-NV

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

CUDA device propagation

Layer / File(s) Summary
Compute and pass CUDA devices
examples/disaggregated/slurm/benchmark/submit.py
submit.py derives cuda_devices for compact and non-compact packing and passes it to start_worker.sh through srun.
Apply worker CUDA visibility
examples/disaggregated/slurm/benchmark/start_worker.sh
start_worker.sh reads the ninth argument and uses it for CUDA_VISIBLE_DEVICES when no GPU map file exists, with expanded selection documentation.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant submit.py
  participant srun
  participant start_worker.sh
  submit.py->>submit.py: Derive cuda_devices
  submit.py->>srun: Pass cuda_devices
  srun->>start_worker.sh: Provide ninth argument
  start_worker.sh->>start_worker.sh: Set CUDA_VISIBLE_DEVICES
Loading

Possibly related PRs

Suggested reviewers: bowenfu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR's main fix and follows the required [ticket][type] format.
Description check ✅ Passed The description covers the issue, solution, and affected scripts; only the non-critical test coverage and checklist sections are missing.
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: 2

🤖 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 `@examples/disaggregated/slurm/benchmark/start_worker.sh`:
- Line 14: Add the repository-standard NVIDIA copyright header immediately after
the shebang in start_worker.sh, using the current copyright year and preserving
the existing script content.

In `@examples/disaggregated/slurm/benchmark/submit.py`:
- Around line 635-640: Update the GPU visibility construction near node_list and
cuda_devices to use the full GPU list for each allocated node, rather than the
rank-assigned subset in allocation["nodes"].values(). Preserve whole-node
ownership semantics and ensure cuda_devices exposes every GPU on the node,
including partial and non-divisible allocations. Add coverage for both
allocation cases and the start_worker.sh full-node visibility contract.
🪄 Autofix (Beta)

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: 5e41677d-3f37-49d2-b155-0e3243fd8071

📥 Commits

Reviewing files that changed from the base of the PR and between 1dd8b97 and aa28471.

📒 Files selected for processing (2)
  • examples/disaggregated/slurm/benchmark/start_worker.sh
  • examples/disaggregated/slurm/benchmark/submit.py

Comment thread examples/disaggregated/slurm/benchmark/start_worker.sh
Comment thread examples/disaggregated/slurm/benchmark/submit.py
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61856 [ run ] triggered by Bot. Commit: aa28471 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61856 [ run ] completed with state SUCCESS. Commit: aa28471
/LLM/main/L0_MergeRequest_PR pipeline #50050 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@JacobHu-NV

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61925 [ run ] triggered by Bot. Commit: aa28471 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #61925 [ run ] completed with state SUCCESS. Commit: aa28471
/LLM/main/L0_MergeRequest_PR pipeline #50116 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@JacobHu-NV

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62071 [ run ] triggered by Bot. Commit: aa28471 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #62071 [ run ] completed with state SUCCESS. Commit: aa28471
/LLM/main/L0_MergeRequest_PR pipeline #50255 completed with status: 'SUCCESS'

CI Report

Link to invocation

@zongfeijing
zongfeijing merged commit c82ae76 into NVIDIA:main Jul 28, 2026
11 checks passed
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.

5 participants