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

Uses hipMalloc and hipFree to allocate and deallocate memory on AMD GPUs. More...

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

Inheritance diagram for umpire::alloc::HipMallocAllocator:

Public Member Functions

void * allocate (std::size_t size)
 Allocate bytes of memory using hipMalloc. More...
 
void deallocate (void *ptr)
 Deallocate memory using hipFree. More...
 
 HipAllocator ()
 
 HipAllocator (MemoryResourceTraits::granularity_type g)
 

Public Attributes

MemoryResourceTraits::granularity_type m_granularity
 

Detailed Description

Uses hipMalloc and hipFree to allocate and deallocate memory on AMD GPUs.

Member Function Documentation

◆ allocate()

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

Allocate bytes of memory using hipMalloc.

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

References umpire::MemoryResourceTraits::coarse_grained, umpire::util::message::Debug, umpire::error(), umpire::MemoryResourceTraits::fine_grained, umpire::alloc::HipAllocator::m_granularity, UMPIRE_ERROR, UMPIRE_LOG, and umpire::MemoryResourceTraits::unknown.

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

◆ deallocate()

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

Deallocate memory using hipFree.

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::HipDeviceMemoryResource::deallocate().

◆ HipAllocator() [1/2]

umpire::alloc::HipAllocator::HipAllocator
inline

◆ HipAllocator() [2/2]

umpire::alloc::HipAllocator::HipAllocator
inline

Member Data Documentation

◆ m_granularity