Information Collection
This section uses the Atlas 200I A2 Inference Acceleration Module as an example to explain how to collect the information typically required for inference deployment on this platform.
Collecting Profiling Information
For details about how to collect Profiling data, see the "General Collection Commands" section in Profiling Instructions.
- Log in to the operating environment and go to the /var directory where the msprof tool is stored.
- Run the following command to collect performance data. In the command, application indicates the user program.
msprof --output={path} {application}Command example:
msprof --output=${HOME}/profiling_output ${HOME}/HIAI_PROJECTS/MyAppname/out/main - After the command is executed, check that the PROF_XXX subdirectory is generated in the directory specified by --output. The subdirectory structure is as follows:
├── device_{id} │├──data │└──... └──host │├──data │└──... - Upload the PROF_XXX subdirectory to the development environment where the toolkit package is installed, and run the following command to parse data:
msprof --export=on --output=<dir>
Data files will be added to the PROF_XXX subdirectory with the following structure:
├── device_{id} │├──data ├──host │├──data │└──... └──mindstudio_profiler_output │├──xx_*.csv │├──xx_*.json │└──... ...
Collecting Logs for Converting ONNX Files to OM Files Using the ATC Tool
Set the log level for converting ONNX files and direct the log output to a file for analysis. The procedure is as follows:
- Configure the environment variables for running Ascend Tensor Compiler (ATC):
export ASCEND_SLOG_PRINT_TO_STDOUT=1 export ASCEND_GLOBAL_LOG_LEVEL=0
- Add --log=debug to the ATC command to collect conversion logs.
Command example:
atc --model=$modelPath/$onnxfile \ --log=debug \ --framework=5 \ --input_shape="x:$batchsize,3,$height,$width" \ --input_fp16_nodes="x" \ --output_type=FP16 \ --op_select_implmode=high_precision \ --output=$outputPath/$outname \ --soc_version=Ascendxxxyy \ # xxxyy indicates the actual processor type.
- Run ATC again to redirect the output information to a log file in text format and obtain the fusion_result.jsonl file generated during ATC execution for subsequent performance analysis.
Collecting Inference Logs
Run OM files for inference and collect the inference output logs. The collection procedure is as follows:
- Configure the environment variables for running the OM model.
export ASCEND_SLOG_PRINT_TO_STDOUT=1 export ASCEND_GLOBAL_LOG_LEVEL=1
- Run OM files and redirect the output information to a log file in text format.
Returning ONNX and OM Files Before and After Conversion Using ATC
ONNX is a mainstream model format in the industry and is widely used for model communication and deployment. Offline inference requires that ONNX files be converted into OM files for inference.
You need to collect the ONNX files exported from the model running in the training environment and the OM files generated after conversion for subsequent analysis.