aclrtMemcpyFromSymbolAsync
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
☓ |
|
√ |
|
☓ |
Function
Asynchronously copies data from a device variable to the host memory so that the host can read data stored in the device variable.
The host memory in this API can be page-locked memory (for example, the memory allocated by the aclrtMallocHost API) or non-page-locked memory (allocated by the malloc API). If the host memory is page-locked memory, this API is asynchronous. A successful API call indicates that the task is delivered, not executed. After this API is called, call the synchronization API (for example, aclrtSynchronizeStream) to ensure that the memory copy task is complete. If the host memory is non-page-locked memory, this API returns only after the memory copy task is complete.
Prototype
1 | aclError aclrtMemcpyFromSymbolAsync(void *dst, size_t dstMax, const void *symbol, size_t count, size_t offset, aclrtMemcpyKind kind, aclrtStream stream) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Input |
Pointer to the destination memory address. |
dstMax |
Input |
Maximum length of the destination memory, in bytes. The following condition must be met: dstMax ≥ count. |
symbol |
Input |
Address of a device variable. The device variable is declared with __gm__. |
count |
Input |
Size in bytes to copy. The following condition must be met: offset + count ≤ Device variable size. The device variable size can be obtained by calling aclrtGetSymbolSize. |
offset |
Input |
Device variable address offset, in bytes. The following condition must be met: offset + count ≤ Device variable size. The device variable size can be obtained by calling aclrtGetSymbolSize. |
kind |
Input |
Memory copy kind. For details about the type definition, see aclrtMemcpyKind. This API only supports ACL_MEMCPY_DEVICE_TO_HOST and ACL_MEMCPY_DEFAULT. |
stream |
Input |
Stream for executing the memory copy task. For details about the type definition, see aclrtStream. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
The restrictions are the same as those in aclrtGetSymbolAddress.