show_kernel_debug_data
In the static graph scenario, all operators of the entire graph are offloaded to the NPU for execution. The single-operator debugging information (through the printf API) on the kernel can be obtained only after the model execution is complete. This tool provides the offline parsing capability to help users obtain and parse the debugging information (parse the .bin file into a readable format).
show_kernel_debug_data can be called by multiple users concurrently. However, users need to specify different flushing paths. Otherwise, the flushed content may be overwritten.
This tool supports the following product models:
Tool Installation
- Install the tool.
The tool is released with the CANN package. (For details about how to install the CANN package, see Environment Setup.) The default path is ${INSTALL_DIR}/tools/ascendc_tools/show_kernel_debug_data. Replace ${INSTALL_DIR} with the actual CANN component directory. If the Ascend-CANN-Toolkit package is installed as the root user, the CANN component directory is /usr/local/Ascend/ascend-toolkit/latest.
- Set environment variables.
- Install the Ascend-CANN-Toolkit package as the root user:
1 2
source /usr/local/Ascend/ascend-toolkit/set_env.sh source /usr/local/Ascend/ascend-toolkit/latest/toolkit/bin/setenv.bash
- Install the Ascend-CANN-Toolkit package as a non-root user:
1 2
source ${HOME}/Ascend/ascend-toolkit/set_env.sh source ${HOME}/Ascend/ascend-toolkit/latest/toolkit/bin/setenv.bash
- Install the Ascend-CANN-Toolkit package as the root user:
- Check whether the tool is successfully installed.Run the following command. If --help or -h is displayed, the tool environment is normal and the functions are normal.
1show_kernel_debug_data -h
How to Use
- Command line
1show_kernel_debug_data ${bin_file_path} ${output_path}
Parameter
Description
Default Value
Required (Yes/No)
${bin_file_path}
Path of the .bin file for flushing kernel debugging information to the disk.
-
Yes
${output_path}
Path for saving the parsed result.
The default path is the path where the current command is executed.
No
The following is an example of the command line:
1show_kernel_debug_data ./input/dump_workspace.bin ./output_dir
- API
Table 1 Description of the show_kernel_debug_data API Prototype
def show_kernel_debug_data(bin_file_path: str, output_path: str = './') -> None
Function
Obtains the debugging information on the kernel and parses the information into a readable file.
Input Parameter
bin_file_path
Path of the .bin file for flushing kernel debugging information to the disk. The value is of the string type.
output_path
Path for saving the parsed result. The value is of the string type. The default path is the path where the current API calling script is located.
Output Parameter
N/A
-
Returns
N/A
-
Constraints
None
Example
1 2
from show_kernel_debug_data import show_kernel_debug_data show_kernel_debug_data(./input/dump_workspace.bin)
Result
The directory structure of the parsed result file is as follows:
1 2 3 |
├ ${output_path} ├── PARSER_${timestamp} // ${timestamp} indicates the timestamp. │ ├── parser.log // Tool parsing log, including the routine process on the kernel and printf information. |