Public Member Functions | List of all members
kvikio::CudaPageAlignedPinnedAllocator Class Reference

Allocator for page-aligned AND CUDA-registered pinned host memory. More...

#include <bounce_buffer.hpp>

Public Member Functions

void * allocate (std::size_t size)
 Allocate page-aligned CUDA-registered pinned host memory. More...
 
void deallocate (void *buffer, std::size_t size)
 Deallocate memory previously allocated by this allocator. More...
 

Detailed Description

Allocator for page-aligned AND CUDA-registered pinned host memory.

Combines the benefits of both page alignment (for Direct I/O) and CUDA registration (for efficient host-device transfers). Uses std::aligned_alloc followed by cudaMemHostRegister to achieve both properties.

Note
This is the required allocator for Direct I/O with device memory. Requires a valid CUDA context when allocating.

Definition at line 77 of file bounce_buffer.hpp.

Member Function Documentation

◆ allocate()

void* kvikio::CudaPageAlignedPinnedAllocator::allocate ( std::size_t  size)

Allocate page-aligned CUDA-registered pinned host memory.

Parameters
sizeRequested size in bytes (will be rounded up to page boundary)
Returns
Pointer to allocated memory

◆ deallocate()

void kvikio::CudaPageAlignedPinnedAllocator::deallocate ( void *  buffer,
std::size_t  size 
)

Deallocate memory previously allocated by this allocator.

Parameters
bufferPointer to memory to deallocate
sizeSize of the allocation (unused, for interface consistency)

The documentation for this class was generated from the following file: