Function: finalize_reference
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 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 is incremented 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 performs deinitialization.
Prototype
-
C Prototype
aclError aclFinalizeReference(uint64_t *refCount) -
Python Function
count, ret = acl.finalize_reference()
Parameters
None
Return Values
| Return Value | Description |
|---|---|
| count | Int, reference count. |
| ret | Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails. |
Constraints
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 acl.finalize or acl.finalize_reference in the destructor. Otherwise, the process may exit abnormally due to the unknown singleton destruction sequence.