Viewing Dump Files
Dump files cannot be viewed with a text tool. Therefore, you need to convert your dump file into a NumPy file and save the NumPy file as a .txt file using numpy.savetxt.
This function is implemented through the msaccucmp.py script, which is stored in ${INSTALL_DIR}/tools/operator_cmp/compare. 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..
python3 msaccucmp.py convert -d dump_file [-out output] [-v version] [-t type]
Table 1 describes the command-line options.
Option |
Description |
Required |
|---|---|---|
-d --dump_file |
Dump file of a model running on Ascend AI Processor. You can specify a single file or a single path (recursive nesting is not supported, and only the parent directory of the file is supported). If you specify multiple files, separate the file names with commas (,), for example, -d /{PATH}/dump_file1,/{PATH}/dump_file2. |
Yes |
-out --output |
Directory of the converted data. Defaults to the current path. You are not advised to configure directories that are different from those of the current user to avoid privilege escalation risks. |
No |
-v --version |
Dump file type. 1: data file after Protobuf serialization; 2 (default): data file in a custom format. Defaults to 2. |
No |
-t --type |
Type of an output file. Possible values are:
The default value is npy. |
No |
Procedure
- Log in to the development environment as the installation user.
- Go to the ${INSTALL_DIR}/tools/operator_cmp/compare directory. 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..
- Run the msaccucmp.py script to convert the dump file into a NumPy file.
python3 msaccucmp.py convert -d $HOME/dump -out $HOME/dumptonumpy -v 2
- For details about the parameters of the msaccucmp.py script, see Converting Dump File Formats.
- The -d parameter supports the conversion of a single dump file or all dump files in a path (recursive nesting is not supported, and only the parent directory of a file is supported).
- Use Python to save the NumPy data into a .txt file. The following is an example:
$ python3 Python 3 (default, Mar 5 2020, 16:07:54)[GCC 5.4.0 20160609] on linuxType "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> a = np.load("$HOME/dumptonumpy/Pooling.pool1.1.1147.1589195081588018.output.0.npy") >>> b = a.flatten() >>> np.savetxt("$HOME/dumptonumpy/Pooling.pool1.1.1147.1589195081588018.output.0.txt", b)The shape and Dtype no longer exist in the .txt file. For details, visit the NumPy website.