Function: memcpy2d

C Prototype

aclError aclrtMemcpy2d(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, aclrtMemcpyKind kind)

Python Function

ret = acl.rt.memcpy2d(dst, dpitch, src, spitch, width, height, kind)

Function Usage

Implements synchronous memory copy, which is mainly used for matrix data replication.

Input Description

dst: pointer address of the destination memory address.

dpitch: address distance between two adjacent columns of vectors in the destination memory.

src: pointer address of the source memory address.

spitch: address distance between two adjacent columns of vectors in the source memory.

width: width of the matrix to be copied.

height: height of the matrix to be copied.

kind: memory copy kind.

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

  • Currently, only memory copy of the ACL_MEMCPY_HOST_TO_DEVICE and ACL_MEMCPY_DEVICE_TO_HOST types is supported.
  • For the Atlas 200/300/500 Inference Product: This API is not supported in Ascend RC form.