cuda::experimental::legacy_managed_memory_resource#
-
class legacy_managed_memory_resource#
managed_memory_resource
usescudaMallocManaged
/cudaFree
for allocation / deallocation.Public Types
-
using default_queries = properties_list<device_accessible, host_accessible>#
Public Functions
- inline constexpr legacy_managed_memory_resource(
- const unsigned int __flags = cudaMemAttachGlobal,
- inline void *allocate_sync(
- const size_t __bytes,
- const size_t __alignment = ::cuda::mr::default_cuda_malloc_alignment,
Allocate CUDA unified memory of size at least
__bytes
.- Parameters:
__bytes – The size in bytes of the allocation.
__alignment – The requested alignment of the allocation.
- Throws:
std::invalid_argument – in case of invalid alignment or
cuda::cuda_error
of the returned error code.- Returns:
Pointer to the newly allocated memory
- inline void deallocate_sync(
- void *__ptr,
- const size_t,
- const size_t __alignment = ::cuda::mr::default_cuda_malloc_alignment,
Deallocate memory pointed to by
__ptr
.- Parameters:
__ptr – Pointer to be deallocated. Must have been allocated through a call to
allocate
orallocate_sync
__bytes – The number of bytes that was passed to the allocation call that returned
__ptr
.__alignment – The alignment that was passed to the allocation call that returned
__ptr
.
- inline constexpr bool operator==(
- legacy_managed_memory_resource const &__other,
Equality comparison with another
managed_memory_resource
.- Parameters:
__other – The other
managed_memory_resource
.- Returns:
Whether both
managed_memory_resource
were constructed with the same flags.
Friends
- inline friend constexpr void get_property(
- legacy_managed_memory_resource const&,
- device_accessible,
Enables the
device_accessible
property.
- inline friend constexpr void get_property(
- legacy_managed_memory_resource const&,
- host_accessible,
Enables the
host_accessible
property.
-
using default_queries = properties_list<device_accessible, host_accessible>#