If your app runs on the host, this API is called to allocate the host memory, and the system guarantees that the start address of the memory is 64-byte aligned. If your app runs on the device, this API is called to allocate the device memory by normal page. If 64-byte alignment is required for the start address, you need to guarantee the alignment. This API is synchronous.
len indicates the size of a memory segment. ALIGN_UP[len,k] indicates rounding up to a multiple of k bytes as in this formula: ((len – 1)/k + 1) x k.
aclError aclrtMallocHost(void **hostPtr, size_t size)
Parameter |
Input/Output |
Description |
|---|---|---|
size |
Input |
Requested allocation size in bytes. Must not be 0. |
hostPtr |
Output |
Pointer to allocated memory. |
0 on success; else, failure.
For the API call example, see Data Transfer.