Function: finalize_reference

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

Performs deinitialization to destroy the resources used by the ACL API in the process.

acl.finalize_reference involves the implementation of reference counting. Each time acl.init is called, the reference count increases by 1. Each time acl.finalize_reference is called, the reference count decreases by 1. Deinitialization is performed only when the reference count decreases to 0. The difference between acl.finalize and this API is that calling acl.finalize clears the count and directly deinitializes the resources.

Prototype

  • C Prototype
    1
    aclError aclFinalizeReference(uint64_t *refCount)
    
  • Python Function
    1
    count, ret = acl.finalize_reference()
    

Parameter Description

None

Return Value Description

Return Value

Description

count

Int, reference count.

ret

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

Restrictions

Before exiting the application process, ensure that aclFinalize or acl.finalize_reference has been called to complete deinitialization. Otherwise, there may be exceptions. For example, an error is reported when the application process exits.

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