In the Ascend C operator program code, you can use the AscendC::DumpTensor, AscendC::printf, AscendC::PrintTimeStamp, and ascendc_assert APIs to print related debugging information, and enable the dump configuration by using aclInit or directly configuring the acl.json file to export the debugging information of the Ascend C operator kernel. This tool provides the capability of parsing debugging information in offline mode to help users obtain and parse the debugging information, that is, parsing the .bin file into a readable format. For details about usage example of this tool, see show_kernel_debug_data sample.
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.
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
x |
The tool is released with the CANN software package. (For details about how to install the CANN software package, see Environment Setup.) The default path is ${INSTALL_DIR}/tools/show_kernel_debug_data. 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.
source /usr/local/Ascend/cann/set_env.sh
source ${HOME}/Ascend/cann/set_env.shshow_kernel_debug_data -h
show_kernel_debug_data <bin_file_path> [<output_path>]
|
Parameter |
Optional/Required |
Description |
|---|---|---|
|
<bin_file_path> |
Required |
BIN file to which the kernel debugging information is flushed or the path that contains the BIN file name, for example, /input/dump_workspace.bin. |
|
<output_path> |
Optional |
Path for saving the parsing result, for example, /output_dir. The default path is the path where the current command is executed. |
def show_kernel_debug_data(bin_file_path: str, output_path: str = './') -> None
Input parameters of the function are as follows. The function does not have output parameters and return values.
The call sample code is as follows:
1 2 |
from show_kernel_debug_data import show_kernel_debug_data show_kernel_debug_data(./input/dump_workspace.bin) |
The directory structure of the parsing result file is as follows: The dump_data directory contains the parsing results of the DumpTensor and PrintTimeStamp APIs. index0 corresponds to the printing result when the second parameter desc of the DumpTensor API is set to 0. loop0 indicates the data printing of the first block after splitting.
├ ${output_path}
├── PARSER_${timestamp} // ${timestamp} indicates the timestamp.
├── dump_data
│ ├── 0 // Parsing result of core 0
│ ├── core_0_index_0_loop_0.bin // Flushing information of core 0, desc 0, and progress 0
│ ├── core_0_index_0_loop_0.txt // Parsing result of core 0, desc 0, and progress 0
...
│ ├── core_0_index_2_loop_15.bin // Flushing information of core 0, desc 2, and progress 15
│ ├── core_0_index_2_loop_15.txt // Parsing result of core 0, desc 2, and progress 15
│ └── time_stamp_core_0.csv // Timestamp information
│ ├── 1 // Parsing result of core 1
│ ├── 2 // Parsing result of core 2
...
│ └── index_dtype.json // Mapping between indexes and data types
└── parser.log // Parsing log, including the print information of the printf and ascendc_assert APIs