Function: finalize

Applicable Products

Product

Supported (√/x)

Ascend 950PR / Ascend 950DT

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

Description

Performs deinitialization to destroy allocations.

A 2,000 ms timeout interval is added by default (the maximum timeout is 2,000 ms) for the transfer of device logs to ensure the integrity of error- and event-level logs. You can set the ASCEND_LOG_DEVICE_FLUSH_TIMEOUT environment variable to 0 (by using the export ASCEND_LOG_DEVICE_FLUSH_TIMEOUT=0 command) to cancel the timeout.

For details about the ASCEND_LOG_DEVICE_FLUSH_TIMEOUT environment variable, see Log Reference.

Prototype

  • C Prototype
    1
    aclError aclFinalize()
    
  • Python Function
    1
    ret = acl.finalize()
    

Parameters

None

Return Values

Return Value

Description

ret

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

Restrictions

Before an application process exits, this API must be explicitly called to deinitialize the application process. Otherwise, an exception may occur. For example, an error is reported when the application process exits.

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

Reference

For the API call example, see Initialization and Deinitialization.