Top Overflow/Underflow Operator Parsing
Operator overflow/underflow may occur during AI service running. In this case, do not directly perform accuracy comparison; otherwise, the comparison result will be inaccurate. Instead, you can perform Viewing Data of Overflowed/Underflowed Operators to detect and collect information about overflow/underflow operators, and generate the operator overflow/underflow data file and the dump file of the overflow/underflow operators.
If the time when the operator overflow/underflow data file and the dump file of the overflow/underflow operators are flushed to a disk is inconsistent with the overflow/underflow time of the operators, the first overflow/underflow operator cannot be located in the two files in a timely manner.
To help quickly locate overflow/underflow operators, the top overflow/underflow operator parsing function described in this section can analyze the generated debug file and the dump file of the overflow/underflow operators and display the key information about the top N overflow/underflow operators.
Command Syntax
The command line for operator overflow/underflow detection is as follows:
python3 msaccucmp.py overflow -d <dump_path> -out <output_path> [-n <topn>]
Table 1 describes the command-line options.
This function is implemented through the msaccucmp.py script, which is stored in ${INSTALL_DIR}/tools/operator_cmp/compare. 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..
Option |
Description |
Mandatory (Yes/No) |
|---|---|---|
-d --dump_path |
Directory for storing the debug file and the dump file of overflow/underflow operators. Refer to Viewing Data of Overflowed/Underflowed Operators to obtain the file directory. If the dump file does not exist in the directory, the .npy file will be missing in the -out output. If the debug file does not exist in the directory, no overflow/underflow occurs. |
Yes |
-out --output_path |
Output directory for storing result files of operator overflow/underflow analysis. The output files are as follows:
If the .npy file is missing, the result file cannot parse the input and output information of the overflow/underflow operators. You are not advised to configure directories that are different from those of the current user to avoid privilege escalation risks. |
Yes |
-n --topn |
Parses the first N operators that are overflowed/underflowed. The value ranges from 1 to 5. The default value is 1. |
No |
Procedure
Before conducting operator overflow/underflow analysis, perform operator overflow/underflow detection on the dump file and generate the debug file and the dump file of the overflow/underflow operators. For details, see Viewing Data of Overflowed/Underflowed Operators.
To detect operator overflow/underflow using the CLI, perform the following steps:
Ensure that the operation user has the read and write permissions on the result file path specified by --out.
- Log in to the CANN tool installation environment.
- Go to the ${INSTALL_DIR}/tools/operator_cmp/compare directory. 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..
- Run the operator overflow/underflow detection command.
python3 msaccucmp.py overflow -d /MyApp20/dump -out /MyApp20/out -n 3
Figure 1 shows the content of the overflow_summary_{timestamp}.txt file generated after operator overflow/underflow detection.
In the result file, the following information is displayed from top to bottom:
- 1 to n indicate the first overflow/underflow operator to the nth overflow/underflow operator that are parsed.
- Type and name of each overflow/underflow operator.
- Overflow/Underflow information of each operator, including the overflow/underflow type, overflow/underflow task ID, stream ID, and overflow/underflow error code.
- timestamp: overflow/underflow timestamp of each operator.
- *.input.*.npy: .npy file of the input data of the overflow/underflow operators.
- Below the *.input.*.npy file name, key input information about operator overflow/underflow in the file is displayed, including the data format, data dimension, data type, maximum value, minimum value, and average value.
- *.output.*.npy: .npy file of the output data of the overflow/underflow operators.
- Below the *.output.*.npy file name, key output information about operator overflow/underflow in the file is displayed, including the data format, data dimension, data type, maximum value, minimum value, and average value.
