aclrtMemcpyToSymbol
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
☓ |
|
√ |
|
☓ |
Function
Synchronously copies memory from the host to a device variable. This is used to write data to a device variable.
Prototype
1 | aclError aclrtMemcpyToSymbol(const void *symbol, const void *src, size_t count, size_t offset, aclrtMemcpyKind kind) |
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. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
The restrictions are the same as those in aclrtGetSymbolAddress.