MindStudio Tools Extension Library API Reference

This section describes the instrumentation APIs of the MindStudio Tools Extension Library (msTX). You can customize the collection period or the start and end timestamps of key functions to identify information such as key functions or iterations, enabling quick delimitation of performance and operator issues.

By default, the msTX APIs have no functionality. After calling the msTX APIs in your user application, you need to enable the msTX instrumentation feature according to different scenarios, for example, configuring --mstx=on when collecting data using the msprof CLI, configuring ACL_PROF_MSPROFTX when collecting data using the AscendCL API, and configuring mstx=True when collecting data using the Ascend PyTorch Profiler interface.

  • Library file libms_tools_ext.so path: ${INSTALL_DIR}/lib64/.
  • When compiling with the header file, the user program needs to link the dl library during compilation. Header file ms_tools_ext.h path: ${INSTALL_DIR}/include/mstx.

Replace ${INSTALL_DIR} with the file storage path after CANN software installation. For example, if you install CANN as the root user, the default file storage path is: /usr/local/Ascend/cann.

API List

Table 1 MindStudio mstx API list

APIDescription
mstxGetToolIdObtains the ID of the tool currently intercepting mstx APIs.
mstxMarkAMarks an instantaneous event.
mstxRangeStartAMarks the start of a range event.
mstxRangeEndMarks the end of a range event.
mstxDomainCreateACreates a custom domain.
mstxDomainDestroyDestroys a specified domain. A destroyed domain cannot be used again and must be re-created.
mstxDomainMarkAMarks an instantaneous event within a specified domain.
mstxDomainRangeStartAMarks the start of a range event within a specified domain.
mstxDomainRangeEndMarks the end of a range event within a specified domain.
mstxMemHeapRegisterRegisters a memory pool.
mstxMemRegionsRegisterRegisters secondary allocation of a memory pool.
mstxMemRegionsUnregisterUnregisters secondary allocation of a memory pool.
mstxMemHeapUnregisterWhen a memory pool is unregistered, the associated regions are also unregistered.
mstxMemPermissionsAssignSpecify permissions for a virtual memory region.