msPTI

Overview

MindStudio Profiling Tool Interface (msPTI) is a set of profiling APIs provided by MindStudio for Ascend devices. You can use msPTI to build profilers for NPU applications.

msPTI is for common scenarios. Profiling tools developed with msPTI APIs can be used in inferencetraining scenarios in different frameworks.

msPTI provides the following functions:

msPTI provides a set of C-based APIs and a set of Python APIs with the C-based API functions as the underlying logic.

Applicability

For details about the mapping between AI processors and Ascend products, see Ascend Product Overview.

Product

Supported

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

√

Atlas inference products

x

Atlas training products

x

Preparations

The samples of msPTI Python APIs depend on the PyTorch framework and torch_npu plugin. Ensure that they have been installed. For details, see "Installing PyTorch" in Ascend Extension for PyTorch.

Restrictions

msPTI cannot be used with any other profilers. Otherwise, the profile data will be lost.

msPTI Sample Set

This section provides examples of using msPTI APIs.

Sample Building and Execution

  1. After installing the CANN software, log in to the environment as the CANN running user and run the following command to configure environment variables: ${install_path} indicates the path for storing files after the CANN software is installed, for example, /usr/local/Ascend/cann. The following is an example:
    source /usr/local/Ascend/cann/set_env.sh
  2. Go to the sample directory.

    The msPTI sample code is integrated in the CANN Toolkit development kit and stored in the ${install_path}/tools/mspti/samples directory.

    Replace ${install_path} with the path for storing files after the CANN software is installed. For example, if the installation is performed by the root user, the path is /usr/local/Ascend/cann.

    Example:
    cd ${install_path}/tools/mspti/samples/callback_domain
  3. Execute sample_run.sh in the sample directory.
    bash sample_run.sh

The following table describes the samples provided currently.