Skip to content

[Dashboard][NPU] Add native Ascend NPU observability - #66920

Merged
rueian merged 15 commits into
ray-project:masterfrom
Lcy0801:codex/ascend-npu-prometheus-mvp
Oct 29, 2026
Merged

rueian merged 15 commits into
ray-project:masterfrom
Lcy0801:codex/ascend-npu-prometheus-mvp

Conversation

@Lcy0801

@Lcy0801 Lcy0801 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds native Huawei Ascend NPU observability to Ray as a separate accelerator path that can coexist with GPU monitoring in heterogeneous clusters.

It:

  • loads the read-only DCMI monitoring API from libdcmi.so with a fail-soft ctypes provider;
  • reports per-device AI Core utilization, HBM used/available, health, temperature, board power, and logical/physical/card/device identifiers;
  • obtains per-process NPU memory from DCMI and propagates it through Reporter, component Prometheus metrics, Dashboard Head worker/actor association, and the Dashboard UI;
  • adds NPU Prometheus metrics and default Grafana panels, including logical NPU used, total, and pending resources;
  • makes the Cluster and Actor views handle NPU-only and mixed GPU/NPU clusters, including missing-HBM fallback behavior;
  • keeps older Reporter payloads compatible when the npus field is absent; and
  • documents driver/DCMI requirements, environment variables, units, labels, fallback behavior, and the relationship to existing NPU custom-resource scheduling.

This PR does not change Ray's core scheduling semantics. Ascend Tasks and Actors continue to use the existing logical NPU custom resource together with ASCEND_RT_VISIBLE_DEVICES.

Related issues

Related to #56755.

Duplicate-work check and difference from #56755

The open-PR searches for "NPU dashboard" and "Ascend DCMI" found #56755 as the only overlapping PR. Before opening this PR, I described the implementation differences in this comment and asked the authors and maintainers for direction in this follow-up.

#56755 adds Huawei NPU support inside the GPU provider abstraction. This PR is a materially different alternative:

  • NPU has an independent provider, schema, API payload, Prometheus metric families, and UI representation, so GPU and NPU data can coexist.
  • It covers node metrics, per-process/component memory, worker/actor association, Prometheus, Grafana, Dashboard UI, compatibility, and documentation end to end.
  • It includes real-device validation on two Ascend product topologies and a heterogeneous NVIDIA/Ascend cluster.

This PR does not claim to supersede #56755; maintainers can decide which architecture should move forward.

Hardware validation

Hostnames, addresses, and internal deployment details are intentionally omitted.

Environment Hardware topology Validation
Ascend 910C Containerized Ray; one card with two chips DCMI enumerated both devices as a non-root user. Two detached Ray actors allocated real HBM and repeatedly executed FP16 Add. DCMI PIDs, Ray worker PIDs, per-process HBM, ray_component_npu_memory_mb, Dashboard API data, and UI rows were correlated end to end.
Ascend 910B Containerized Ray; two cards with one chip per card DCMI enumerated both cards/devices and collected device metrics as a non-root user.
Heterogeneous cluster Ascend NPU node plus NVIDIA B200 GPU node Prometheus service discovery included both nodes; GPU and NPU metrics were collected simultaneously; generic accelerator columns and node details displayed both accelerator types.

In both tested container deployments, DCMI PIDs matched the PIDs visible through /proc. Other container PID-namespace layouts remain a compatibility risk rather than a claimed universal guarantee.

Screenshots are omitted because the metric/API correlation gives stronger reproducible evidence and screenshots could expose internal infrastructure. Redacted screenshots can be added if maintainers request them.

Tests

Passed:

.venv/bin/python -m pytest -q       python/ray/dashboard/modules/reporter/tests/test_npu_providers.py       python/ray/dashboard/modules/reporter/tests/test_reporter.py::test_report_stats_ascend_npu_metrics       python/ray/dashboard/modules/reporter/tests/test_reporter.py::test_stats_payload_accepts_legacy_reporter_without_npus       python/ray/dashboard/modules/reporter/tests/test_reporter.py::test_reporter_maps_npu_process_memory_to_worker_metrics       python/ray/dashboard/modules/node/tests/test_actor.py::test_actor_info_associates_npus_by_pid       python/ray/tests/test_metrics_head.py::test_cluster_npu_utilization_averages_reported_samples \
  python/ray/tests/test_metrics_head.py::test_cluster_npu_hbm_utilization_uses_reported_capacity
# 14 passed

npm --prefix python/ray/dashboard/client test -- --watchAll=false --runInBand       src/components/ActorTable.component.test.tsx       src/pages/node/AcceleratorColumn.component.test.tsx       src/pages/node/AcceleratorMemoryColumn.component.test.tsx       src/util/accelerator.test.ts
# 4 suites passed, 19 tests passed

.venv/bin/pre-commit run --from-ref github/master --to-ref HEAD
# All applicable hooks passed, including Ruff, Black, pydoclint,
# docstyle/import checks, link checks, ESLint, and Prettier.

git diff --check github/master...HEAD
# Passed

The logical NPU resource panel follow-up was additionally validated:

.venv/bin/python -m pytest -q python/ray/tests/test_metrics_head.py -k 'not metrics_folder'
# 6 passed, 4 deselected

.venv/bin/pre-commit run --files \
  python/ray/dashboard/modules/metrics/dashboards/default_dashboard_panels.py \
  python/ray/tests/test_metrics_head.py
# All applicable hooks passed

The generated default dashboard contains 50 panels and the new Logical NPU Usage panel has USED, MAX, and MAX + PENDING queries. On the Ascend 910C test cluster, Prometheus returned USED=2 and MAX=2; Grafana hot-reloaded the dashboard and visibly rendered both values as 2 NPUs. MAX + PENDING correctly remained absent because the cluster had no pending NPU resources. Both real NPU actors remained alive during validation.

On an Ascend server, the locked documentation dependencies passed rtd-doctor. A targeted strict build of the three changed pages also passed with zero warnings:

sphinx-build -W --keep-going -E -j 4 -b html       doc/source <output-dir>       ray-observability/reference/system-metrics.md       core/scheduling/accelerators.md       ray-observability/getting-started.md
# build succeeded; all expected HTML files generated

A full make rtd-build was attempted but blocked while downloading external collections from templates.ci.ray.io; this was an external-network limitation, not a Sphinx parsing failure.

The complete Reporter and Actor test files were also attempted in the local development wheel. Dashboard-starting cases could not run because that wheel lacks ray/dashboard/client/build/static; one async Reporter test also lacked its pytest async plugin. The NPU-specific tests listed above do not require those missing artifacts and passed.

Separately from those local test-environment limitations, the generated dashboard was deployed and validated end to end on a live Ray cluster with Ascend NPUs. Prometheus returned the expected per-device and per-component NPU metrics, and the embedded Ray Dashboard and Grafana panels rendered the corresponding AI Core utilization, HBM, power, temperature, health, and component-memory values correctly.

AI assistance disclosure

AI assistance was used to implement, test, review, and prepare this change. I reviewed every changed line, understand the end-to-end design and test evidence, and can maintain and explain the contribution.

@Lcy0801
Lcy0801 requested review from a team as code owners October 11, 2026 05:36

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces comprehensive support for monitoring Huawei Ascend NPUs in the Ray dashboard and system metrics. It adds a new backend metric provider (NpuMetricProvider) that interacts with the Ascend Device Configuration Management Interface (DCMI) via ctypes to collect device utilization, memory (HBM), power, temperature, and health metrics. The dashboard frontend is updated to display these NPU metrics generically under "Accelerator" and "Accelerator Memory" columns, and new Grafana panels are added to visualize NPU metrics. Feedback is provided on npu_providers.py to dynamically check for ctypes.RTLD_LOCAL to avoid an AttributeError on Windows platforms.

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels Oct 11, 2026
@Lcy0801

Lcy0801 commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rueian @sampan-s-nayak, would either of you have time to review this PR? It adds native Ascend NPU observability to Ray: a new NPU metric provider in the reporter agent (via the Ascend DCMI interface), accelerator and NPU memory columns/panels in the dashboard, and corresponding docs. All CI checks are green.

For context: this covers similar ground to #56755 ("[Dashboard][NPU] Add NPU Provider to Dashboard"), which has been inactive for about a year. Cc @alanwguo @jjyao who reviewed that PR, and @zhaoch23 as its author — this PR is intended as a broader, more complete version of that effort (system metrics exportable to Prometheus/Grafana plus UI support), and I'm happy to coordinate or incorporate anything from there.

Feedback on the scope and approach is very welcome. Thanks!

@rueian rueian self-assigned this Oct 13, 2026
@Kunchd

Kunchd commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

@Bye-legumes Could you help us take a look at this PR? Thanks!

@Lcy0801

Lcy0801 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rueian @Kunchd, all CI checks have passed — would either of you have time to take a review when convenient? Thanks!

@rueian rueian added the go add ONLY when ready to merge, run all tests label Oct 19, 2026
@Lcy0801
Lcy0801 force-pushed the codex/ascend-npu-prometheus-mvp branch from b816fe1 to 1fa65b3 Compare October 20, 2026 09:35

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@Lcy0801

Lcy0801 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rueian — quick update: the full-suite premerge build #75151 has finished everything it can run automatically: 127 steps passed, 0 failed (the rest are the manually-gated sanitizer/GPU/windows suites). It's now paused at the block steps awaiting a decision. The commits pushed after go are minor fixes from bot review feedback. Let me know if you'd like any of the gated suites run, or if this is ready for review/merge. Thanks!

@Lcy0801

Lcy0801 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

Hi @rueian, gentle ping — would you mind taking another look when you have a moment?

Since your last pass: all prior review feedback has been addressed (the Windows ctypes.RTLD_LOCAL fix in 97330ba and the fallback NPU index collision fix in 1127dfe, both with regression tests), all CI checks are green, and the branch is up to date with master with no merge conflicts. Thanks a lot for your time!

dstrodtman added a commit that referenced this pull request Oct 26, 2026
## Description

A batch of 15 small docs fixes. Most close an open docs issue, listed
under Related issues. Each fix is its own commit, so a reviewer can drop
any one without touching the rest. Batching follows the "No low-value
busywork PRs" rule in `AGENTS.md`, which allows mechanical fixes when
they're bundled.

The changes are prose and one notebook install cell, all under `doc/`.
Each fix was checked against the current source on master.

| Area | Change | Source checked |
|---|---|---|
| Core | The memory-aware scheduling examples said 2.5 GiB and 1 GiB but
computed 2500 MiB and 1000 MiB. The examples now use exact binary
multiples, and the text says `memory` is in bytes. | `ray.remote`
docstring in `_private/worker.py` (memory request in bytes) |
| Cluster | Link the cluster application guide to the Ray Serve
development and deployment guides. | Existing `serve-dev-workflow`,
`serve-in-production-deploying`, and `serve-in-production-kubernetes`
labels |
| Train | Link the Lightning getting-started guide to the PyTorch data
loading comparison. | `train-datasets-pytorch` section |
| Tune | Pin the hidden install cell of `ax-example.ipynb` to
`ax-platform==1.2.1`, the version in `tune-requirements.txt`, and drop
the cell's stale pip output. #60522 moved `AxSearch` to the Ax 1.0 API.
| `python/requirements/ml/tune-requirements.txt`, `ax_search.py` |
| Train | The fault-tolerance deprecation section called the deprecated
argument `restore_from_checkpoint`. The trainer parameter is
`resume_from_checkpoint`. |
`python/ray/train/v2/api/data_parallel_trainer.py` |
| Tune | The BayesOpt example pinned `bayesian-optimization==1.2.0`,
which uses `np.float` and fails in `tuner.fit()` on current NumPy. Pin
1.4.0, the version in `python/requirements_compiled.txt`. Executing the
notebook with `jupyter nbconvert --execute` on Ray 2.59.0 and NumPy
2.4.6 runs clean with 1.4.0 and reproduces `AttributeError: module
'numpy' has no attribute 'float'` with 1.2.0. |
`python/requirements_compiled.txt` |
| Cluster | Add a manual-configuration tab with SSH port forwarding to
the dashboard access section. | `ray start --dashboard-port`, default
8265 |
| Cluster | Document `RAY_OVERRIDE_DASHBOARD_URL` for reverse proxies. |
`ray_constants.py`, `worker.py` (`get_dashboard_url` and the connect
log) |
| Serve | Note that KubeRay creates `<name>-head-svc` and
`<name>-serve-svc` only after every Serve application is `RUNNING`. |
KubeRay `rayservice_controller.go` (`reconcileServe`,
`getAndCheckServeStatus`) |
| Cluster | Replace the hardcoded Homebrew Grafana path with `$(brew
--prefix)/etc/grafana/grafana.ini`. | The Homebrew `grafana` formula's
service passes `--config etc/grafana/grafana.ini` |
| Cluster | A node type's `worker_setup_commands` replaces both the
general `setup_commands` and `worker_setup_commands`. It doesn't replace
only the latter. | `merge_setup_commands` in
`autoscaler/_private/util.py`, `_get_node_type_specific_fields` in
`autoscaler.py`, `ray-schema.json` |
| Cluster | Add next-steps links to log and metrics persistence on the
VM and KubeRay quickstarts. | Existing persistence guides |
| Cluster | Add a port requirements section to the manual on-premises
setup that links the ports reference. | `core/configure.md` ports
reference |
| Data | Rename the `S3` and `GCS` cloud storage tabs to `Amazon S3` and
`Google Cloud Storage`. In Ray docs, GCS means the Global Control
Service. | `writing-style.md` term table |
| KubeRay | Document where `libtpu` logs appear (`tpu_logs` in the node
log directory and the dashboard Logs view). Link to it from the Logs
view section. | `_private/node.py` (`_init_temp`),
`_private/log_monitor.py`, #47737 |

## Related issues

Closes #42681
Closes #38545
Closes #48024
Closes #54968
Closes #37804
Closes #46794
Closes #50958
Closes #42430
Closes #37831
Closes #37631
Closes #24491
Closes #51102

## Not a duplicate

For each linked issue, `gh pr list --repo ray-project/ray --state open
--search "<issue> in:body"` returned no open PRs. A content search
turned up three open PRs that edit the same pages: #66289 (OCI
provider), #66958 (Grafana annotations), and #66920 (NPU observability).
They touch different hunks and don't overlap these changes. The data tab
rename has no linked issue, and no open PR touches those tabs.

## Testing

- `make -C doc rtd-build` (the RtD-faithful clean build: Python 3.11,
`doc/requirements-doc.lock.txt`, `-W --keep-going`): `build succeeded.`
with exit code 0 and zero Sphinx warnings. The only `WARNING` lines are
two RLlib logger messages printed at import time.
- Vale, run on the changed pages and limited to the added lines: no
findings remain beyond spelling hits on `proxied` (the page already uses
it) and `libtpu`, which is now in backticks.
- Pre-commit hooks passed on every commit.
- Every `{ref}` target added in this PR resolves to exactly one label
under `doc/source/`.
- I didn't execute the Ax notebook. Its only change is the hidden
install cell. CI already tests the Ax integration at
`ax-platform==1.2.1` through `python/ray/tune/examples/ax_example.py`.

## AI assistance

Drafted with AI assistance (Claude Code). Each technical claim was
checked against the source cited in the table.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
The fallback for a failed `get_logic_id` used the device enumeration
position, which overlaps with real non-negative DCMI logical IDs: two
devices could end up with the same index and merge in the dashboard and
Grafana. Synthetic indices are now negative and unique, so they never
collide with real logical IDs.

Signed-off-by: linchaoying6 <[email protected]>
@Lcy0801
Lcy0801 force-pushed the codex/ascend-npu-prometheus-mvp branch from 6344032 to a296032 Compare October 27, 2026 03:09
The previous external build was cancelled by Read the Docs
infrastructure right after sphinx-build started (no output, no exit
code). The same documentation content built successfully before the
rebase, so this retry just re-triggers the build.

Signed-off-by: linchaoying6 <[email protected]>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 1cc316f. Configure here.

@Lcy0801

Lcy0801 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @carolynwang for the review. All suggestions have been addressed:

  • Preserved the DCMI health severity levels (0–3) instead of converting them to a boolean, and normalized the missing sentinel 0xFFFFFFFF to 4.
  • Kept NPU memory values in bytes as suggested.
  • Updated both fallback-index descriptions to document the unique negative synthetic index.
  • Renamed the dashboard legend to NPU HBM.
    Corresponding regression tests and documentation have also been updated.

@Lcy0801
Lcy0801 requested a review from carolynwang October 28, 2026 05:40
justinyeh1995 pushed a commit to justinyeh1995/ray that referenced this pull request Oct 28, 2026
## Description

A batch of 15 small docs fixes. Most close an open docs issue, listed
under Related issues. Each fix is its own commit, so a reviewer can drop
any one without touching the rest. Batching follows the "No low-value
busywork PRs" rule in `AGENTS.md`, which allows mechanical fixes when
they're bundled.

The changes are prose and one notebook install cell, all under `doc/`.
Each fix was checked against the current source on master.

| Area | Change | Source checked |
|---|---|---|
| Core | The memory-aware scheduling examples said 2.5 GiB and 1 GiB but
computed 2500 MiB and 1000 MiB. The examples now use exact binary
multiples, and the text says `memory` is in bytes. | `ray.remote`
docstring in `_private/worker.py` (memory request in bytes) |
| Cluster | Link the cluster application guide to the Ray Serve
development and deployment guides. | Existing `serve-dev-workflow`,
`serve-in-production-deploying`, and `serve-in-production-kubernetes`
labels |
| Train | Link the Lightning getting-started guide to the PyTorch data
loading comparison. | `train-datasets-pytorch` section |
| Tune | Pin the hidden install cell of `ax-example.ipynb` to
`ax-platform==1.2.1`, the version in `tune-requirements.txt`, and drop
the cell's stale pip output. ray-project#60522 moved `AxSearch` to the Ax 1.0 API.
| `python/requirements/ml/tune-requirements.txt`, `ax_search.py` |
| Train | The fault-tolerance deprecation section called the deprecated
argument `restore_from_checkpoint`. The trainer parameter is
`resume_from_checkpoint`. |
`python/ray/train/v2/api/data_parallel_trainer.py` |
| Tune | The BayesOpt example pinned `bayesian-optimization==1.2.0`,
which uses `np.float` and fails in `tuner.fit()` on current NumPy. Pin
1.4.0, the version in `python/requirements_compiled.txt`. Executing the
notebook with `jupyter nbconvert --execute` on Ray 2.59.0 and NumPy
2.4.6 runs clean with 1.4.0 and reproduces `AttributeError: module
'numpy' has no attribute 'float'` with 1.2.0. |
`python/requirements_compiled.txt` |
| Cluster | Add a manual-configuration tab with SSH port forwarding to
the dashboard access section. | `ray start --dashboard-port`, default
8265 |
| Cluster | Document `RAY_OVERRIDE_DASHBOARD_URL` for reverse proxies. |
`ray_constants.py`, `worker.py` (`get_dashboard_url` and the connect
log) |
| Serve | Note that KubeRay creates `<name>-head-svc` and
`<name>-serve-svc` only after every Serve application is `RUNNING`. |
KubeRay `rayservice_controller.go` (`reconcileServe`,
`getAndCheckServeStatus`) |
| Cluster | Replace the hardcoded Homebrew Grafana path with `$(brew
--prefix)/etc/grafana/grafana.ini`. | The Homebrew `grafana` formula's
service passes `--config etc/grafana/grafana.ini` |
| Cluster | A node type's `worker_setup_commands` replaces both the
general `setup_commands` and `worker_setup_commands`. It doesn't replace
only the latter. | `merge_setup_commands` in
`autoscaler/_private/util.py`, `_get_node_type_specific_fields` in
`autoscaler.py`, `ray-schema.json` |
| Cluster | Add next-steps links to log and metrics persistence on the
VM and KubeRay quickstarts. | Existing persistence guides |
| Cluster | Add a port requirements section to the manual on-premises
setup that links the ports reference. | `core/configure.md` ports
reference |
| Data | Rename the `S3` and `GCS` cloud storage tabs to `Amazon S3` and
`Google Cloud Storage`. In Ray docs, GCS means the Global Control
Service. | `writing-style.md` term table |
| KubeRay | Document where `libtpu` logs appear (`tpu_logs` in the node
log directory and the dashboard Logs view). Link to it from the Logs
view section. | `_private/node.py` (`_init_temp`),
`_private/log_monitor.py`, ray-project#47737 |

## Related issues

Closes ray-project#42681
Closes ray-project#38545
Closes ray-project#48024
Closes ray-project#54968
Closes ray-project#37804
Closes ray-project#46794
Closes ray-project#50958
Closes ray-project#42430
Closes ray-project#37831
Closes ray-project#37631
Closes ray-project#24491
Closes ray-project#51102

## Not a duplicate

For each linked issue, `gh pr list --repo ray-project/ray --state open
--search "<issue> in:body"` returned no open PRs. A content search
turned up three open PRs that edit the same pages: ray-project#66289 (OCI
provider), ray-project#66958 (Grafana annotations), and ray-project#66920 (NPU observability).
They touch different hunks and don't overlap these changes. The data tab
rename has no linked issue, and no open PR touches those tabs.

## Testing

- `make -C doc rtd-build` (the RtD-faithful clean build: Python 3.11,
`doc/requirements-doc.lock.txt`, `-W --keep-going`): `build succeeded.`
with exit code 0 and zero Sphinx warnings. The only `WARNING` lines are
two RLlib logger messages printed at import time.
- Vale, run on the changed pages and limited to the added lines: no
findings remain beyond spelling hits on `proxied` (the page already uses
it) and `libtpu`, which is now in backticks.
- Pre-commit hooks passed on every commit.
- Every `{ref}` target added in this PR resolves to exactly one label
under `doc/source/`.
- I didn't execute the Ax notebook. Its only change is the hidden
install cell. CI already tests the Ax integration at
`ax-platform==1.2.1` through `python/ray/tune/examples/ax_example.py`.

## AI assistance

Drafted with AI assistance (Claude Code). Each technical claim was
checked against the source cited in the table.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

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

thanks!

@rueian
rueian merged commit 46469b2 into ray-project:master Oct 29, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants