holoscan::utils::cuda::DeviceBuffer

Beta
View as Markdown

CUDA Device Buffer Class.

#include <holoscan/utils/cuda/buffer.hpp>

Inherits from: holoscan::utils::cuda::Buffer (public)


Constructors

DeviceBuffer

holoscan::utils::cuda::DeviceBuffer::DeviceBuffer(
size_t size,
int device_id = 0
)

Construction with size.

Parameters

size
size_t

Memory size to be allocated in bytes

device_id
intDefaults to 0

GPU device ID, defaults to 0

Destructor

~DeviceBuffer

holoscan::utils::cuda::DeviceBuffer::~DeviceBuffer()

Destructor.


Assignment operators

operator=

The following overloads are deleted to prevent misuse:

DeviceBuffer & holoscan::utils::cuda::DeviceBuffer::operator=(const DeviceBuffer &) = delete;
DeviceBuffer & holoscan::utils::cuda::DeviceBuffer::operator=(DeviceBuffer &&) = delete;

Methods

data

void * holoscan::utils::cuda::DeviceBuffer::data() override

Buffer class virtual members implemented by this class.

size

size_t holoscan::utils::cuda::DeviceBuffer::size() const override

Get the size of the allocated buffer in elements.

Returns: size in elements

get_bytes

size_t holoscan::utils::cuda::DeviceBuffer::get_bytes() const override

Get the bytes allocated.

Returns: allocated bytes

resize

void holoscan::utils::cuda::DeviceBuffer::resize(
size_t number_of_elements
) override

Resize the underlying buffer.

Parameters

number_of_elements
size_t

Number of elements to be resized with

host_data

void * holoscan::utils::cuda::DeviceBuffer::host_data(
cudaStream_t stream = 0
)

Copies data from device to host after allocating the host memory.

get_datatype

BufferDataType holoscan::utils::cuda::DeviceBuffer::get_datatype() const

Get the datatype.

Returns: datatype

get_device

int holoscan::utils::cuda::DeviceBuffer::get_device() const

Get the device ID.

Returns: device ID


Member variables

NameTypeDescription
size_size_t
capacity_size_t
buffer_void *
host_buffer_void *
allocator_CudaAllocator
free_CudaFree
data_type_BufferDataTypeDatatype of the elements in the buffer.
device_id_intDevice ID.