aclrtMemcpyToSymbolAsync
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
☓ |
|
√ |
|
☓ |
Function
Asynchronously copies memory from the host to a device variable. This is used to write data to a 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 aclrtMemcpyToSymbolAsync(const void *symbol, const void *src, size_t count, size_t offset, aclrtMemcpyKind kind, aclrtStream stream) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
symbol |
Input |
Address of a device variable. The device variable is declared with __gm__. |
src |
Input |
Pointer to the source memory address. |
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_HOST_TO_DEVICE 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.