cuda::experimental::managed_memory_resource#

class managed_memory_resource : public cuda::experimental::__memory_resource_base#

Stream ordered memory resource#

managed_memory_resource allocates managed memory using cudaMallocFromPoolAsync / cudaFreeAsync for allocation/deallocation. A managed_memory_resource is a thin wrapper around a c cudaMemPool_t with the allocation type set to c cudaMemAllocationTypeManaged.

Warning

managed_memory_resource does not own the pool and it is the responsibility of the user to ensure that the lifetime of the pool exceeds the lifetime of the managed_memory_resource.

Subclassed by cuda::experimental::managed_memory_pool

Public Types

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

Public Functions

inline managed_memory_resource()#

Default constructs the managed_memory_resource using the default cudaMemPool_t for host pinned memory.

Throws:

cuda_error – if retrieving the default cudaMemPool_t fails.

inline explicit managed_memory_resource(
::cudaMemPool_t __pool,
) noexcept#

Constructs the managed_memory_resource from a cudaMemPool_t.

Parameters:

__pool – The cudaMemPool_t used to allocate memory.

Friends

inline friend constexpr void get_property(
managed_memory_resource const&,
::cuda::mr::device_accessible,
) noexcept#

Enables the device_accessible property.

inline friend constexpr void get_property(
managed_memory_resource const&,
::cuda::mr::host_accessible,
) noexcept#

Enables the host_accessible property.