DiSMEC++
|
Helper class to ensure that each NUMA node has its own copy of some immutable data. More...
#include <numa.h>
Public Member Functions | |
NUMAReplicator (std::shared_ptr< const T > data) | |
Initializes the NUMAReplicator and distributes the data to all NUMA nodes. More... | |
std::shared_ptr< const T > | get_local () const |
![]() | |
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... | |
Private Types | |
using | ptr_t = std::shared_ptr< const T > |
Private Member Functions | |
std::any | get_clone () const override |
This function needs to be implemented by a derived class. More... | |
Private Attributes | |
ptr_t | m_Data |
Additional Inherited Members | |
![]() | |
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 |
Helper class to ensure that each NUMA node has its own copy of some immutable data.
T | The type of the data to be duplicated among NUMA nodes. Must be copyable. |
We assume that we have the data available as std::shared_ptr<T>
, and that T
is copyable. The class provides one function, get_local()
which returns a shared_ptr
to the data on the NUMA node of the calling process.
Most of the implementation of this class is independent of the contained type, and provided by NUMAReplicatorBase.
|
private |
|
inlineexplicit |
Initializes the NUMAReplicator and distributes the data to all NUMA nodes.
Definition at line 76 of file numa.h.
References dismec::parallel::NUMAReplicatorBase::make_copies().
|
inlineoverrideprivatevirtual |
This function needs to be implemented by a derived class.
Implements dismec::parallel::NUMAReplicatorBase.
Definition at line 92 of file numa.h.
References dismec::parallel::NUMAReplicator< T >::m_Data.
|
inline |
Gets the local copy of the data. The calling thread should cache this value, to prevent the overhead of doing this lookup.
Definition at line 82 of file numa.h.
References dismec::parallel::NUMAReplicatorBase::access_local(), and dismec::parallel::NUMAReplicator< T >::m_Data.
Referenced by dismec::init::ConstantInitializationStrategy::make_initializer().
|
private |
Definition at line 90 of file numa.h.
Referenced by dismec::parallel::NUMAReplicator< T >::get_clone(), and dismec::parallel::NUMAReplicator< T >::get_local().