Skip to content

feat(ray): support a dedicated gpu-free head node - #3388

Merged
terrykong merged 2 commits into
mainfrom
amahishi/dedicated-ray-head
Aug 4, 2026
Merged

terrykong merged 2 commits into
mainfrom
amahishi/dedicated-ray-head

Conversation

@macandro96

Copy link
Copy Markdown
Contributor

What does this PR do ?

Allow the Ray head to run as a control-plane-only node by advertising zero GPUs and excluding it from worker-unit accounting. Can be switched on setting DEDICATED_RAY_HEAD=1 on in env.

Issues

List issues that this PR closes (syntax):

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

@macandro96
macandro96 requested a review from a team as a code owner July 28, 2026 22:18
@copy-pr-bot

copy-pr-bot Bot commented Jul 28, 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.

@macandro96 macandro96 added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Jul 28, 2026

@terrykong terrykong 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.

Reviewed by an agent team (4 agents: RL/infra expert, bug finder, design reviewer, plus an adversarial pass). Useful feature — the 0|1 validation and the NUM_RAY_GPU_NODES <= 0 guard are good fail-loud practice, and the core mechanism holds up.

Things we checked and found correct, so they don't need defending:

  • Heredoc escaping of the new RAY_RESOURCES override — reproduced the full EOF -> EOFINNER -> bash chain against a ray argv stub; both modes emit valid JSON, at the same escaping level as the existing topology_probe.sh path.
  • --num-gpus=0 semantics, verified against Ray 2.47 resource_spec.py — autodetect is skipped and the zero-valued GPU key is dropped, so the head's --gres can't leak back in.
  • NUM_ACTORS accounting matches the workers actually launched (_num_workers = N-1) in both modes.
  • ray status | grep worker_units | awk still parses correctly when only workers carry the resource.
  • Dropping worker_units/topo_rank/nvlink_domain_* from the head breaks nothing on the Python side — select_segment_nodes already skips NVLINK_DOMAIN_UNKNOWN, and prepare_segment_topology gates on any(...) not all(...), so topology-aware placement is not disabled cluster-wide.
  • The early exit 1 paths not touching ENDED are fine — both fire before any srun.

Three comments below: one on user-facing accounting/docs, one open question about NeMo-Gym compatibility (not reproduced — please sanity-check it), and one deferrable maintainability note.

Note we could not run the repo's linters in this environment (the lockfile is Linux-only), so there is no lint signal from us; the diff is shell-only.

Generated by Claude Code

Comment thread ray.sub Resolved
Comment thread ray.sub Resolved

@terrykong terrykong 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.

lgtm modulo review. created #3474 to track the proper fix

macandro96 added a commit that referenced this pull request Aug 3, 2026
Address review feedback on #3388:

- Print the effective GPU-node count when DEDICATED_RAY_HEAD=1, since
  ray.sub cannot validate cluster.num_nodes (it lives in the user's
  COMMAND) and an unshrunk count only fails minutes into the driver run.
- Build the head's Ray resource JSON in topology_probe.sh behind an
  NRL_DEDICATED_RAY_HEAD branch instead of re-hardcoding a literal at the
  head_cmd call site, so node-level keys added to the probe reach both
  head and workers.
- Add a DEDICATED_RAY_HEAD row to the Advanced Environment Configuration
  table in docs/cluster.md covering node-count accounting, the idled
  head GPUs, and tools/launch segment divisibility.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Anish Mahishi <[email protected]>
@macandro96
macandro96 requested a review from a team as a code owner August 3, 2026 23:46
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Aug 3, 2026
@macandro96 macandro96 added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Aug 3, 2026
@macandro96

Copy link
Copy Markdown
Contributor Author

/ok to test 1f399f3

macandro96 and others added 2 commits August 3, 2026 20:44
Address review feedback on #3388:

- Print the effective GPU-node count when DEDICATED_RAY_HEAD=1, since
  ray.sub cannot validate cluster.num_nodes (it lives in the user's
  COMMAND) and an unshrunk count only fails minutes into the driver run.
- Build the head's Ray resource JSON in topology_probe.sh behind an
  NRL_DEDICATED_RAY_HEAD branch instead of re-hardcoding a literal at the
  head_cmd call site, so node-level keys added to the probe reach both
  head and workers.
- Add a DEDICATED_RAY_HEAD row to the Advanced Environment Configuration
  table in docs/cluster.md covering node-count accounting, the idled
  head GPUs, and tools/launch segment divisibility.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Anish Mahishi <[email protected]>
@macandro96
macandro96 force-pushed the amahishi/dedicated-ray-head branch from 1f399f3 to c712eca Compare August 4, 2026 00:44
@macandro96

Copy link
Copy Markdown
Contributor Author

/ok to test c712eca

@terrykong
terrykong enabled auto-merge (squash) August 4, 2026 00:57
@terrykong
terrykong merged commit a1af9ae into main Aug 4, 2026
81 checks passed
@terrykong
terrykong deleted the amahishi/dedicated-ray-head branch August 4, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants