Repository navigation
[Dashboard][NPU] Add native Ascend NPU observability - #66920
Conversation
There was a problem hiding this comment.
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.
|
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! |
|
@Bye-legumes Could you help us take a look at this PR? Thanks! |
b816fe1 to
1fa65b3
Compare
|
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 |
|
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 |
## 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]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[email protected]>
Signed-off-by: linchaoying6 <[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]>
6344032 to
a296032
Compare
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]>
Signed-off-by: linchaoying6 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 1cc316f. Configure here.
Signed-off-by: linchaoying6 <[email protected]>
|
Thanks @carolynwang for the review. All suggestions have been addressed:
|
## 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]>

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:
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:
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.
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:
The logical NPU resource panel follow-up was additionally validated:
The generated default dashboard contains 50 panels and the new
Logical NPU Usagepanel hasUSED,MAX, andMAX + PENDINGqueries. On the Ascend 910C test cluster, Prometheus returnedUSED=2andMAX=2; Grafana hot-reloaded the dashboard and visibly rendered both values as2 NPUs.MAX + PENDINGcorrectly 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:
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.