aclrtMemcpy2d

Description

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

The Ascend 310P1 AI Processor does not support this API.

Prototype

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

Restrictions

Parameters

Parameter

Input/Output

Description

dst

Input

Pointer to the destination memory address.

dpitch

Input

Address distance between two adjacent columns of vectors in the destination memory.

src

Input

Pointer to the source memory address.

spitch

Input

Address distance between two adjacent columns of vectors in the source memory.

width

Input

Width of the matrix to be copied.

height

Input

Height of the matrix to be copied.

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;

Returns

0 on success; else, failure.