MADNESS 0.10.1
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 dataT * find (const keyT &key)
const dataT & insert (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< Slot > slots_
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

drop every entry; the capacity setting survives

◆ contains()

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

Referenced by test_batch_cache().

◆ 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

Referenced by 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

Insert as most-recently-used. pinned marks a batch this rank owns.

Referenced by test_batch_cache().

◆ 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

Referenced by test_batch_cache().

◆ size()

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

Referenced by test_batch_cache().

◆ transient_capacity()

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

Referenced by test_batch_cache().

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: