API Introduction

This section describes the mstx dotting API. You can customize the sampling period or the start and end time of key functions to identify these functions or iterations and quickly demarcate performance and operator problems.

By default, mstx APIs do not provide any function. You need to call the mstx APIs in the user application and enable the mstx dotting function based on different scenarios, for example, when using the msProf commands to sample data, set --msproftx=on. When using the AscendCL API to sample data, configure ACL_PROF_MSPROFTX. When using the Ascend PyTorch Profiler API to sample data, set mstx=True.

  • Path of the libms_tools_ext.so library file: ${INSTALL_DIR}/lib64
  • When the header file is used for compilation, the dl library needs to be linked during program compilation. The header file ms_tools_ext.h is stored in ${INSTALL_DIR}/include/mstx.

Replace ${INSTALL_DIR} with the CANN component directory. For example, if the installation is performed by the root user, the default file storage path is /usr/local/Ascend/cann.

API List

Table 1 MindStudio mstx API list

API Name

Function Description

mstxGetToolId

Obtains the ID of the tool that hijacks the mstx API.

mstxMarkA

Identifies an instantaneous event.

mstxRangeStartA

Identifies the start of a time segment event.

mstxRangeEnd

Identifies the end of a time segment event.

mstxDomainCreateA

Creates a custom domain.

mstxDomainDestroy

Destroys a specified domain. A destroyed domain cannot be re-used. Recreate one if you need to use it.

mstxDomainMarkA

Marks an instantaneous event in a specified domain.

mstxDomainRangeStartA

Identifies the start of a time range event in a specified domain.

mstxDomainRangeEnd

Identifies the end of a time range event in a specified domain.

mstxMemHeapRegister

Registers a memory pool.

mstxMemRegionsRegister

Registers secondary allocation of a memory pool.

mstxMemRegionsUnregister

Deregisters secondary allocation of a memory pool.

mstxMemHeapUnregister

Deregisters the regions associated with a memory pool when the memory pool is deregistered.