Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
This function is used to parse and export profile data.
msprof --export=on --output=<dir> [--type=<type>] [--reports=<reports_sample_config.json>] [--model-id=<number>] [--iteration-id=<number>] [--summary-format=<csv/json>] [--clear=on]
Option |
Description |
Required/Optional |
|---|---|---|
--export |
Profile data parsing and export, The value can be on or off (default).
To export data of a specific model (model ID) or iteration (iteration ID), run the msprof --export command again to configure the --model-id and --iteration-id options after the msprof profiling command is executed. The PROF_XXX files that are not parsed are automatically parsed and then exported. Example: msprof --export=on --output=/home/profiler_data/PROF_XXX |
Required |
--output |
Directory for storing the profile data file. The value must be the PROF_XXX directory or the parent directory of the PROF_XXX directory, for example, /home/profiler_data/PROF_XXX. The path cannot contain the following characters: "\n", "\\n", "\f", "\\f", "\r", "\\r", "\b", "\\b", "\t", "\\t", "\v", "\\v", "\u007F", "\\u007F", "\"", "\\\"", "'", "\'", "\\", "\\\\", "%", "\\%", ">", "\\>", "<", "\\<", "|", "\\|", "&", "\\&", "$", "\\$", ";", "\\;", "`", "\\`". |
Required |
--type |
Format of the profile data parsing result file. That is, you can choose the format of the result file generated after the profile data collected by the msprof command is automatically parsed. The available formats include:
The default value is text. |
Optional |
--reports |
After the custom reports_sample_config.json configuration file is passed, the corresponding profile data files are exported based on the range specified in the configuration file. For details, see Example (--reports). |
Optional |
--model-id |
Model ID. The value must be a positive integer. This parameter must be used together with --iteration-id to export the profile data of a specified computing iteration in the model. If neither --iteration-id nor --model-id is specified, all profile data is exported by default.
|
Optional |
--iteration-id |
Iteration ID. The value must be a positive integer. This parameter must be used together with --model-id to export the profile data of a specified computing iteration in the model. If neither --iteration-id nor --model-id is specified, all profile data is exported by default.
|
Optional |
--summary-format |
Export format of a summary data file. The values are as follows:
Supported only when --type=text. |
Optional |
--python-path |
Path to the Python interpreter used for parsing. The Python version must be 3.7.5 or later. If the default Python version in the environment is earlier than 3.7.5, use this parameter to set the Python version to 3.7.5 or later. If this option is executed by a user with higher permissions, do not specify a path with low permissions. |
Optional |
--clear |
Data simplification mode. After this option is enabled, the sqlite directory in PROF_XXX/device_{id} is deleted after profile data is exported, so as to save storage space. The value can be on or off (default). |
Optional |
Specify the /home/profiler_data/PROF_XXX directory as the profile data directory and run the following command:
msprof --export=on --output=/home/profiler_data/PROF_XXX
Specify the /home/profiler_data/PROF_XXX directory as the profile data directory, pass the custom reports_sample_config.json configuration file, and run the following command:
msprof --export=on --output=/home/profiler_data/PROF_XXX --reports=${INSTALL_DIR}/tools/profiler/profiler_tool/analysis/msconfig/reports_sample_config.json
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.
The path cannot contain the following characters: "\n", "\\n", "\f", "\\f", "\r", "\\r", "\b", "\\b", "\t", "\\t", "\v", "\\v", "\u007F", "\\u007F", "\"", "\\\"", "'", "\'", "\\", "\\\\", "%", "\\%", ">", "\\>", "<", "\\<", "|", "\\|", "&", "\\&", "$", "\\$", ";", "\\;", "`", "\\`".
By default, the reports_sample_config.json file is stored in the ${INSTALL_DIR}/tools/profiler/profiler_tool/analysis/msconfig/ directory. The content of the file is as follows:
The reports_sample_config.json file can be created in any directory, on which you have read and write permissions.
{
"json_process": {
"ascend": true,
"acc_pmu": true,
"cann": true,
"ddr": true,
"stars_chip_trans": true,
"hbm": true,
"communication": true,
"hccs": true,
"os_runtime_api": true,
"network_usage": true,
"disk_usage": true,
"memory_usage": true,
"cpu_usage": true,
"msproftx": true,
"npu_mem": true,
"overlap_analyse": true,
"pcie": true,
"sio": true,
"stars_soc": true,
"step_trace": true,
"freq": true,
"llc": true,
"nic": true,
"roce": true,
"qos": true,
"device_tx": true
}
}
The preceding parameters are switches for profiling specific data. You can set them to true or false (or delete unwanted fields). The following timeline data layers in the msprof_*.json file can be profiled: CANN, Ascend Hardware, AI Core Freq, On-Chip Memory, Communication, Overlap Analysis, and NPU_MEM.
After the msprof --export command is executed, the mindstudio_profiler_output directory is generated in the PROF_XXX directory.
The structure of the generated profile data directory is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | └── PROF_XXX ├── device_0 │ └── data ├── device_1 │ └── data ├── host │ └── data ├── msprof_*.db └── mindstudio_profiler_output ├── msprof_{timestamp}.json ├── step_trace_{timestamp}.json ├── xx_*.csv ... └── README.txt |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | └── PROF_XXX1 ├── device_0 │ └── data ├── host │ └── data ├── msprof_*.db └── mindstudio_profiler_output ├── msprof_{timestamp}.json ├── step_trace_{timestamp}.json ├── xx_*.csv ... └── README.txt └── PROF_XXX2 ├── device_1 │ └── data ├── host │ └── data ├── msprof_*.db └── mindstudio_profiler_output ├── msprof_{timestamp}.json ├── step_trace_{timestamp}.json ├── xx_*.csv ... └── README.txt |