Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ascend-npu-utils-0.1.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ascend_npu_utils-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

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

Hashes for ascend-npu-utils-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1a0124224d1d5325e6c02a6ad97dec4bfb612133ae67293f80648ac8a4eda0b7
MD5 33fbec72137bb88f88dbbd14ec01e202
BLAKE2b-256 fd4f10119e55abf327b755c684cf478d83de1f8bad6c15aae7b838b4e0746c25

See more details on using hashes here.

File details

Details for the file ascend_npu_utils-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ascend_npu_utils-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0a0b88eafd67be583fc9fd0f2642d846b9400940cbd5bbeff8f253694acf94b
MD5 25ed41df034a7da777080a7a21c4b691
BLAKE2b-256 9fab1fc822a05288ea66923d65ab6d1b4af9f5e8af34fe763e1c2ef21b74ece9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page