Skip to content

[train][8/n] Add GPU tests for the health stack and the NCCL hang detector - #67992

Draft
liulehui wants to merge 2 commits into
masterfrom
ray-train-health/health-gpu-tests
Draft

liulehui wants to merge 2 commits into
masterfrom
ray-train-health/health-gpu-tests

Conversation

@liulehui

@liulehui liulehui commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Why are these changes needed?

The health stack (#67671 → #67856 → #67879 → #67915 → #67916) is tested with unit tests and a local CPU cluster. This PR adds scripts to run it on a real GPU cluster, such as an Anyscale workspace, with faults injected on purpose. Each script prints a timeline of the controller's decisions, and PASS or FAIL. release/train_tests/health/README.md has the setup.

script what it checks
gpu_faults.py workflow A pre-flight all-reduce runs with the workers stopped (HealthCheck(stop_workers=True)). Then a thermal event slows one node: DIAGNOSE → its temperature is read on demand → REATTEMPT → HealthCheckError with max_failures=0.
gpu_faults.py xid79 A fatal XID 79 event on one node → EVICT, outside the retry budget → the worker group restarts, and the node isn't evicted twice.
nccl_hang.py One rank leaves an all-reduce. The merged NCCLRASCallback and the same detection on ray.train.health (nccl_ras_health.py, built on the 7/n probes) both catch it, within a few seconds of each other.
nccl_hang.py health slow_step A rank pauses 10s every 40 steps, and neither detector fires.
sync_ray_train.py Installs the checkout's ray/train into the image's Ray on every node, so the stack runs on a nightly without building Ray.

GPU health events are mocked with the fields of NVSentinel's HealthEvent (checkName, isFatal, recommendedAction, errorCode, entitiesImpacted), and the same fatal rule: an event is fatal when its recommended action isn't NONE. A task pinned to a node writes the event there, and the probes read it on their next poll. Faults fire at a rank and step, once per run, as in TorchFT's EventInjector. The README compares this with NVSentinel's dcgmi test --inject, and with NVRx's inject_fault.

These are scripts to run by hand. They aren't wired into release_tests.yaml.

Related issue number

Follows #67916. The scripts come from the draft #66247, ported to the stack's API.

Duplicate check

gh pr list --repo ray-project/ray --state open --search "nccl ras hang release test" and --search "train health in:title" find only this stack, #66247 (the earlier draft these scripts come from) and #67544 (health events and exporter, unrelated).

Tests

On a laptop, against this branch's ray/train:

  • python release/train_tests/health/gpu_faults.py --local: workflow PASS (DIAGNOSE at +3.9s, REATTEMPT at +5.9s, HealthCheckError); xid79 PASS (EVICT at +3.9s, then RESTARTING and RUNNING, ending without an error).
  • NCCLHangEvaluator on a recorded ncclras -f json report from a 4-node hang, in which rank 1 is at AllReduce 100 and the other ranks are at 101. With a 2s poll and a 20s confirm duration, it suspects the hang at 18s and confirms it at 20s, naming rank 1 by host:pid. When one node's report fails it uses the other's, and a fatal RAS error turns it off.
  • sync_ray_train.py against a fake install keeps train.orig and installs the stack's code.
  • pre-commit passes.

Not yet run on GPUs. nccl_hang.py needs GPUs and NCCL ≥ 2.28.7 with ncclras, so I'll run both scripts in an Anyscale workspace before this leaves draft.

Checks

  • I've signed off every commit (git commit -s).
  • I've run pre-commit on the changed files.
  • AI assistance (Claude Code) was used to write these scripts. I'll review every line and run them on GPUs before requesting review.

🤖 Generated with Claude Code

@liulehui
liulehui added this pull request to stack #67857 November 9, 2026 23:35
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch from 14e47b1 to 189873e Compare November 10, 2026 17:34
@liulehui
liulehui force-pushed the ray-train-health/health-gpu-tests branch from 46169a7 to 6d4df66 Compare November 10, 2026 17:36
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch from 189873e to bb7186c Compare November 10, 2026 18:41
@liulehui
liulehui force-pushed the ray-train-health/health-gpu-tests branch from 6d4df66 to 054c322 Compare November 10, 2026 18:44
@pseudo-rnd-thoughts
pseudo-rnd-thoughts force-pushed the ray-train-health/health-gpu-tests branch from 054c322 to e1ea72a Compare November 10, 2026 20:51
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch from 2655c1b to 5f1b44f Compare November 12, 2026 06:38
@liulehui
liulehui force-pushed the ray-train-health/health-gpu-tests branch from e1ea72a to facd769 Compare November 12, 2026 06:38
@pseudo-rnd-thoughts
pseudo-rnd-thoughts force-pushed the ray-train-health/health-gpu-tests branch 2 times, most recently from a9fc325 to 7db7194 Compare November 12, 2026 18:39
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch 4 times, most recently from fc894d5 to b0fe250 Compare November 15, 2026 22:37
@liulehui
liulehui removed this pull request from stack #67857 November 15, 2026 23:00
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch 3 times, most recently from 29db681 to 3749b35 Compare November 18, 2026 17:25
RAY_TRAIN_ENABLE_NCCL_HANG_DETECTOR=1 now runs the NCCL hang detector as
a ray.train.health check that the controller adds to the run, instead of
NCCLRASCallback, which stays, unregistered, until a later PR deletes it.
It behaves like the callback: the same env vars, detection, warnings,
diagnostics and uploads, and Grafana gauges.

- ray.train.health.nccl_ras:
  - utils: the callback's helpers, copied in its order. Only
    run_ncclras, run_nvidia_smi and dump_flight_recorder differ.
  - probes: NCCLRASProbe, NCCLRASTextProbe and NvidiaSmiProbe on each
    node, FlightRecorderProbe and StackTraceProbe on each worker.
  - evaluators: NCCLHangEvaluator, which diagnoses a suspected hang with
    NCCL's text report (SuspectedHangEvaluator), and a confirmed one with
    the four diagnostics (ConfirmedHangEvaluator, which uploads them,
    then reattempts or only logs).
  - check: nccl_hang_check(), which reads the env vars.
- The controller adds nccl_hang_check() to the run's in-flight checks,
  and the detector's env vars are propagated to it.
- With RAY_TRAIN_NCCL_RAS_ACTION=fail, a confirmed hang is a Reattempt,
  which fails the attempt with a HealthCheckError instead of
  NCCLHangError.
- The Flight Recorder dump reads ProcessGroupNCCL's buffer, falling back
  to the generic one.

The detector's tests, in python/ray/train/health/tests, are copies of
test_nccl_ras_callback.py's. A CPU end-to-end test drives it with a fake
ncclras.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
@pseudo-rnd-thoughts
pseudo-rnd-thoughts force-pushed the ray-train-health/nccl-ras-health branch from 3749b35 to a34946b Compare November 18, 2026 19:44
…ector

Scripts under release/train_tests/health that run ray.train.health on a
GPU cluster with faults injected on purpose, and print a timeline of the
controller's decisions and PASS or FAIL. See the README for the cluster,
the image and how to run them.

- nccl_hang.py runs one NCCL hang, and a slow step that must not fire,
  against the NCCL hang detector on ray.train.health
  (RAY_TRAIN_ENABLE_NCCL_HANG_DETECTOR=1) and against the NCCLRASCallback
  it replaces, passed in RunConfig(callbacks=...). Both must end the run
  with their error within a few seconds of each other, and upload the
  four diagnostics to hang_detector/.
- gpu_faults.py and gr00t_recovery.py mock GPU faults as NVSentinel
  HealthEvents, and run the GPU and progress checks in gpu_health.py and
  progress_health.py. harness.py holds the injected faults and the
  Timeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Lehui Liu <[email protected]>
@liulehui
liulehui force-pushed the ray-train-health/health-gpu-tests branch from 7db7194 to 0d281e8 Compare November 18, 2026 20:33
@liulehui
liulehui force-pushed the ray-train-health/nccl-ras-health branch from a34946b to a242c48 Compare November 18, 2026 22:52
Base automatically changed from ray-train-health/nccl-ras-health to master November 20, 2026 18:23

This branch has not been deployed

No deployments
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.

1 participant