Function: memcpy_async
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Copies memory. This API is asynchronous.
The host memory in this API can be page-locked memory (for example, the memory allocated by the acl.rt.malloc_host API) or non-page-locked memory (allocated by the malloc API). If the host memory is non-page-locked memory, this API returns only after the memory copy task is complete. If the host memory is page-locked memory, this API is asynchronous. A successful API call only indicates that the task is delivered, not executed. After this API is called, call the synchronization API (for example, acl.rt.synchronize_stream) to ensure that the memory copy task is complete.
Prototype
- C Prototype
1aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind, aclrtStream stream)
- Python Function
1ret = acl.rt.memcpy_async(dst, dest_max, src, count, kind, stream)
Parameter Description
|
Parameter |
Description |
|---|---|
|
dst |
Int, pointer address of the destination memory address. |
|
dest_max |
Int, memory size in bytes in the destination address |
|
src |
Int, pointer address of the source memory address. |
|
count |
Int, size in bytes to copy. |
|
kind |
Int, memory copy type.
|
|
stream |
Int, stream ID. |
Return Value Description
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code: 0 on success; else, failure. |
Restrictions
Applicable to all models.
- The source address and destination address passed to this call must be 64-byte aligned.
Ascend EP : 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".
Ascend EP : 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".- 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.
- 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".