cuda.bindings._v2.driver.mem_alloc_host_v2#
- cuda.bindings._v2.driver.mem_alloc_host_v2(size_t bytesize) intptr_t#
Allocates page-locked host memory.
Allocates
bytesizebytes of host memory that is page-locked and accessible to the device. The driver tracks the virtual memory ranges allocated with this function and automatically accelerates calls to functions such ascu_memcpy(). Since the memory can be accessed directly by the device, it can be read or written with much higher bandwidth than pageable memory obtained with functions such asmalloc(). On systems whereCU_DEVICE_ATTRIBUTE_PAGEABLE_MEMORY_ACCESS_USES_HOST_PAGE_TABLESis true,cuMemAllocHostmay not page-lock the allocated memory. Page-locking excessive amounts of memory withcuMemAllocHost()may degrade system performance, since it reduces the amount of memory available to the system for paging. As a result, this function is best used sparingly to allocate staging areas for data exchange between host and device. Note all host memory allocated usingcuMemAllocHost()will automatically be immediately accessible to all contexts on all devices which support unified addressing (as may be queried usingCU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING). The device pointer that may be used to access this host memory from those contexts is always equal to the returned host pointer*pp. SeeUnified Addressingfor additional details.- Parameters:
bytesize (size_t) – Requested allocation size in bytes.
- Returns:
Returned pointer to host memory.
- Return type:
intptr_t
See also
cuMemAllocHost_v2