1. Overview
This section describes the basic concepts, pyACL expression conventions, synchronous/asynchronous APIs, and deprecated APIs of CANN Runtime.
pyACL Conventions
API Naming Conventions
The APIs are named according to the following rules:
- acl+API class+Operation verb+Object noun.
- The Operation verb and Object noun fields are written with the first letter capitalized.
API Classes
| API Class | Abbreviation | Description |
|---|---|---|
| runtime | rt | Runtime |
| CBLAS | blas | Basic Linear Algebra Subprograms |
| Profiling | prof | Profiling configurations |
Note
- The abbreviation of each class name contains a maximum of four letters.
- If the class name coincides with the operation object name, the object name is omitted. For example,
acl.mdl.load_from_file_with_memis a model API for loading model from file andmdlafterLoadis omitted in the API name.
Variable Naming
In the code examples provided in this guide, a variable with an underscore (_) suffix (for example, deviceId) is private to the corresponding class.
Conventions
In this document, API or parameter status identifiers such as "Supported", "Not supported", "Experimental", "Reserved", and "Deprecated" are used. The meanings of these identifiers are as follows:
-
"Supported": indicates that an API or parameter is supported.
-
"Unsupported": indicates that an API or parameter is not supported. If that API or parameter is used, undefined behavior will occur. For example, the API returns an error or subsequent service functions are abnormal.
-
"Reserved": indicates that an API or parameter is reserved. Currently, the API or parameter is not implemented or the functionality is not complete and cannot be called. The API or parameter may be available in later versions.
-
"Deprecated": indicates that an API or parameter is planned to be removed in later versions. You are advised to use the replacement API or parameter provided in this document.
Synchronous and Asynchronous APIs
CANN supports several explicit synchronization types. After these types of APIs are called, the host thread blocks until the related tasks are completed.
-
Device synchronization:
acl.rt.synchronize_deviceBlocks the current host thread until all explicitly or implicitly created streams on the device complete all previously delivered tasks. Avoid using this function as much as possible, because it delays host running.
-
Stream synchronization:
acl.rt.synchronize_streamBlocks the current host thread until the specified stream completes all delivered tasks.
-
Event synchronization:
acl.rt.synchronize_eventBlocks the current host thread until the specified event is completed. It is a finer-grained synchronization.
For asynchronous APIs, the API call only indicates that tasks are delivered. The function is returned to the host thread before the tasks are completed. You need to call the explicit synchronization APIs to block the host thread until the tasks are completed.
Deprecated APIs and Return Codes
APIs
-
This API will be deprecated in later versions. Use the acl.get_data_buffer_size_v2 API instead.
-
This API will be deprecated in later versions. Use the acl.rt.query_event_status API instead.
-
This API will be deprecated in later versions. Use the acl.util.bytes_to_ptr API instead.
-
acl.util.numpy_contiguous_to_ptr
This API will be deprecated in later versions. Use the acl.util.bytes_to_ptr API instead.
-
This API will be deprecated in later versions. Use the acl.util.ptr_to_bytes API instead.
Return Code
-
This return code will be deprecated in future releases. Use ACL_SUCCESS instead.
-
This return code will be deprecated in future releases. Use ACL_ERROR_GE_AIPP_NOT_EXIST instead.
-
ACL_ERROR_STREAM_NOT_SUBSCRIBE
This return code will be deprecated in future releases. Use ACL_ERROR_RT_STREAM_NO_CB_REG instead.
-
ACL_ERROR_THREAD_NOT_SUBSCRIBE
This return code will be deprecated in future releases. Use ACL_ERROR_RT_THREAD_SUBSCRIBE instead.
-
ACL_ERROR_WAIT_CALLBACK_TIMEOUT
This return code will be deprecated in future releases. Use ACL_ERROR_RT_REPORT_TIMEOUT instead.
-
This return code will be deprecated in future releases. Use ACL_ERROR_RT_INVALID_DEVICEID instead.
-
This return code will be deprecated in future releases. Use ACL_ERROR_RT_GROUP_NOT_SET instead.
-
This return code will be deprecated in future releases. Use ACL_ERROR_RT_GROUP_NOT_CREATE instead.