Function: dump_reg_callback

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

Function Usage

Registers the dump data callback function.

Function: init_dump, Function: dump_reg_callback, Function: dump_unreg_callback, and Function: finalize_dump work together to obtain dump data through a callback function. The callback function registered through Function: dump_reg_callback needs to be implemented by users, and the implementation logic of the callback function must include the acquisition of the dump data and data length. The specific scenarios are exemplified as follows:

Prototype

  • C Prototype
    1
    aclError acldumpRegCallback(int32_t (* const messageCallback)(const acldumpChunk *, int32_t len), int32_t flag)
    
  • Python Function
    1
    ret = acl.mdl.dump_reg_callback(mdl_dump_callback, flag)
    

Parameter Description

Parameter

Description

mdl_dump_callback

Callback function used to receive callback data. It has the following parameters:

  • dump_chunk: dict. When the mdl_dump_callback function is implemented, the values of parameters such as data_fuf and buf_len in dump_chunk can be obtained to obtain the dump data and data length.
    {
        "file_name": file_name,   // Name of the dump file to be flushed to drives
        "data_buf": data_buf,     // Memory address of the dump data
        "buf_len": buf_len,       // data_buf length, in bytes
        "is_last_chunk": is_last_chunk, // Indicates whether the dump data is the last fragment. The value 0 indicates that the dump data is not the last fragment, and the value 1 indicates that the dump data is the last fragment.
        "offset": offset,         // Offset of the dump data file content. –1 indicates the content to be added to the file.
        "flag": flag              // Reserved dump data flag. The current data has no flag.
    }

flag

Int, whether to write dump data to a drive after the callback API is called.

  • 0: no. Currently, only the value 0 is supported.

Return Value Description

Return Value

Description

ret

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

Restrictions

None.