Function: dump_reg_callback

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

Registers the dump data callback function.

The function: init_dump, function: dump_reg_callback (the callback function registered through this API needs to be implemented by the user. The implementation logic of the callback function includes obtaining the dump data and data length), function: dump_unreg_callback, and function: finalize_dump APIs are used together to obtain dump data through the callback function. The following are some example scenarios:

Prototype

  • C Prototype

    aclError acldumpRegCallback(int32_t (* const messageCallback)(const acldumpChunk *, int32_t), int32_t flag)
    
  • Python Function

    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. Currently, the 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 Values

Return Value Description
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

None