Skip to content

nixlbench: limit Neuron core allocation in SG mode for multi-processing#1913

Open
fengjica wants to merge 1 commit into
ai-dynamo:mainfrom
fengjica:dev/fix_nrt_core_alloc
Open

nixlbench: limit Neuron core allocation in SG mode for multi-processing#1913
fengjica wants to merge 1 commit into
ai-dynamo:mainfrom
fengjica:dev/fix_nrt_core_alloc

Conversation

@fengjica

@fengjica fengjica commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

On Neuron instances, nrt_init() claims all visible Neuron cores by default. When testing multiple nixlbench processes in SG pairwise mode (one process per device), each process tries to claim all cores, causing "Logical Neuron Core(s) not available" failures for all but the first process.

Set NEURON_RT_NUM_CORES=1 before nrt_init() in SG mode so each process only reserves one core.

MG mode is unaffected (single process per host, claims all cores).

What?

Fix nixlbench multiprocessing with neruon runtime.

Why?

Without the fix, nixlbench multiprocessing (SG mode) would fail.

How?

Set NEURON_RT_NUM_CORES = 1, before nrt_init().
Tested with trn2.48xlarge instance.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Neuron runtime initialization in SG mode by automatically setting the core count when core-related environment variables aren’t provided.
    • Corrected device memory allocation to use the appropriate accelerator/VNC index for SG vs non-SG execution, improving consistency for single-GPU/SG runs.

@fengjica fengjica requested review from a team, aranadive, brminich and ovidiusm as code owners July 8, 2026 19:45
@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

👋 Hi fengjica! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change updates benchmark/nixlbench/src/utils/neuron.cpp to configure Neuron core usage in SG mode and select the tensor allocation VNC index from the execution mode.

Changes

Neuron core allocation changes

Layer / File(s) Summary
Core scoping and VNC index selection
benchmark/nixlbench/src/utils/neuron.cpp
Adds utils.h and <cstdlib> includes; neuronCoreCount() conditionally sets NEURON_RT_NUM_CORES to "1" in SG mode when unset and logs configured environment values otherwise; neuronMalloc() passes VNC index 0 in SG mode or devid otherwise to nrt_tensor_allocate.

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

Suggested reviewers: brminich

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the Neuron SG-mode core-allocation fix for nixlbench multiprocessing.
Description check ✅ Passed The description follows the template with What/Why/How and explains the SG-mode Neuron fix and testing.
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.

@fengjica fengjica force-pushed the dev/fix_nrt_core_alloc branch from c42c358 to 74a44d8 Compare July 8, 2026 20:39
@ovidiusm

ovidiusm commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

/build

@svc-nixl

svc-nixl commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

👀 Investigating nixl-ci-dl-gpu-ep build 208

@svc-nixl

svc-nixl commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

🤖 CI Triage Agentnixl-ci-dl-gpu-ep · commit fca97360

I have clear evidence now. The build stages succeeded; the failing stages (183 and 200 - "Allocate DL EP Environment") failed at Slurm resource allocation. Let me confirm the timing to distinguish hang vs. genuine wait.

Looking at the log for stage 200:

  • 10:28:10.064Zssh ... salloc ... --immediate=3600 --time=01:30:00
  • 11:28:18.783Zsalloc: error: Unable to allocate resources: Connection timed out

That's exactly ~1 hour (3600s) between the salloc invocation and the timeout error. The --immediate=3600 flag tells Slurm to wait up to 3600 seconds for resources before giving up. The job was queued and waiting for resources the entire time, then failed with Unable to allocate resources: Connection timed out.

This is not a hang in nixl code, and not a code defect at all. The build of NIXL + UCX + nixlbench all completed successfully (stages 159, 162 succeeded). Both allocation attempts (v1.22.x → job 1507450, and master → job 1507420) sat in the Slurm queue for the full immediate-timeout window on partition gb200nvl72_cx8 and were never granted GB200 nodes.

The earlier stage failures (124/125 build_helper_dl_ep/.../ucx-*) were retried and succeeded (stages 142/149), so they are not the root cause of the overall build failure.

Summary: The nixl-ci-dl-gpu-ep #208 build failed in the "Allocate DL EP Environment" stages (node IDs 183 and 200) — the Slurm salloc for GB200 nodes never got resources and timed out after the 1-hour immediate window.

Root cause: Infrastructure/capacity, not a code defect. Both allocation attempts ran salloc -N 1 -p gb200nvl72_cx8 --immediate=3600 --time=01:30:00 --no-shell --account=blackwell against dlcluster.nvidia.com. The jobs (1507450 for ucx-v1.22.x, 1507420 for master) were queued and waiting for resources and after exactly ~3600s failed with salloc: error: Unable to allocate resources: Connection timed out. The GB200 gb200nvl72_cx8 partition had no free nodes within the immediate-allocation window. All actual NIXL/UCX/nixlbench compilation and Docker image build/push steps succeeded beforehand. This is a legitimate wait that hit its configured cap (the process was making no progress only because the cluster was full — not because any nixl process hung), so this is a capacity/queue-time limit, not a hung application.

Implicated commit: unknown — not code-related. The build for commit [REDACTED:Hex High Entropy String] compiled cleanly; failure is in cluster resource allocation.

File: The Jenkins pipeline SLURM allocation step (swx-jenkins-lib slurm.allocation, invoked as "Allocate DL EP Environment"). No repository source file is implicated.

Suggested fix:

  • Re-run the job — this is a transient cluster-capacity failure on the gb200nvl72_cx8 partition (GB200 nodes were saturated for the full hour).
  • If GB200 queue contention is recurrent, consider: raising immediateTimeout / switching from --immediate to a bounded queued wait, adding retry-with-backoff around the salloc step, or reserving/quota-guaranteeing capacity for CI on the blackwell account.
  • Do not treat this as a code bug or bump any per-test timeout — the compilation and image build all passed; only node allocation failed.

Related: none found (no code issue to correlate; failure is Slurm allocation Unable to allocate resources: Connection timed out).

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 889bbed6-d005-4872-9f2a-1fdc4b55a332 in the triage console for the audit trail.

Comment thread benchmark/nixlbench/src/utils/neuron.cpp Outdated
@svc-nixl

Copy link
Copy Markdown
Collaborator

🤖 CI Triage AgentClang Format Check · commit 9d21ceef

TL;DR: The "Clang Format Check" failed because benchmark/nixlbench/src/utils/neuron.cpp contains a std::cerr log statement (added in this PR) whose manual line-wrapping doesn't match the repo's clang-format style; run clang-format-19 on the file and commit the result.

Full analysis

Summary: GitHub Actions clang-format job exited with code 1 — clang-format-diff-19 reported formatting violations in the PR's changes to neuron.cpp.

Root cause: The newly added std::cerr << "nixlbench: NEURON_RT_VISIBLE_CORES ..." statement in the else if (visible_cores) branch is manually split across 4 lines, but the .clang-format style collapses it to 2 lines (each within the column limit). Since the formatted output differs from the committed code, clang-format-diff-19 returns a non-empty diff and the step fails. This is a real style violation, not a hang or timeout — the whole job ran in ~16s with continuous output.

Implicated commit: [REDACTED:Hex High Entropy String] (PR #1913, branch dev/fix_nrt_core_alloc) — the merge commit is 0b055c9.

File: benchmark/nixlbench/src/utils/neuron.cpp (the std::cerr block in the else if (visible_cores) branch, ~lines 155–160 in the PR diff)

Suggested fix: Reformat the file locally and commit the result:

clang-format-19 -i -style=file benchmark/nixlbench/src/utils/neuron.cpp

The expected result matches what CI proposed:

std::cerr << "nixlbench: NEURON_RT_VISIBLE_CORES is set to \"" << visible_cores
          << "\" but SG mode uses only the first core (vnc=0)" << std::endl;

Then git add + commit + push to re-trigger the check.

Related: none

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 73560885-f090-4ae6-987c-e27c22333c01 in the triage console for the audit trail.

@fengjica fengjica force-pushed the dev/fix_nrt_core_alloc branch from 48faf8b to b618855 Compare July 15, 2026 21:06

@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 `@benchmark/nixlbench/src/utils/neuron.cpp`:
- Around line 160-163: Run clang-format-19 in place on the file containing the
NEURON_RT_VISIBLE_CORES warning, ensuring the stream expression in the neuron
utility is reformatted to the repository’s expected layout. Commit the resulting
formatting-only change.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: 3f2b97d6-75de-4d70-9c42-56bc9af322b4

📥 Commits

Reviewing files that changed from the base of the PR and between 74a44d8 and 48faf8b.

📒 Files selected for processing (1)
  • benchmark/nixlbench/src/utils/neuron.cpp

Comment thread benchmark/nixlbench/src/utils/neuron.cpp Outdated

@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 `@benchmark/nixlbench/src/utils/neuron.cpp`:
- Around line 155-158: Check the return value of setenv in the SG-mode branch
before printing the success message or proceeding to nrt_init. On failure,
report the error and abort initialization; only log that NEURON_RT_NUM_CORES was
set when setenv succeeds.
- Around line 152-165: Update the SG core-handling condition in neuron.cpp to
use IS_PAIRWISE_AND_SG() instead of checking xferBenchConfig::mode alone. Keep
the existing environment-variable setup and warning behavior unchanged, but
ensure it runs only for pairwise SG configurations.
🪄 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: ASSERTIVE

Plan: Enterprise

Run ID: 98fba73b-3d01-4abe-9c5e-d964c60760c8

📥 Commits

Reviewing files that changed from the base of the PR and between 48faf8b and b618855.

📒 Files selected for processing (1)
  • benchmark/nixlbench/src/utils/neuron.cpp

Comment on lines +152 to +165
if (XFERBENCH_MODE_SG == xferBenchConfig::mode) {
const char *num_cores = getenv("NEURON_RT_NUM_CORES");
const char *visible_cores = getenv("NEURON_RT_VISIBLE_CORES");
if (!num_cores && !visible_cores) {
setenv("NEURON_RT_NUM_CORES", "1", 0);
std::cerr << "nixlbench: SG mode — set NEURON_RT_NUM_CORES=1"
<< std::endl;
} else if (visible_cores) {
std::cerr << "nixlbench: NEURON_RT_VISIBLE_CORES is set to \""
<< visible_cores
<< "\" but SG mode uses only the first core (vnc=0)"
<< std::endl;
}
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Gate SG core handling on pairwise SG
Use IS_PAIRWISE_AND_SG() here instead of checking xferBenchConfig::mode alone; otherwise non-pairwise SG runs still get forced to NEURON_RT_NUM_CORES=1 and vnc=0.

🧰 Tools
🪛 GitHub Actions: Clang Format Check / 0_clang-format.txt

[error] 154-160: clang-format check failed for modified C/C++ file. clang-format-diff-19 -p1 -style=file -v detected formatting differences (std::cerr output stream formatting/line wrapping).

🪛 GitHub Actions: Clang Format Check / clang-format

[error] 154-157: clang-format-diff-19 reported formatting differences (C/C++ formatting check failed). Run clang-format to apply the suggested changes.


[error] 159-164: clang-format-diff-19 reported formatting differences (C/C++ formatting check failed). The affected std::cerr statement formatting needs to match clang-format output.

🤖 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 `@benchmark/nixlbench/src/utils/neuron.cpp` around lines 152 - 165, Update the
SG core-handling condition in neuron.cpp to use IS_PAIRWISE_AND_SG() instead of
checking xferBenchConfig::mode alone. Keep the existing environment-variable
setup and warning behavior unchanged, but ensure it runs only for pairwise SG
configurations.

Comment thread benchmark/nixlbench/src/utils/neuron.cpp Outdated
@fengjica fengjica force-pushed the dev/fix_nrt_core_alloc branch from b618855 to da85dd0 Compare July 15, 2026 21:17
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jul 15, 2026
@svc-nixl

Copy link
Copy Markdown
Collaborator

🤖 CI Triage AgentClang Format Check · commit da85dd09

TL;DR: The Clang Format Check failed because benchmark/nixlbench/src/utils/neuron.cpp has lines that violate the repo's clang-format-19 style; the two multi-line std::cerr statements around line 154 need to be reformatted (run clang-format-19 on the file and commit the result).

Full analysis

Summary: clang-format-diff-19 found formatting violations in benchmark/nixlbench/src/utils/neuron.cpp, causing the job to exit with code 1.

Root cause: The PR (#1913) modified neuron.cpp with std::cerr chained-<< statements that were manually wrapped across multiple lines. clang-format-19 (style=file, i.e. the repo's .clang-format) wants those << std::endl continuations collapsed onto the preceding line (they fit within the column limit). The diff shows clang-format would rewrite:

std::cerr << "nixlbench: SG mode — set NEURON_RT_NUM_CORES=1"
          << std::endl;

to a single line ending in << std::endl;, and similarly join the NEURON_RT_NUM_CORES= and (visible_cores ? ...) continuations. Because the committed formatting differs from clang-format's output, the check fails. This is a genuine lint failure — the log ran continuously through to the error with no gaps, so it is not a timeout/hang.

Implicated commit: [REDACTED:Hex High Entropy String] (PR #1913, branch dev/fix_nrt_core_alloc) — the change that added/modified the std::cerr diagnostics in neuron.cpp.

File: benchmark/nixlbench/src/utils/neuron.cpp:154-166 (the SG-mode std::cerr diagnostics block)

Suggested fix: Run the repository's formatter locally on the changed file and commit the result:

clang-format-19 -style=file -i benchmark/nixlbench/src/utils/neuron.cpp
git add benchmark/nixlbench/src/utils/neuron.cpp && git commit --amend --no-edit

Concretely, collapse the wrapped std::cerr chains so each << std::endl; stays on the line where it fits within the configured column limit, matching the "after formatting" block shown in the log. No source logic change is needed — this is purely whitespace/line-wrapping.

Related: none found.

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id f9f247e9-6475-472c-aa52-74c2fbf3d7f4 in the triage console for the audit trail.

@fengjica fengjica force-pushed the dev/fix_nrt_core_alloc branch from da85dd0 to e7a3114 Compare July 15, 2026 21:19
@pull-request-size pull-request-size Bot added size/S and removed size/M labels Jul 15, 2026
On Neuron instances, nrt_init() claims all visible Neuron cores by
default. When testing multiple nixlbench processes in
SG pairwise mode (one per device), each process tries to claim all
cores, causing "Logical Neuron Core(s) not available" failures for all
but the first process.

Set NEURON_RT_NUM_CORES=1 before nrt_init() in SG mode so each process
only reserves one core.

MG mode is unaffected (single process per host, claims all cores).
@fengjica fengjica force-pushed the dev/fix_nrt_core_alloc branch from e7a3114 to efd9672 Compare July 15, 2026 21:30
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jul 15, 2026
@fengjica fengjica requested a review from oa-aws July 15, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants