aclrtMemcpyFromSymbol
Applicable Products
Product |
Supported |
|---|---|
√ |
|
√ |
|
√ |
|
☓ |
|
√ |
|
☓ |
Function
Synchronously copies data from a device variable to the host memory so that the host can read data stored in the device variable.
This is an encapsulated API that applies only to C++ programs. It internally calls the C API aclrtMemcpyFromSymbol.
Prototype
1 2 | template <typename T> aclError aclrtMemcpyFromSymbol(void *dst, size_t dstMax, const T &symbol, size_t count, size_t offset, aclrtMemcpyKind kind) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Input |
Pointer to the destination memory address. |
dstMax |
Input |
Destination memory size, in bytes. The following condition must be met: dstMax ≥ count. |
symbol |
Input |
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. |
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
The restrictions are the same as those in aclrtGetSymbolAddress.