DiSMEC++
dismec::parallel::NUMAReplicatorBase Class Referenceabstract

Base class for NUMAReplicator. More...

#include <numa.h>

Inheritance diagram for dismec::parallel::NUMAReplicatorBase:
dismec::parallel::NUMAReplicator< DenseRealVector > dismec::parallel::NUMAReplicator< const dismec::types::GenericMatrix > dismec::parallel::NUMAReplicator< T >

Public Member Functions

bool has_numa () const
 this returns true if NUMA is available. Otherwise, there will be no replication. More...
 
int num_numa () const
 This returns the number of NUMA nodes. More...
 

Protected Member Functions

 NUMAReplicatorBase ()
 
virtual ~NUMAReplicatorBase ()=default
 
void make_copies ()
 Uses the get_clone() function of the implementing class to generate NUMA-local copies for each NUMA node. More...
 
const std::any & access_local () const
 

Private Member Functions

virtual std::any get_clone () const =0
 This function needs to be implemented by a derived class. More...
 

Private Attributes

bool m_HasNUMA = false
 Whether NUMA functions are available. More...
 
std::vector< std::any > m_Copies
 This vector contains one copy of data for each NUMA node. More...
 

Detailed Description

Base class for NUMAReplicator.

This class is not intended to be used directly, but only as an implementation details for collecting the non-templated parts of NUMAReplicator. It contains the replication logic, but stores all data in a type-erased manner. To actually access the data the NUMAReplicator has to be used. A derived class needs to implement a get_clone() function which creates a copy of the data to be replicated. This function will be called in a context in which the allocation policy has been set to allocate on a specific NUMA node, and need not concern itself with these details.

Definition at line 32 of file numa.h.

Constructor & Destructor Documentation

◆ NUMAReplicatorBase()

NUMAReplicatorBase::NUMAReplicatorBase ( )
protected

Definition at line 87 of file numa.cpp.

◆ ~NUMAReplicatorBase()

virtual dismec::parallel::NUMAReplicatorBase::~NUMAReplicatorBase ( )
protectedvirtualdefault

Member Function Documentation

◆ access_local()

const std::any & NUMAReplicatorBase::access_local ( ) const
protected

Returns the std::any that holds the copy for the calling thread. If NUMA is not available, returns a reference to a static, empty object.

Definition at line 110 of file numa.cpp.

References anonymous_namespace{numa.cpp}::current_numa_node(), m_Copies, and m_HasNUMA.

Referenced by dismec::parallel::NUMAReplicator< T >::get_local().

◆ get_clone()

virtual std::any dismec::parallel::NUMAReplicatorBase::get_clone ( ) const
privatepure virtual

◆ has_numa()

bool dismec::parallel::NUMAReplicatorBase::has_numa ( ) const
inline

this returns true if NUMA is available. Otherwise, there will be no replication.

Definition at line 35 of file numa.h.

References m_HasNUMA.

◆ make_copies()

void NUMAReplicatorBase::make_copies ( )
protected

Uses the get_clone() function of the implementing class to generate NUMA-local copies for each NUMA node.

Definition at line 91 of file numa.cpp.

References get_clone(), m_Copies, m_HasNUMA, and anonymous_namespace{numa.cpp}::numa_node_count().

Referenced by dismec::parallel::NUMAReplicator< T >::NUMAReplicator().

◆ num_numa()

int dismec::parallel::NUMAReplicatorBase::num_numa ( ) const
inline

This returns the number of NUMA nodes.

Definition at line 37 of file numa.h.

References m_Copies.

Member Data Documentation

◆ m_Copies

std::vector<std::any> dismec::parallel::NUMAReplicatorBase::m_Copies
private

This vector contains one copy of data for each NUMA node.

Definition at line 54 of file numa.h.

Referenced by access_local(), make_copies(), and num_numa().

◆ m_HasNUMA

bool dismec::parallel::NUMAReplicatorBase::m_HasNUMA = false
private

Whether NUMA functions are available.

Definition at line 51 of file numa.h.

Referenced by access_local(), has_numa(), and make_copies().


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