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 text file using numpy.savetxt.

  1. Log in to the development environment as the installation user.
  2. Go to the /home/HwHiAiUser/Ascend/ascend-toolkit/latest/tools/operator_cmp/compare directory.
  3. Run the msaccucmp.py script to convert the dump file into the NumPy format. The following is an example:
    python3 msaccucmp.py convert -d dump_file [-out output] [-f format -s shape] [-o output_tensor] [-i input_tensor] [-v version] [-t type]
    Table 1 Command-line options for format conversion

    Option

    Description

    Mandatory or Not

    -d

    --dump_file

    Dump file of a model running on Ascend AI ProcessorNPU IP Accelerator.

    This option can specify a single file, a single path, or multiple files separated with commas (,), for example, -d /{PATH}/dump_file1,/{PATH}/dump_file2.

    Yes

    -out

    --output

    Directory of the converted data. Defaults to the current path.

    No

    -f

    --format

    • If the command contains -f, data is converted to a specified format. If the dump file contains the original_shape field, the data is tiled based on original_shape.
    • If the command does not contain -f, the dump file is parsed.

    No

    -s

    --shape

    Shape to be set for FRACTAL_NZ conversion. The shape format is ([0-9]+,)+[0-9]+, where each number must be greater than 0. Valid only when -f is configured.

    No

    -o

    --output_tensor

    Index of the output to convert. Mutually exclusive with -i. Valid only when -f is configured.

    If neither -o nor -i is included, all inputs and outputs are converted.

    No

    -i

    --input_tensor

    Index of the input to convert. Mutually exclusive with -o. Valid only when -f is configured.

    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:

    • npy: The output file is saved in NumPy format.
    • msnpy: The output file is saved in NumPy format, which is generally used in MindSpore scenarios.
    • bin: The output file is saved in binary format.

    The default value is npy.

    No

  4. Use Python to save the NumPy data into a text file.
    $ python3
    
    >>> import numpy as np
    >>> a = np.load("/home/HwHiAiUser/dumptonumpy/Pooling.pool1.1147.1589195081588018.output.0.npy")
    >>> b = a.flatten()
    >>> np.savetxt("/home/HwHiAiUser/dumptonumpy/Pooling.pool1.1147.1589195081588018.output.0.txt", b)

    The dimension information and Dtype no longer exist in the .txt file. For details, visit the NumPy website.