Skip to navigation

holoscan::CudaMemoryResourceAllocator

Beta
View as Markdown

Native experimental allocator API backed by CCCL CUDA memory pools.

Device allocations come from CCCL/libcu++ memory pool resources. Pinned-host allocations use CCCL’s CUDA pinned-memory resource available with CUDA 12.x.

#include <holoscan/cuda_memory_resource_allocator.hpp>

Inherits from: holoscan::CudaStreamAllocator (public)


Constructors

CudaMemoryResourceAllocator

Destructor

~CudaMemoryResourceAllocator

HOLOSCAN_CORE_EXPORT holoscan::CudaMemoryResourceAllocator::~CudaMemoryResourceAllocator() override

Methods

initialize

HOLOSCAN_CORE_EXPORT void holoscan::CudaMemoryResourceAllocator::initialize()

initialize_pool

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::CudaMemoryResourceAllocator::initialize_pool()

deinitialize_pool

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::CudaMemoryResourceAllocator::deinitialize_pool()

is_available

virtual
expected<void, Error> holoscan::CudaMemoryResourceAllocator::is_available(
uint64_t size,
MemoryStorageType storage_type
) override

allocate

expected<std::byte *, Error> holoscan::CudaMemoryResourceAllocator::allocate(
uint64_t size,
MemoryStorageType storage_type
) override

free

std::byte *pointer
) override

pool_size

HOLOSCAN_CORE_EXPORT expected<size_t, Error> holoscan::CudaMemoryResourceAllocator::pool_size(
MemoryStorageType storage_type
) const

stats

HOLOSCAN_CORE_EXPORT expected<Stats, Error> holoscan::CudaMemoryResourceAllocator::stats() const

config

const Config & holoscan::CudaMemoryResourceAllocator::config() const noexcept

device_id

int32_t holoscan::CudaMemoryResourceAllocator::device_id(
MemoryStorageType storage_type
) const override

allocate_async

expected<std::byte *, Error> holoscan::CudaMemoryResourceAllocator::allocate_async(
uint64_t size,
MemoryStorageType storage_type,
cudaStream_t stream
)

free_async

expected<void, Error> holoscan::CudaMemoryResourceAllocator::free_async(
std::byte *pointer,
cudaStream_t stream
)

block_size

virtual uint64_t holoscan::Allocator::block_size(
MemoryStorageType storage_type
) const

allocate_async_impl

expected<std::byte *, Error> holoscan::CudaMemoryResourceAllocator::allocate_async_impl(
uint64_t size,
MemoryStorageType storage_type,
cudaStream_t stream
) override

free_async_impl

expected<void, Error> holoscan::CudaMemoryResourceAllocator::free_async_impl(
std::byte *pointer,
cudaStream_t stream
) override

parse_storage_size

HOLOSCAN_CORE_EXPORT expected<size_t, Error> holoscan::CudaMemoryResourceAllocator::parse_storage_size(
std::string_view text
) const

device_available_bytes

HOLOSCAN_CORE_EXPORT expected<size_t, Error> holoscan::CudaMemoryResourceAllocator::device_available_bytes() const

host_available_bytes

HOLOSCAN_CORE_EXPORT expected<size_t, Error> holoscan::CudaMemoryResourceAllocator::host_available_bytes() const

ensure_available

HOLOSCAN_CORE_EXPORT expected<void, Error> holoscan::CudaMemoryResourceAllocator::ensure_available(
uint64_t size,
MemoryStorageType storage_type
) const

allocator_stage_str

static const char * holoscan::CudaMemoryResourceAllocator::allocator_stage_str(
)

Types

AllocatorStage

NameValueDescription
kUninitialized= 0
kInitializationInProgress= 1
kInitialized= 2
kDeinitializationInProgress= 3

Member variables

NameTypeDescription
config_Config
stage_AllocatorStage
stream_cudaStream_t
device_max_memory_pool_size_size_t
host_max_memory_pool_size_size_t
device_pool_std::unique_ptr< cuda::device_memory_pool >
host_resource_std::unique_ptr< cuda::mr::legacy_pinned_memory_resource >
shared_mutex_std::shared_mutex
pool_map_std::unordered_map< std::byte *, AllocationInfo >
host_used_bytes_size_t
kUnknownDeviceId static constexprint32_t

Inner classes

Config

NameTypeDescription
device_memory_initial_sizestd::string
device_memory_max_sizestd::string
host_memory_initial_sizestd::string
host_memory_max_sizestd::string
device_idint32_t

Stats

NameTypeDescription
device_pool_reserved_bytessize_t
device_pool_used_bytessize_t
device_pool_configured_max_bytessize_t
device_pool_available_bytessize_t
host_used_bytessize_t
host_configured_max_bytessize_t
host_available_bytessize_t
allocation_countsize_t
initializedbool

AllocationInfo

NameTypeDescription
sizesize_t
storage_typeMemoryStorageType