Skip to content

Class TempLat::MemoryManager

template <typename T, size_t NDim>

ClassList > TempLat > MemoryManager

A class which holds a single lattice in memory, and tracks and moves between various ghost states. Templated for the memory type, typically float or double. All the confirm___Space() functions return a device::Idx, which counts the amount of work done. Ignore that, but it is important for testing purposes. NOTE that the memory access operators (T* and operator[]) do NOT verify if memory was allocated. More...

  • #include <memorymanager.h>

Public Functions

Type Name
MemoryManager (device::memory::host_ptr< MemoryToolBox< NDim > > toolBox, std::string name="")
device::Idx allocate ()
bool areGhostsStale () const
size_t bytes () const
device::Idx confirmConfigSpace ()
device::Idx confirmFFTConfigSpace ()
device::Idx confirmFourierSpace ()
device::Idx confirmGhostsUpToDate ()
void deallocateHostView ()
void flagHostMirrorOutdated ()
auto getNDHostSubView (const device::IdxArray< NDim > & localSizes, const device::array< std::pair< device::Idx, device::Idx >, NDim > & slices) const
auto getNDHostView (const device::IdxArray< NDim > & localSizes) const
auto getNDSubView (const device::IdxArray< NDim > & localSizes, const device::array< std::pair< device::Idx, device::Idx >, NDim > & slices) const
auto getNDView (const device::IdxArray< NDim > & localSizes) const
std::string getName () const
auto getRawHostView () const
auto getRawView () const
bool isConfigSpace () const
Check the current state.
bool isFourierSpace () const
Check the current state.
void pushHostView ()
void setGhostsAreStale ()
this is the only state the one may need to set from the outside: if a field is updated in the integrator.
void setName (std::string newName)
void updateGhosts ()

Public Static Functions

Type Name
device::Idx confirmGhostsUpToDateBatch (std::span< MemoryManager< T, NDim > *const > mgrs)
Coalesced confirmGhostsUpToDate over the managers of a multi-component field. Only the components whose ghosts are stale are exchanged, but they travel as one message per dimension/direction instead of one per component. Static so it may reach the private state of the sibling managers; they must all share one MemoryToolBox (oneGhostUpdater / buffer set).
void updateGhostsBatch (std::span< MemoryManager< T, NDim > *const > mgrs)
Coalesced forced updateGhosts over the managers of a multi-component field. Matches the per-component updateGhosts() semantics (unconditional, no state-keeper reset) but sends all components in one message per dimension/direction.

Detailed Description

Unit test: ctest -R test-memorymanager

Public Functions Documentation

function MemoryManager

inline TempLat::MemoryManager::MemoryManager (
    device::memory::host_ptr < MemoryToolBox < NDim > > toolBox,
    std::string name=""
) 

function allocate

inline device::Idx TempLat::MemoryManager::allocate () 

function areGhostsStale

inline bool TempLat::MemoryManager::areGhostsStale () const

function bytes

inline size_t TempLat::MemoryManager::bytes () const

function confirmConfigSpace

inline device::Idx TempLat::MemoryManager::confirmConfigSpace () 

function confirmFFTConfigSpace

inline device::Idx TempLat::MemoryManager::confirmFFTConfigSpace () 

function confirmFourierSpace

inline device::Idx TempLat::MemoryManager::confirmFourierSpace () 

function confirmGhostsUpToDate

inline device::Idx TempLat::MemoryManager::confirmGhostsUpToDate () 

function deallocateHostView

inline void TempLat::MemoryManager::deallocateHostView () 

function flagHostMirrorOutdated

inline void TempLat::MemoryManager::flagHostMirrorOutdated () 

function getNDHostSubView

template<typename R>
inline auto TempLat::MemoryManager::getNDHostSubView (
    const device::IdxArray< NDim > & localSizes,
    const device::array< std::pair< device::Idx, device::Idx >, NDim > & slices
) const

function getNDHostView

template<typename R>
inline auto TempLat::MemoryManager::getNDHostView (
    const device::IdxArray< NDim > & localSizes
) const

function getNDSubView

template<typename R>
inline auto TempLat::MemoryManager::getNDSubView (
    const device::IdxArray< NDim > & localSizes,
    const device::array< std::pair< device::Idx, device::Idx >, NDim > & slices
) const

function getNDView

template<typename R>
inline auto TempLat::MemoryManager::getNDView (
    const device::IdxArray< NDim > & localSizes
) const

function getName

inline std::string TempLat::MemoryManager::getName () const

function getRawHostView

template<typename R>
inline auto TempLat::MemoryManager::getRawHostView () const

function getRawView

template<typename R>
inline auto TempLat::MemoryManager::getRawView () const

function isConfigSpace

Check the current state.

inline bool TempLat::MemoryManager::isConfigSpace () const


function isFourierSpace

Check the current state.

inline bool TempLat::MemoryManager::isFourierSpace () const


function pushHostView

inline void TempLat::MemoryManager::pushHostView () 

function setGhostsAreStale

this is the only state the one may need to set from the outside: if a field is updated in the integrator.

inline void TempLat::MemoryManager::setGhostsAreStale () 


function setName

inline void TempLat::MemoryManager::setName (
    std::string newName
) 

function updateGhosts

inline void TempLat::MemoryManager::updateGhosts () 

Public Static Functions Documentation

function confirmGhostsUpToDateBatch

Coalesced confirmGhostsUpToDate over the managers of a multi-component field. Only the components whose ghosts are stale are exchanged, but they travel as one message per dimension/direction instead of one per component. Static so it may reach the private state of the sibling managers; they must all share one MemoryToolBox (oneGhostUpdater / buffer set).

static inline device::Idx TempLat::MemoryManager::confirmGhostsUpToDateBatch (
    std::span< MemoryManager < T, NDim > *const > mgrs
) 


function updateGhostsBatch

Coalesced forced updateGhosts over the managers of a multi-component field. Matches the per-component updateGhosts() semantics (unconditional, no state-keeper reset) but sends all components in one message per dimension/direction.

static inline void TempLat::MemoryManager::updateGhostsBatch (
    std::span< MemoryManager < T, NDim > *const > mgrs
) 


Friends Documentation

friend operator<<

inline std::ostream & TempLat::MemoryManager::operator<< (
    std::ostream & ostream,
    const MemoryManager & mMan
) 

friend operator==

inline bool TempLat::MemoryManager::operator== (
    const MemoryManager & a,
    const MemoryManager & b
) 


The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/lattice/memory/memorymanager.h