DiSMEC++
|
Base class for NUMAReplicator. More...
#include <numa.h>
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... | |
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.
|
protectedvirtualdefault |
|
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().
|
privatepure virtual |
This function needs to be implemented by a derived class.
Implemented in dismec::parallel::NUMAReplicator< T >, dismec::parallel::NUMAReplicator< DenseRealVector >, and dismec::parallel::NUMAReplicator< const dismec::types::GenericMatrix >.
Referenced by make_copies().
|
inline |
|
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().
|
inline |
|
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().
|
private |
Whether NUMA functions are available.
Definition at line 51 of file numa.h.
Referenced by access_local(), has_numa(), and make_copies().