Function: memcpy

C Prototype

aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind)

Python Function

ret = acl.rt.memcpy(dst, dest_max, src, count, kind)

Function Usage

Copies memory.

Input Description

dst: pointer address of the destination memory address.

dest_max: int, maximum memory length of the destination memory address, in bytes.

src: pointer address of the source memory address.

count: int, length of the copied memory, in bytes.

kind: int, memory copy type, reserved parameter. The enumerated values are invalid. The system determines whether the data from the source address can be copied to the destination address based on the pointer addresses of the source and destination memory addresses. If the data cannot be copied to the destination address, the system returns an error.
  • ACL_MEMCPY_HOST_TO_HOST = 0 // Copy memory within the host.
  • ACL_MEMCPY_HOST_TO_DEVICE = 1 // Copy memory from the host to the device.
  • ACL_MEMCPY_DEVICE_TO_HOST = 2 // Copy memory from the device to the host.
  • ACL_MEMCPY_DEVICE_TO_DEVICE = 3 // Copy memory within a device.

Return Value

ret: int, error code.

Restrictions

This API copies the memory immediately. No implicit device synchronization or stream synchronization is performed within the function.

Reference

For details about the API call example, see Data Copy.