Function: finalize

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

Performs deinitialization to destroy allocations.

By default, a 2000 ms delay (the actual maximum delay can reach 2000 ms) is added to this API call to return device service logs, ensuring that no ERROR- or EVENT-level logs are lost. You can set the ASCEND\_LOG\_DEVICE\_FLUSH\_TIMEOUT environment variable to 0 (example command: export ASCEND\_LOG\_DEVICE\_FLUSH\_TIMEOUT=0) to remove the default delay.

For details about the ASCEND\_LOG\_DEVICE\_FLUSH\_TIMEOUT environment variable, see "Logs > ASCEND_LOG_DEVICE_FLUSH_TIMEOUT" in Environment Variables.

Prototype

  • C Prototype

    aclError aclFinalize()
    
  • Python Function

    ret = acl.finalize()
    

Parameters

None

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

Before the application process exits, explicitly call this API or acl.finalize_reference to deinitialize the application. Otherwise, an exception may occur. For example, an error is reported when the application process exits.

You are advised not to call acl.finalize or acl.finalize_reference in the destructor. Otherwise, the process may exit abnormally due to the unknown singleton destruction sequence.

Reference

For details about API call examples, see "Initialization and Deinitialization" in "Application Development (Python)".