Function: memcpy
Applicability
|
Product |
Supported (√/x) |
|---|---|
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
|
|
√ |
Function Usage
Copies memory.
Prototype
- C Prototype
1aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind)
- Python Function
1ret = acl.rt.memcpy(dst, dest_max, src, count, kind)
Parameter Description
|
Parameter |
Description |
|---|---|
|
dst |
Int, pointer address of the destination memory address. |
|
destMax |
Int, memory size in bytes in the destination address |
|
src |
Int, pointer address of the source memory address. |
|
count |
Int, size in bytes to copy. |
|
kind |
Int, memory copy type, reserved. 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.
|
Return Value Description
|
Return Value |
Description |
|---|---|
|
ret |
Int, error code: 0 on success; else, failure. |
Restrictions
- This API copies the memory immediately. No implicit device synchronization or stream synchronization is performed within the function.
- To perform memory copy between two devices, call acl.rt.device_can_access_peer to query whether inter-device data exchange is supported by the devices, call acl.rt.device_enable_peer_access to enable inter-device data exchange between the devices, and then call this API to perform memory copy.
This restriction applies to the following models:
Atlas A2 training products /Atlas A2 inference products Atlas inference products Atlas training products