cuda::managed_memory_pool#

struct managed_memory_pool : public cuda::managed_memory_pool_ref#

Stream ordered memory resource#

managed_memory_pool allocates managed memory using cudaMallocFromPoolAsync / cudaFreeAsync for allocation/deallocation. When constructed it creates an underlying c cudaMemPool_t with the allocation type set to c cudaMemAllocationTypeManaged and owns it.

Public Types

using reference_type = managed_memory_pool_ref#
using default_queries = ::cuda::mr::properties_list<::cuda::mr::device_accessible, ::cuda::mr::host_accessible>#

Public Functions

inline explicit managed_memory_pool(no_init_t) noexcept#

Constructs an empty managed_memory_pool without an underlying pool.

inline managed_memory_pool(memory_pool_properties __properties = {})#

Constructs a managed_memory_pool with optional properties.

Properties include the initial pool size and the release threshold. If the pool size grows beyond the release threshold, unused memory held by the pool will be released at the next synchronization event.

Parameters:

__properties – Optional, additional properties of the pool to be created.

inline ~managed_memory_pool() noexcept#
inline constexpr ::cudaMemPool_t release() noexcept#

Retrieve the native cudaMemPool_t handle and give up ownership.

Returns:

cudaMemPool_t The native handle being held by this object.

Post:

The memory pool object is in a moved-from state.

inline managed_memory_pool_ref &as_ref() noexcept#

Returns a managed_memory_pool_ref for this managed_memory_pool.

We return by reference to ensure that we can subsequently convert to a resource_ref

managed_memory_pool(const managed_memory_pool&) = delete#
managed_memory_pool &operator=(const managed_memory_pool&) = delete#
inline constexpr const managed_memory_pool_ref &query(
const __get_memory_resource_t&
) const noexcept#

Public Static Functions

static inline managed_memory_pool from_native_handle(
::cudaMemPool_t __pool
) noexcept#