Function: memcpy2d
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Implements synchronous memory copy, which is mainly used for matrix data replication.
Prototype
-
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)
Parameters
| Parameter | Description |
|---|---|
| dst | Int, pointer address of the destination memory address. |
| dpitch | Int, address distance between two adjacent columns of vectors in the destination memory. |
| src | Int, pointer address of the source memory address. |
| spitch | Int, address distance between two adjacent columns of vectors in the source memory. |
| width | Int, matrix width to be copied. |
| height | Int, matrix height to be copied. |
| kind | Int, memory copy type. |
Return Values
| Return Value | Description |
|---|---|
| ret | Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails. |
Constraints
- Currently, only memory copy of the
ACL\_MEMCPY\_HOST\_TO\_DEVICEandACL\_MEMCPY\_DEVICE\_TO\_HOSTtypes is supported.
- On Atlas inference products, this API cannot be called in open Ctrl CPU mode. In addition, Atlas inference acceleration modules do not support this API.
- On Atlas 200I/500 A2 inference products, this API cannot be called in Ascend RC mode.