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

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

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

Public Member Functions

void * allocate (std::size_t size)
 Allocate bytes of memory using cudaMalloc. More...
 
void deallocate (void *ptr)
 Deallocate memory using cudaFree. More...
 

Detailed Description

Uses cudaMalloc and cudaFree to allocate and deallocate memory on NVIDIA GPUs.

Member Function Documentation

◆ allocate()

void* umpire::alloc::CudaMallocAllocator::allocate ( std::size_t  size)
inline

Allocate bytes of memory using cudaMalloc.

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.

Referenced by umpire::resource::CudaDeviceMemoryResource::allocate().

◆ deallocate()

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

Deallocate memory using cudaFree.

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

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

Referenced by umpire::resource::CudaDeviceMemoryResource::deallocate().