cuda::experimental::pinned_memory_resource#

class pinned_memory_resource : public cuda::experimental::__memory_resource_base#

Stream ordered memory resource#

pinned_memory_resource uses cudaMallocFromPoolAsync / cudaFreeAsync for allocation/deallocation. A pinned_memory_resource is a thin wrapper around a c cudaMemPool_t.

Warning

pinned_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 pinned_memory_resource.

Public Types

using default_queries = properties_list<device_accessible, host_accessible>#

Public Functions

inline pinned_memory_resource()#

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

Throws:

cuda_error – if retrieving the default cudaMemPool_t fails.

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

Constructs the pinned_memory_resource from a cudaMemPool_t.

Parameters:

__pool – The cudaMemPool_t used to allocate memory.

inline explicit pinned_memory_resource(
pinned_memory_pool &__pool,
) noexcept#

Constructs the pinned_memory_resource from a pinned_memory_pool by calling get().

Parameters:

__pool – The pinned_memory_pool used to allocate memory.

Friends

inline friend constexpr void get_property(
pinned_memory_resource const&,
device_accessible,
) noexcept#

Enables the device_accessible property.

inline friend constexpr void get_property(
pinned_memory_resource const&,
host_accessible,
) noexcept#

Enables the host_accessible property.