Profiling with Environment Variables
Profiling with environment variables applies to training/online inference of the TensorFlow framework. Unlike the profiling mode using the TensorFlow framework API, the environment variable mode is to directly insert the PROFILING_OPTIONS environment variable into the training/online inference script to configure profiling items.
Prerequisites
- Training scenario:
- Prepare a model trained on TensorFlow 1.15 and a matched dataset, and port the model to the Ascend AI Processor. For details, see TensorFlow 1.15 Model Porting Guide.
- Prepare a model trained on TensorFlow 2.x and a matched dataset, and port the model to the Ascend AI Processor. For details, see TensorFlow 2.6.5 Model Porting Guide.
- Online inference scenario: Download a pre-trained model and prepare the online inference script.
Procedure
export PROFILING_MODE=true
export PROFILING_OPTIONS='{"output":"/tmp/profiling","training_trace":"on","task_trace":"on","fp_point":"","bp_point":"","aic_metrics":"PipeUtilization"}'
For details about PROFILING_OPTIONS, see Profiling Options.
If PROFILING_MODE is set to true but PROFILING_OPTIONS is not set, training_trace, task_trace, hccl, aicpu, and aic_metrics (PipeUtilization) are executed by default, and the profiled data is saved to the directory where the current AI task is located. If PROFILING_MODE is set to true and PROFILING_OPTIONS is set, see Profiling Options for the default settings of PROFILING_OPTIONS.
Profiling Results
After the PROFILING_OPTIONS parameter is set, parse the raw data, export the result files as visualized profile data files, and save these files in the PROF_XXX/mindstudio_profiler_output directory. For details, see Offline Parsing.
Table 1 shows the result files.