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

A memory resource that allocates memory on a CUDA device. More...

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

Static Public Attributes

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

Protected Member Functions

void * do_allocate (std::size_t n, std::size_t alignment) override
 Allocates memory on the CUDA device.
 
void do_deallocate (void *ptr, std::size_t, std::size_t) override
 Deallocates memory on the CUDA device.
 
bool do_is_equal (const std::pmr::memory_resource &other) const noexcept override
 Checks if this memory resource is equal to another memory resource.
 

Detailed Description

A memory resource that allocates memory on a CUDA device.

Member Function Documentation

◆ do_allocate()

void * Mila::Dnn::Compute::CudaMemoryResource::do_allocate ( std::size_t  n,
std::size_t  alignment 
)
inlineoverrideprotected

Allocates memory on the CUDA device.

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

◆ do_deallocate()

void Mila::Dnn::Compute::CudaMemoryResource::do_deallocate ( void *  ptr,
std::size_t  ,
std::size_t   
)
inlineoverrideprotected

Deallocates memory on the CUDA device.

Parameters
ptrA pointer to the memory to deallocate.
nThe size of the memory to deallocate.
alignmentThe alignment of the memory to deallocate.
Here is the call graph for this function:

◆ do_is_equal()

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

Checks if this memory resource is equal to another memory resource.

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

Member Data Documentation

◆ is_device_accessible

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

◆ is_host_accessible

constexpr bool Mila::Dnn::Compute::CudaMemoryResource::is_host_accessible = false
staticconstexpr

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