Preparing Dump Data of an Offline Model

Prerequisites

This section describes how to dump data of an offline model in MindStudio. Before dumping data, perform the following operations:

  • Use ATC to convert a Caffe, TensorFlow, or ONNX model into an offline OM model. For details, see Model Conversion and Tuning.
  • Develop, build, and run your application project, which means that you have an executable application project. For details, see Application Development.

Generating the Dump File

To generate dump data, perform the following steps:

  1. Open MindStudio and choose Ascend > Dump Configuration from the menu bar. The Select Offline Model dialog box is displayed, as shown in Figure 1.

    You can also open the project file, right-click your .om file, and choose Dump Configuration.

    Figure 1 Selecting an .om model
  2. Select an .om file and click OK. The network topology of the model is displayed. Perform Dump Configuration, as shown in Figure 2.
    • To dump multiple models, perform Dump Configuration for each .om file separately.
    • If similar models are used, they might have the same Model Name. As a result, there is some confusion between the dump configurations in the acl.json file.

      For example, if the values of YOLOv2 and YOLOv3 in Model Name are the same, and the dump configuration of YOLOv2 has been recorded in the acl.json file, then the dump configuration of YOLOv2 applies to YOLOv3.

      To ensure each model has a unique Model Name, change the name field in the Caffe prototxt file and re-convert the model. You can also choose None during Dump Configuration to clear the previous configuration, and start Dump Configuration all over.

    Figure 2 Setting dump

    Set the dump parameters of the .om file on the right of the window.

    Table 1 Parameters

    Parameter

    Description

    Dump Option

    Dump range. Possible values are:

    • ALL: dumps all operators.
    • Several: dumps specified operators. Right-click the operator to be dumped and choose Enable Dump.
    • None: disables dump.

    Dump Mode

    Data dump mode. Possible values are:

    • All: dumps both the operator input and output.
    • Input: dumps the operator input.
    • Output: dumps the operator output.

    Dump Path

    Path for storing dump files. Defaults to {project_path}/dump. If the parameter is set to a different path, ensure that the MindStudio installation user has the read and write permissions on the path.

    AclConfig File

    ACL configuration file, which stores the dump configuration information of the operator during the dump operation. Generally, the path is {project_path}/src/acl.json. You can search for the actual path in the {project_path}/.project file. The format is shown in Figure 3 or Figure 4. To dump all operators of a model, the layer field is not included.

    • TBE and AI CPU operators that do not have outputs (for example, StreamActive, NetOutput, Send, Recv, and const) do not generate dump data.
    • Operators that are not executed on the AI CPU or AI Core (for example, concatD) after build do not generate dump data.
    • When only certain operators are to be dumped, since the Data operators are not executed on the AI CPU or AI Core, you need to select all the downstream operators of the Data operator.
    • Use ATC to parse the .om file for obtaining the mapping between operators (for example, newly-added, one-to-many, many-to-one, many-to-many, and L1 batch). Mapped operators should have the same Enable Dump setting.
    • Dump cannot be enabled for const operators.
    Figure 3 Dumping all operators
    Figure 4 Dumping several operators
  3. After the dump configuration is complete, click Build and Run in MindStudio to build and run the application project.

    Check the project file code to ensure the .om file with dump configured is used. For example, check aclmdlLoadFromFile() or aclmdlLoadFromFileWithMem().

    After the project is run, find the dump data in the {project_path}/dump path. The path and format are described as follows:

    time/device_id/model_name/model_id/data_index/dump_file
    Table 2 Field description

    Field

    Description

    time

    Dump time, formatted as YYYYMMDDhhmmss.

    device_id

    Device ID.

    model_name

    Model name.

    model_id

    Model ID.

    data_index

    Execution sequence number of each task, indexed starting at 0. This value is increased by 1 every dump.

    dump_file

    Dump File Naming Conventions describes the naming rules.

    Note: Periods (.), forward slashes (/), backslashes (\), and spaces in model_name, op_type, or op_name are replaced with underscores (_).