A utility library for interacting with Ascend NPUs via the npu-smi command options, to directly get information from the terminal commands parsed into python
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ascend-npu-utils-0.1.1.tar.gz.
File metadata
- Download URL: ascend-npu-utils-0.1.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a0124224d1d5325e6c02a6ad97dec4bfb612133ae67293f80648ac8a4eda0b7
|
|
| MD5 |
33fbec72137bb88f88dbbd14ec01e202
|
|
| BLAKE2b-256 |
fd4f10119e55abf327b755c684cf478d83de1f8bad6c15aae7b838b4e0746c25
|
File details
Details for the file ascend_npu_utils-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ascend_npu_utils-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0a0b88eafd67be583fc9fd0f2642d846b9400940cbd5bbeff8f253694acf94b
|
|
| MD5 |
25ed41df034a7da777080a7a21c4b691
|
|
| BLAKE2b-256 |
9fab1fc822a05288ea66923d65ab6d1b4af9f5e8af34fe763e1c2ef21b74ece9
|