aclrtMemcpy2dAsync

Description

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

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

Restrictions

Prototype

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

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.

The maximum height should be set to 5242880 (5 x 1024 x 1024). Otherwise, a failure is returned.

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.

Returns

0 on success; else, failure.