Function: dump_reg_callback

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

Registers the dump data callback function.

The Function: init_dump, Function: dump_reg_callback, Function: dump_unreg_callback, and Function: finalize_dump APIs are used together to obtain the dump data by using the callback function. (The callback function registered by using this API needs to be implemented by the user. The implementation logic of the callback function includes obtaining 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)
    

Parameters

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

Return Value

Description

ret

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

Restrictions

None