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
Copies memory.
This API extends the functionality of aclrtMemcpyAsync. If the input memory is not allocated by pyacl APIs, this API returns after the memory copy is complete. Otherwise, this API is asynchronous. A successful call means the task is successfully delivered, not yet executed. To ensure the copy is complete, call a synchronization API (for example, acl.rt.synchronize_stream) after calling this API.
Prototype
- C Prototype
| aclError aclrtMemcpyAsyncWithCondition(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind, aclrtStream stream)
|
- Python Function
| ret = acl.rt.memcpy_async_with_condition(dst, dest_max, src, count, kind, stream)
|
Parameters
Parameter
|
Description
|
dst
|
Int, pointer to the destination memory address.
|
destMax
|
Int, memory size in bytes in the destination address
|
src
|
Int, pointer to the source memory address.
|
count
|
Int, size in bytes to copy.
|
kind
|
Int, memory copy type. - 0: ACL_MEMCPY_HOST_TO_HOST, memory copy within the host.
- 1: ACL_MEMCPY_HOST_TO_DEVICE, memory copy from the host to the device.
- 2: ACL_MEMCPY_DEVICE_TO_HOST, memory copy from the device to the host.
- 3: ACL_MEMCPY_DEVICE_TO_DEVICE, memory copy within the device. This API is not supported by the Atlas 500 Pro (model 3000).
- 4: ACL_MEMCPY_DEFAULT. The system determines the copy direction based on the source and destination memory addresses.
|
stream
|
Int, stream.
|
Return Values
Return Value
|
Description
|
ret
|
Int, error code. 0 on success; else, failure.
|
Constraints
Atlas inference products:
- Ascend EP form: This API does not support asynchronous memory copy within the host. If the input kind is ACL_MEMCPY_HOST_TO_HOST, the API returns ACL_ERROR_RT_FEATURE_NOT_SUPPORT.
Atlas 200I/500 A2 inference products:
- Ascend EP form: This API does not support asynchronous memory copy within the host. If the input kind is ACL_MEMCPY_HOST_TO_HOST, the API returns ACL_ERROR_RT_FEATURE_NOT_SUPPORT.
- Ascend RC: If the value of kind passed by this API is ACL_MEMCPY_HOST_TO_DEVICE, ACL_MEMCPY_DEVICE_TO_HOST, or ACL_MEMCPY_HOST_TO_HOST when the app is running on the board, the system uses ACL_MEMCPY_DEVICE_TO_DEVICE by default to copy memory on the device.
Atlas training products, Atlas A2 training products/Atlas A2 inference products, Atlas A3 training products/Atlas A3 inference products:
- This API does not support asynchronous memory copy within the host. If the input kind is ACL_MEMCPY_HOST_TO_HOST, the API returns the error message "ACL_ERROR_RT_FEATURE_NOT_SUPPORT".