Function: memcpy_async_with_desc
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
x |
|
x |
|
√ |
Description
Copies memory using a memory copy descriptor (level-2 pointer mode).
This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you must call a synchronization API (for example, acl.rt.synchronize_stream) to ensure that the memory initialization task is complete. Otherwise, unknown problems may occur, such as service exceptions (for example, training or inference exceptions) or device disconnection.
This API needs to work with the following key APIs to implement memory copy:
- Call acl.rt.get_memcpy_desc_size to obtain the memory size required by the memory descriptor.
- Allocate the device memory for storing the memory descriptor.
- Allocate the source and destination memory for storing the data before and after the copy.
- Call acl.rt.set_memcpy_desc to set the source and destination memory addresses in the memory descriptor.
- Call acl.rt.memcpy_async_with_desc to implement memory copy.
Prototype
- C Prototype
1aclError aclrtMemcpyAsyncWithDesc(void *desc, aclrtMemcpyKind kind, aclrtStream stream)
- Python Function
1ret= acl.rt.memcpy_async_with_desc(desc, kind, stream)
Parameters
Parameter |
Description |
|---|---|
desc |
Int, pointer to the memory copy descriptor address on the device. Call the acl.rt.set_memcpy_desc API to set the memory copy descriptor, and then pass the address pointer of the memory copy descriptor to this API as an input parameter. |
kind |
Int, memory copy type. Currently, only ACL_MEMCPY_INNER_DEVICE_TO_DEVICE is supported, indicating memory copy within a device. |
stream |
Int, stream. |
Return Value
Return Value |
Description |
|---|---|
ret |
Int, error code. 0 on success; else, failure. |