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 Form Description.

Product

Supported

Atlas 350 Accelerator Card

√

Atlas A3 training product/Atlas A3 inference product

√

Atlas A2 training product/Atlas A2 inference product

√

Atlas 200I/500 A2 inference product

√

Atlas inference product

x

Atlas training product

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 the 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.