MSPTI Samples
This section provides samples of using various MSPTI APIs.
Prerequisites
Sample Building and Execution
- After the CANN software is installed, when you build and run your application as the CANN running user, log in to the environment as the CANN running user and run the source ${install_path}/set_env.sh command to set environment variables. {install_path} indicates the CANN installation path, for example, /usr/local/Ascend/ascend-toolkit.
- Go to the sample directory.
The MSPTI sample code is integrated in the CANN Toolkit package and ops operator package in ${INSTALL_DIR}/tools/mspti/samples.
Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest.
Example:
cd ${INSTALL_DIR}/tools/mspti/samples/callback_domain - Execute sample_run.sh in the sample directory.
bash sample_run.sh
The following table describes the samples provided currently.
Sample |
Description |
Applicability |
|---|---|---|
callback_domain |
Demonstrates the Callback API function. You can call msptiEnableDomain to perform callback operations before and after the runtime API. |
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
callback_mstx |
|
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
Sample |
Description |
Applicability |
|---|---|---|
mspti_activity |
|
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
mspti_correlation |
|
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
mspti_external_correlation |
|
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
mspti_hccl_activity |
Demonstrates the basic functions of the Activity API. It shows how to profile HCCL communication data. |
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
mspti_mstx_activity_domain |
|
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
Sample |
Description |
Applicability |
|---|---|---|
python_monitor |
Demonstrates the basic usage of Monitor. You can use KernelMonitor and HcclMonitor to obtain the time consumed by compute operators and communication operators. |
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |
python_mstx_monitor |
Demonstrates the basic usage of MstxMonitor. You can use mstx to collect the time consumed by a specific operator (for example, matmul). |
Atlas A2 Training Series Product/Atlas 800I A2 Inference Product Atlas A3 Training Series Product |