aclrtMemcpy

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Description

Copies memory.

Prototype

1
aclError aclrtMemcpy(void *dst, size_t destMax, const void *src, size_t count, aclrtMemcpyKind kind)

Parameters

Parameter

Input/Output

Description

dst

Input

Pointer to the destination memory address.

destMax

Input

Memory size in bytes in the destination address.

src

Input

Pointer to the source memory address.

count

Input

Size in bytes to copy.

kind

Input

Memory copy kind, reserved. If the configured enum value is invalid, the system determines whether to copy data from the source address to the destination address based on the source and destination memory address pointers. If no, the system returns an error message.

For details about the type definition, see aclrtMemcpyKind.

Returns

0 on success; else, failure. For details, see aclError.

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 aclrtDeviceCanAccessPeer to query whether inter-device data exchange is supported, call aclrtDeviceEnablePeerAccess to enable inter-device data exchange, and then call this API to perform memory copy.

    This restriction applies to the following models:

    Atlas 350 Accelerator Card

    Atlas A2 training product / Atlas A2 inference product

    Atlas inference product

    Atlas training product

API Call Example

For the API call example, see Device Memory Usage.