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

A memory resource for CPU memory allocation. More...

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

Static Public Attributes

static constexpr bool is_device_accessible = false
 Indicates if the memory resource is accessible by CUDA.
 
static constexpr bool is_host_accessible = HostAccessible::is_host_accessible
 Indicates if the memory resource is accessible by the CPU.
 

Protected Member Functions

void * do_allocate (std::size_t n, std::size_t alignment) override
 Allocates memory with the specified size and alignment.
 
void do_deallocate (void *ptr, std::size_t, std::size_t) override
 Deallocates the memory pointed to by ptr.
 
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 for CPU memory allocation.

Member Function Documentation

◆ do_allocate()

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

Allocates memory with the specified size and alignment.

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

◆ do_deallocate()

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

Deallocates the memory pointed to by ptr.

Parameters
ptrThe pointer to the memory to deallocate.
nThe size of the memory to deallocate.
alignmentThe alignment of the memory to deallocate.

◆ do_is_equal()

bool Mila::Dnn::Compute::CpuMemoryResource::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 with.
Returns
true if the memory resources are equal, false otherwise.

Member Data Documentation

◆ is_device_accessible

constexpr bool Mila::Dnn::Compute::CpuMemoryResource::is_device_accessible = false
staticconstexpr

Indicates if the memory resource is accessible by CUDA.

◆ is_host_accessible

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

Indicates if the memory resource is accessible by the CPU.


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