Function: finalize_reference

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

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

acl.finalize_reference involves 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 the acl.finalize API and this API is that the acl.finalize API clears the count and directly performs deinitialization.

Prototype

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

Parameters

None

Return Value

Return Value

Description

count

Int, reference count.

ret

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

Restrictions

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

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