Function: set_dump

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Description

Sets dump configuration.

Prototype

  • C Prototype
    1
    aclError aclmdlSetDump(const char *dumpCfgPath)
    
  • Python Function
    1
    ret = acl.mdl.set_dump(dump_cfg_path)
    

Parameters

Parameter

Description

dump_cfg_path

  • Str, path of the configuration file, including the file name.

Currently, the following dump information can be configured: (If the operator input or output contains sensitive user information, information leakage may occur.)

  • Model dump configuration (used to export the input and output data of each operator layer in a model) and single-operator dump configuration (used to export the input and output data of a single operator). The exported data is used to compare with a specified model or operator, which affects the positioning accuracy. For details about the configuration examples, description, and restrictions, see Configuration File Example (for Model Dump and Single-Operator Dump). This dump configuration is disabled by default.
  • Dump configuration of the exception operator (used to export the input and output data, workspace information, and tiling information of the exception operator). The exported data is used to analyze AI Core errors. For details about the configuration example, see Configuration File Example (Exception Operator Dump Configuration). This dump configuration is disabled by default.
  • Dump configuration of the overflow/underflow operator (used to export the input and output data of the overflow/underflow operator in the model). The exported data is used to analyze overflow/underflow causes and locate model accuracy problems. For details about the configuration example, description, and restrictions, see Example of Overflow/Underflow Operator Dump Configuration. This dump configuration is disabled by default.
  • Operator Dump Watch mode configuration (enables the observation mode for the output data of a specified operator). If you suspect that the memory is overwritten by other operators after locating the accuracy issues of some operators and excluding the computation issues of the operators, you can enable the Dump Watch mode. For details about the configuration example and restrictions, see Dump Watch Configuration for Operators. The dump watch mode is disabled by default.

Return Value

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions

  • The configured dump information is valid only when the model is loaded after the dump function is enabled by calling this API. The dump configuration does not take effect on models loaded before this API call unless you reload the models after this API call.

    For example, in the following API call sequence, the dump configuration is valid only for model 2:

    acl.mdl.init_dump --> Model 1 loading --> acl.mdl.set_dump --> Model 2 loading --> --> acl.mdl.finalize_dump

  • If this API is called repeatedly to set dump configuration for the same model, the most recent configuration is applied.

    For example, in the following API call sequence, the second dump configuration call overwrites the first call:

    acl.mdl.init_dump --> acl.mdl.set_dump --> acl.mdl.set_dump --> Model 1 loading --> acl.mdl.finalize_dump

Reference

In addition, the acl.init API is provided. During initialization, the dump configuration information is transferred through the *.json file. After the application is run, the dump data is obtained. In this mode, the acl.init API can be called only once in a process. To modify the dump configuration, modify the configuration in the *.json file.

Dump Watch Configuration for Operators

Set dump_scene to watcher to enable the operator dump watch mode. The following is an example of the configuration file: (1) After operators A and B are executed, the output of operators C and D is dumped. (2) After the C and D operators are executed, the output of the C and D operators is also dumped. Compare the dump files of operators C and D in (1) and (2) to check whether operators A and B overwrite the output memory of operators C and D.

{
    "dump":{
        "dump_list":[
            {
                "layer":["A", "B"],
                "watcher_nodes":["C", "D"]
            }
        ],
        "dump_path":"/home/",
        "dump_mode":"output",
        "dump_scene":"watcher"
    }
}

The details are as follows:

  • If the operator dump watch mode is enabled, the overflow/underflow operator dump (by configuring the dump_debug parameter) or the single-operator model dump (by configuring the dump_op_switch parameter) cannot be enabled. Otherwise, an error will be reported. Dump watch cannot be applied in the single-operator API dump scenario.
  • In dump_list, the layer parameter is used to configure the names of the operators that may overwrite the memory of other operators, and the watcher_nodes parameter is used to configure the names of the operators with accuracy issues possibly due to output memory being overwritten by other operators.
    • If layer is specified, the output of the operators configured for watcher_nodes is dumped after all operators that support dump in the model are executed.
    • If any operator in layer and watcher_nodes is not in a static graph or static subgraph, the configuration does not take effect.
    • If an operator is in both layer and watcher_nodes or an operator in layer is a collective communication operator (the operator type starts with Hcom, for example, HcomAllReduce), only the dump files of operators in watcher_nodes will be exported.
    • For a fused operator, use its name after fusion when you add it to watcher_nodes. Otherwise, dump files cannot be exported.
    • Currently, model_name cannot be configured in dump_list.
  • If the operator dump watch mode is enabled, dump_path, which is the path for storing the exported dump file, must be configured.

    The exported dump files cannot be viewed using a text tool. To view the content of a dump file, convert the dump file to a NumPy file and then view the NumPy file using Python. For details about the conversion procedure, see Viewing Dump Data Files in Accuracy Analyzer.

    dump_path can be set to an absolute path or a relative path.
    • An absolute path starts with a slash (/), for example, /home.
    • A relative path starts with a directory name, for example, output.
  • dump_mode is used to specify the data of the operators configured for watcher_nodes to be exported. Currently, only output can be configured.