MADNESS 0.10.1
Classes | Public Member Functions | Private Attributes | List of all members
madness::ExchangeBatchLRU< keyT, dataT > Class Template Reference

Bounded cache of fetched exchange batches, keyed by cloud record key. More...

#include <exchangeoperator.h>

Classes

struct  Slot
 

Public Member Functions

void clear ()
 drop every entry; the capacity setting survives
 
bool contains (const keyT &key) const
 
const dataTfind (const keyT &key)
 
const dataTinsert (const keyT &key, dataT &&data, const bool pinned)
 Insert as most-recently-used. pinned marks a batch this rank owns.
 
std::size_t n_transient () const
 
void set_transient_capacity (const std::size_t c)
 how many non-owned entries may be resident; at least one is always allowed
 
std::size_t size () const
 
std::size_t transient_capacity () const
 

Private Attributes

std::list< Slotslots_
 
std::size_t transient_capacity_ = 2
 

Detailed Description

template<typename keyT, typename dataT>
class madness::ExchangeBatchLRU< keyT, dataT >

Bounded cache of fetched exchange batches, keyed by cloud record key.

A rank reuses the batches it owns across all of its tasks, so those are pinned and never evicted; only the batches fetched from elsewhere are transient and bounded. An earlier single bound over both let the churning transients evict the reusable owned batches, which re-fetched them at every owned-batch switch. Pinning the owned ones costs a fixed share of the data (orbitals per rank) and is independent of batch granularity.

Entries are held in a list, so a reference returned by find() or insert() stays valid until that entry is evicted — promotion and insertion of other entries do not move it.

Member Function Documentation

◆ clear()

template<typename keyT , typename dataT >
void madness::ExchangeBatchLRU< keyT, dataT >::clear ( )
inline

◆ contains()

template<typename keyT , typename dataT >
bool madness::ExchangeBatchLRU< keyT, dataT >::contains ( const keyT key) const
inline

◆ find()

template<typename keyT , typename dataT >
const dataT * madness::ExchangeBatchLRU< keyT, dataT >::find ( const keyT key)
inline
Returns
the cached batch, promoted to most-recently-used, or nullptr if absent

References madness::ExchangeBatchLRU< keyT, dataT >::slots_.

Referenced by madness::Exchange< T, NDIM >::ExchangeImpl< T, NDIM >::MacroTaskExchangeSimple::fetch_batch(), and test_batch_cache().

◆ insert()

template<typename keyT , typename dataT >
const dataT & madness::ExchangeBatchLRU< keyT, dataT >::insert ( const keyT key,
dataT &&  data,
const bool  pinned 
)
inline

◆ n_transient()

template<typename keyT , typename dataT >
std::size_t madness::ExchangeBatchLRU< keyT, dataT >::n_transient ( ) const
inline

◆ set_transient_capacity()

template<typename keyT , typename dataT >
void madness::ExchangeBatchLRU< keyT, dataT >::set_transient_capacity ( const std::size_t  c)
inline

how many non-owned entries may be resident; at least one is always allowed

References c, and madness::ExchangeBatchLRU< keyT, dataT >::transient_capacity_.

Referenced by test_batch_cache().

◆ size()

template<typename keyT , typename dataT >
std::size_t madness::ExchangeBatchLRU< keyT, dataT >::size ( ) const
inline

◆ transient_capacity()

template<typename keyT , typename dataT >
std::size_t madness::ExchangeBatchLRU< keyT, dataT >::transient_capacity ( ) const
inline

Member Data Documentation

◆ slots_

template<typename keyT , typename dataT >
std::list<Slot> madness::ExchangeBatchLRU< keyT, dataT >::slots_
private

◆ transient_capacity_

template<typename keyT , typename dataT >
std::size_t madness::ExchangeBatchLRU< keyT, dataT >::transient_capacity_ = 2
private

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