The msprof command-line tool provides the capabilities of collecting and parsing the profile data during AI task running, system data of the AI processor, and other required data.
The general profiling command of msprof is used to query the basic information about profiling, including parameter description, AI task file, data storage path, and custom environment variables.
Log in to the operating environment and run the following command in any directory:
msprof [options] <app>
msprof [options] --application=<app>
In the following examples, the recommended method is used to avoid redundant information.
The user executable program and related parameters can be passed. The following are examples:
msprof --application="/home/projects/main parameter1 parameter2 ..."
Training scenario: msprof --application="/home/projects/run.sh parameter1 parameter2 ..."
This parameter has a higher priority than ASCEND_WORK_PATH. For details, see the Environment Variables.
The path cannot contain the following characters: "\n", "\\n", "\f", "\\f", "\r", "\\r", "\b", "\\b", "\t", "\\t", "\v", "\\v", "\u007F", "\\u007F", "\"", "\\\"", "'", "\'", "\\", "\\\\", "%", "\\%", ">", "\\>", "<", "\\<", "|", "\\|", "&", "\\&", "$", "\\$", ";", "\\;", "`", "\\`".
When you pass the user application or execution script by adding the AI task execution command to the end of the msprof command, the profile data is flushed to the current directory by default.
When you pass the user application or execution script is passed by adding the AI task execution command to --application, the profile data is flushed to the directory where the AI task file is stored by default.
You are not advised using the directories owned by other users to overwrite the original environment variables, so as to avoid privilege escalation risks.
The value format is --environment="${envKey}=${envValue}" or --environment="${envKey1}=${envValue1};${envKey2}=${envValue2}".
The value range is [200, 4294967295], in MB, for example, --storage-limit=200MB. By default, this option is not set.
If this parameter is not set and the available disk space is less than 20 MB before profiling, data is not flushed to the disk.
msprof --output=/home/projects/output /home/projects/MyApp/out/main
After the msprof command is executed, the profile data file is automatically parsed and exported. For details, see Profile Data File References..