Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Dnn::Compute::CudaPinnedMemoryResource Class Referenceexport

A memory resource that allocates pinned (page-locked) memory using CUDA. More...

Inheritance diagram for Mila::Dnn::Compute::CudaPinnedMemoryResource:
Collaboration diagram for Mila::Dnn::Compute::CudaPinnedMemoryResource:

Static Public Attributes

static constexpr bool is_device_accessible = DeviceAccessible::is_device_accessible
 
static constexpr bool is_host_accessible = HostAccessible::is_host_accessible
 

Protected Member Functions

void * do_allocate (std::size_t n, std::size_t alignment=alignof(std::max_align_t)) override
 Allocates pinned memory.
 
void do_deallocate (void *ptr, std::size_t, std::size_t alignment=alignof(std::max_align_t)) override
 Deallocates pinned memory.
 
bool do_is_equal (const std::pmr::memory_resource &other) const noexcept override
 Compares this memory resource with another for equality.
 

Detailed Description

A memory resource that allocates pinned (page-locked) memory using CUDA.

Member Function Documentation

◆ do_allocate()

void * Mila::Dnn::Compute::CudaPinnedMemoryResource::do_allocate ( std::size_t  n,
std::size_t  alignment = alignof(std::max_align_t) 
)
inlineoverrideprotected

Allocates pinned memory.

Parameters
nThe size of the memory to allocate.
alignmentThe alignment of the memory to allocate.
Returns
void* Pointer to the allocated memory.
Exceptions
std::bad_allocif the allocation fails.

◆ do_deallocate()

void Mila::Dnn::Compute::CudaPinnedMemoryResource::do_deallocate ( void *  ptr,
std::size_t  ,
std::size_t  alignment = alignof(std::max_align_t) 
)
inlineoverrideprotected

Deallocates pinned memory.

Parameters
ptrPointer to the memory to deallocate.
sizeThe size of the memory to deallocate.
alignmentThe alignment of the memory to deallocate.

◆ do_is_equal()

bool Mila::Dnn::Compute::CudaPinnedMemoryResource::do_is_equal ( const std::pmr::memory_resource &  other) const
inlineoverrideprotectednoexcept

Compares this memory resource with another for equality.

Parameters
otherThe other memory resource to compare with.
Returns
true if the other memory resource is also a PinnedMemoryResource.
false otherwise.

Member Data Documentation

◆ is_device_accessible

constexpr bool Mila::Dnn::Compute::CudaPinnedMemoryResource::is_device_accessible = DeviceAccessible::is_device_accessible
staticconstexpr

◆ is_host_accessible

constexpr bool Mila::Dnn::Compute::CudaPinnedMemoryResource::is_host_accessible = HostAccessible::is_host_accessible
staticconstexpr

The documentation for this class was generated from the following file: