Skip to navigation

hololink::module::ReceiverMemoryDescriptor

View as Markdown

A page-aligned region of GPU-accessible memory that a receiver writes incoming data into, usually on GPU directly accessible memory.

The memory is not initialized. It is released when the descriptor is destroyed; the CUDA context it was created with must still be valid at that point. Because the memory is released with the descriptor, anything still using the address returned by get() must be finished first.

#include <hololink/module/receiver_memory_descriptor.hpp>

Constructors

ReceiverMemoryDescriptor

CUcontext context,
size_t size,
Placement placement = Placement::Automatic
)

Allocate the memory.

Initializes the CUDA driver if necessary and makes context the current CUDA context of the calling thread.

Throws: std::overflow_error if size is too large to allocate with page alignment.

Throws: std::runtime_error if a CUDA call fails, for example if the allocation cannot be satisfied.

Parameters

context
CUcontext

CUDA context in which to allocate. The address returned by get() is valid in this context.

size
size_t

Number of usable bytes required, starting at get(). It is not rounded up, so callers that need whole pages must do so themselves.

placement
PlacementDefaults to Placement::Automatic

Which allocator to use; see Placement.


Methods

get

CUdeviceptr hololink::module::ReceiverMemoryDescriptor::get() const

The start of the usable memory, as a GPU device address.

The address is aligned to the system page size, and at least size bytes (as given to the constructor) are available from it. It is constant for the life of the descriptor.

Returns: The device pointer.


Types

Placement

Where the memory comes from.

NameValueDescription
AutomaticDevice memory (cuMemAlloc) on a discrete GPU; on an integrated GPU, device-mapped host memory (cuMemHostAlloc), which the CPU can also read.
DeviceDevice memory (cuMemAlloc) on every GPU.