MemoryManager Class Reference

HiCR: HiCR::backend::mpi::MemoryManager Class Reference
HiCR
HiCR::backend::mpi::MemoryManager Class Referencefinal

#include <memoryManager.hpp>

Inheritance diagram for HiCR::backend::mpi::MemoryManager:
HiCR::MemoryManager

Public Member Functions

 MemoryManager ()
 
 ~MemoryManager () override=default
 
__INLINE__ std::shared_ptr< HiCR::LocalMemorySlotallocateLocalMemorySlotImpl (std::shared_ptr< HiCR::MemorySpace > memorySpace, const size_t size) override
 
__INLINE__ void freeLocalMemorySlotImpl (std::shared_ptr< HiCR::LocalMemorySlot > memorySlot) override
 
__INLINE__ std::shared_ptr< HiCR::LocalMemorySlotregisterLocalMemorySlotImpl (std::shared_ptr< HiCR::MemorySpace > memorySpace, void *const ptr, const size_t size) override
 
__INLINE__ void deregisterLocalMemorySlotImpl (std::shared_ptr< HiCR::LocalMemorySlot > memorySlot) override
 
- Public Member Functions inherited from HiCR::MemoryManager
__INLINE__ std::shared_ptr< LocalMemorySlotallocateLocalMemorySlot (const std::shared_ptr< MemorySpace > &memorySpace, const size_t size)
 
virtual std::shared_ptr< LocalMemorySlotregisterLocalMemorySlot (const std::shared_ptr< HiCR::MemorySpace > &memorySpace, void *const ptr, const size_t size)
 
__INLINE__ void deregisterLocalMemorySlot (const std::shared_ptr< HiCR::LocalMemorySlot > &memorySlot)
 
__INLINE__ void memset (const std::shared_ptr< HiCR::LocalMemorySlot > &memorySlot, int value, size_t size)
 
__INLINE__ void freeLocalMemorySlot (const std::shared_ptr< HiCR::LocalMemorySlot > &memorySlot)
 

Additional Inherited Members

- Protected Member Functions inherited from HiCR::MemoryManager
virtual void memsetImpl (const std::shared_ptr< HiCR::LocalMemorySlot > memorySlot, int value, size_t size)
 
virtual void freeLocalMemorySlotImpl (std::shared_ptr< HiCR::LocalMemorySlot > memorySlot)=0
 
virtual void deregisterLocalMemorySlotImpl (std::shared_ptr< HiCR::LocalMemorySlot > memorySlot)=0
 

Detailed Description

Implementation of the HiCR MPI backend

This backend is very useful for testing other HiCR modules in isolation (unit tests) without involving the use of threading, which might incur side-effects

Constructor & Destructor Documentation

◆ MemoryManager()

HiCR::backend::mpi::MemoryManager::MemoryManager ( )
inline

Constructor for the mpi backend.

◆ ~MemoryManager()

HiCR::backend::mpi::MemoryManager::~MemoryManager ( )
overridevirtualdefault

Default destructor

Reimplemented from HiCR::MemoryManager.

Member Function Documentation

◆ allocateLocalMemorySlotImpl()

__INLINE__ std::shared_ptr< HiCR::LocalMemorySlot > HiCR::backend::mpi::MemoryManager::allocateLocalMemorySlotImpl ( std::shared_ptr< HiCR::MemorySpace memorySpace,
const size_t  size 
)
inlineoverridevirtual

Allocates memory in the current memory space (whole system) using MPI_Alloc_mem This method, as opposed to a normal malloc ensures portability for all MPI implementations

Parameters
[in]memorySpaceMemory space in which to perform the allocation.
[in]sizeSize of the memory slot to create
Returns
The address of the newly allocated memory slot

Implements HiCR::MemoryManager.

◆ deregisterLocalMemorySlotImpl()

__INLINE__ void HiCR::backend::mpi::MemoryManager::deregisterLocalMemorySlotImpl ( std::shared_ptr< HiCR::LocalMemorySlot memorySlot)
inlineoverride

Deregisters a local memory slot

Parameters
[in]memorySlotThe memory slot to deregister

◆ freeLocalMemorySlotImpl()

__INLINE__ void HiCR::backend::mpi::MemoryManager::freeLocalMemorySlotImpl ( std::shared_ptr< HiCR::LocalMemorySlot memorySlot)
inlineoverride

Frees a local memory slot memory

Parameters
[in]memorySlotthe memory slot to free up

We do not free up MPI local memory slots since they are freed upon promotion. If you did not promote the local memory slot, it will leak memory.

◆ registerLocalMemorySlotImpl()

__INLINE__ std::shared_ptr< HiCR::LocalMemorySlot > HiCR::backend::mpi::MemoryManager::registerLocalMemorySlotImpl ( std::shared_ptr< HiCR::MemorySpace memorySpace,
void *const  ptr,
const size_t  size 
)
inlineoverridevirtual

Backend-internal implementation of the registerLocalMemorySlot function

Parameters
[in]memorySpaceMemory space to register memory in
[in]ptrPointer to the start of the memory slot
[in]sizeSize of the memory slot to create
Returns
A newly created memory slot

Implements HiCR::MemoryManager.


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