UMPIRE
Umpire: resource management and provision
umpire::alloc::CudaMallocManagedAllocator Struct Reference

Uses cudaMallocManaged and cudaFree to allocate and deallocate unified memory on NVIDIA GPUs. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/alloc/CudaMallocManagedAllocator.hpp>

Public Member Functions

void * allocate (std::size_t bytes)
 Allocate bytes of memory using cudaMallocManaged. More...
 
void deallocate (void *ptr)
 Deallocate memory using cudaFree. More...
 
bool isAccessible (Platform p)
 

Detailed Description

Uses cudaMallocManaged and cudaFree to allocate and deallocate unified memory on NVIDIA GPUs.

Member Function Documentation

◆ allocate()

void* umpire::alloc::CudaMallocManagedAllocator::allocate ( std::size_t  bytes)
inline

Allocate bytes of memory using cudaMallocManaged.

Parameters
bytesNumber of bytes to allocate.
Returns
Pointer to start of the allocation.
Exceptions
umpire::util::runtime_errorif memory cannot be allocated.

References umpire::util::message::Debug, umpire::error(), UMPIRE_ERROR, and UMPIRE_LOG.

◆ deallocate()

void umpire::alloc::CudaMallocManagedAllocator::deallocate ( void *  ptr)
inline

Deallocate memory using cudaFree.

Parameters
ptrAddress to deallocate.
Exceptions
umpire::util::runtime_errorif memory be free'd.

References umpire::util::message::Debug, umpire::error(), UMPIRE_ERROR, and UMPIRE_LOG.

◆ isAccessible()

bool umpire::alloc::CudaMallocManagedAllocator::isAccessible ( Platform  p)
inline