Skip to main content

Ascend NPU Utils

A utility library for interacting with Ascend NPUs using the npu-smi tool.

Purpose

ascend-npu-utils is designed to provide an easy-to-use interface for accessing and manipulating information from Ascend Neural Processing Units (NPUs). By parsing the output of the npu-smi info command, this library allows developers to directly retrieve useful metrics and statistics about NPU devices and their performance in Python applications.

Features

  • Retrieve NPU Device Information: Get details about each available NPU, including health status, power consumption, temperature, and memory usage.

  • Query Power Dissipation: Access real-time power consumption data for specific NPUs to monitor energy usage.

  • List Running Processes: Identify processes that are currently utilizing the NPU, helping to manage workloads effectively.

  • Memory Usage Statistics: Obtain total and used memory information for specified NPU devices, aiding in resource management.

Installation

You can install the package using pip:

pip install ascend-npu-utils
Usage
Here’s a simple example of how to use the library:

```python

from ascend_npu_utils.utils import AscendNPUUtils

# Create an instance of the utility class
npu_utils = AscendNPUUtils()

# Retrieve NPU information
npu_info = npu_utils.npu_smi()
print("NPU Info:", npu_info)

# Query power dissipation for the first NPU
power_dissipation = npu_utils.npu_smi_query_power(npu_id=0)
print("Power Dissipation:", power_dissipation)

# List all processes running on the NPU
npu_processes = npu_utils.list_npu_processes()
print("NPU Processes:", npu_processes)

# Get memory usage information for the first NPU
memory_info = npu_utils.get_memory_info(device_index=0)
print("Memory Info:", memory_info)

Requirements Python 3.6 or higher psutil package Limitations This utility has primarily been tested on the Ascend 310P3 model, and while it aims to support other Ascend NPUs, there may be variations in command outputs that could affect compatibility.

Metadata

Release files for ascend-npu-utils 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ascend-npu-utils 0.1.1
File Size Uploaded Provenance
ascend-npu-utils-0.1.1.tar.gz 4.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ascend-npu-utils 0.1.1
File Interpreter ABI Platform
ascend_npu_utils-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / ascend-npu-utils-0.1.1.tar.gz

Download URL ascend-npu-utils-0.1.1.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1a0124224d1d5325e6c02a6ad97dec4bfb612133ae67293f80648ac8a4eda0b7
BLAKE2b-256 checksum
How to use checksums
fd4f10119e55abf327b755c684cf478d83de1f8bad6c15aae7b838b4e0746c25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.9

Release files / ascend_npu_utils-0.1.1-py3-none-any.whl

Download URL ascend_npu_utils-0.1.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0a0b88eafd67be583fc9fd0f2642d846b9400940cbd5bbeff8f253694acf94b
BLAKE2b-256 checksum
How to use checksums
9fab1fc822a05288ea66923d65ab6d1b4af9f5e8af34fe763e1c2ef21b74ece9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.9

Security for ascend-npu-utils 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page