Obtaining the GPU/NPU Mapping Table

Description

The .json file and directory names in this section are only examples. Replace them with the actual ones. Ensure that the operation user has the read and write permissions on the result path specified by --out.

Procedure

  1. Log in to the development environment as the HwHiAiUser user.
  2. Generate a .json file.
    atc --mode=1 --om=$HOME/data/resnet50.om --json=$HOME/data/resnet50.json
  3. 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..
  4. Run the following command to obtain the GPU/NPU mapping table:

    There are multiple dump and .npy data files used for comparison. Therefore, the -m and -g options in the following steps must specify the parent directory of the data files, for example, $HOME/MyApp/resnet50. The resnet50 folder is used to store the comparison data files.

    The directory structure is as follows:

    1
    2
    3
    4
    5
    6
    root@xxx:$HOME/MyApp/resnet50# tree
    .
    ├── BatchMatMul.bert_encoder_layer_0_attention_self_MatMul_1.24.1614717261785536
    ├── BatchMatMul.bert_encoder_layer_0_attention_self_MatMul.21.1614717261768864
    ├── BatchMatMul.bert_encoder_layer_10_attention_self_MatMul_1.235.1614717263664916
    # This is only an example. The remaining file names are omitted here.
    
    python3 msaccucmp.py compare -m $HOME/MyApp_mind/resnet50 -g $HOME/Standard_caffe/resnet50 -f $HOME/data/resnet50.json -out $HOME/result -map

    Figure 1 shows the content of the output mapping_*.csv file.

    Figure 1 GPU/NPU mapping table
    Table 1 Output options

    Option

    Description

    Index

    ID of an operator.

    OpType

    Operator type. It is used to obtain the operator type when the -f, -cf, or -q option is specified.

    NPUDump

    Name of the operator that generates the dump data during running on the Ascend AI Processor.

    GroundTruth

    Name of the operator that generates the dump or .npy data during running on the GPU/CPU.

    TensorIndex

    Input ID and output ID of the operator that generates the dump data during running on the Ascend AI Processor.

    NPUDumpPath

    Path of the dump file generated based on the operator running on the Ascend AI Processor.

    GroundTruthPath

    Path of the dump or .npy file generated based on the operator running on the GPU/CPU.