Repository navigation
Conversation
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhilong <[email protected]>
Co-authored-by: Jiajun Yao <[email protected]> Signed-off-by: zhilong <[email protected]>
Co-authored-by: Jiajun Yao <[email protected]> Signed-off-by: zhilong <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
Signed-off-by: zhaoch23 <[email protected]>
| @@ -0,0 +1 @@ | |||
| from ray._private.thirdparty.pynpudcmi.pynpudcmi import * | |||
There was a problem hiding this comment.
Can you add some comment saying that version of pynpudcmi is vendored here and how should we upgrade it in the future?
| return gpu_utilizations | ||
|
|
||
|
|
||
| class HuaweiNpuProvider(GpuProvider): |
There was a problem hiding this comment.
Nit: we should rename GpuProvide to AcceleratorProvider
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
@zhaoch23 any updates on this PR? |
|
Hi maintainers and authors, thanks for the work in this PR. I have been working on Ascend NPU observability as well, and found this PR during the duplicate-work check. We have not opened a competing PR. There is overlap in collecting Ascend metrics through DCMI, but our implementation takes a materially different approach and has a broader scope:
We have also validated the implementation on real hardware rather than mocks only:
Would maintainers prefer that we coordinate with the authors and adapt/contribute these changes to #56755, or is a separate PR appropriate given the separate NPU model and the additional Prometheus, Dashboard, actor/process, heterogeneous-cluster, and documentation scope? The implementation was developed with AI assistance. The submitting human will review every changed line and include the exact test commands and hardware validation results in any PR description. |
## 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](#56755 (comment)) and asked the authors and maintainers for direction in [this follow-up](#56755 (comment)). #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. --------- Signed-off-by: linchaoying6 <[email protected]> Co-authored-by: linchaoying6 <[email protected]>
Why are these changes needed?
Related issue number
Second part of #55434
Checks
git commit -s) in this PR.scripts/format.shto lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.Note
Adds Huawei Ascend NPU support via DCMI, updates GPU provider interface to pass node IP for stable UUIDs, and integrates NPU into provider detection and tests.
HuaweiNpuProviderusingpynpudcmi; extendGpuProviderTypewithHUAWEIand include in provider detection.GpuProvider.get_gpu_utilization(ip)andGpuMetricProvider.get_gpu_usage(ip)now accept optional node IP;ReporterAgentpassesself._ip.ai_coreutilization, HBM memory usage/total, and per-process memory via DCMI; deriveuuidby hashingcard_id+ip.ray/_private/thirdparty/pynpudcmiwith ctypes DCMI wrapper, error classes, and calls (dcmi_init, card/device queries, memory/utilization APIs).HuaweiNpuProvidertests; adjust counts and mocks; ensure IP-based UUID behavior.Written by Cursor Bugbot for commit 006ec73. This will update automatically on new commits. Configure here.