Implements asynchronous memory copy within the host, within a device, between devices, or between the host and device.
In Ascend RC form, if your app runs on the board while the configured memory copy direction involves the host, memory copy within the device is performed.
To perform memory copy between two devices, call aclrtDeviceCanAccessPeer to query whether inter-device memory copy is supported by the devices, call aclrtDeviceEnablePeerAccess to enable inter-device memory copy between the devices, and then call this API to perform memory copy.
aclError aclrtMemcpyAsync(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind, aclrtStream stream)
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Input |
Pointer to the destination memory address. |
destMax |
Input |
Memory size in bytes in the destination address. |
src |
Input |
Pointer to the source memory address. |
count |
Input |
Size in bytes to copy. |
kind |
Input |
Memory copy kind. typedef enum aclrtMemcpyKind {
ACL_MEMCPY_HOST_TO_HOST, //Memory copy within the host
ACL_MEMCPY_HOST_TO_DEVICE, //Host to device memory copy
ACL_MEMCPY_DEVICE_TO_HOST, //Device to host memory copy
ACL_MEMCPY_DEVICE_TO_DEVICE //Memory copy within a device or between devices
} aclrtMemcpyKind; |
stream |
Input |
Stream. |
0 on success; else, failure.
For the API call example, see Data Transfer.