SpinParser
1.0
|
LoadManager slave implementation, responsible for receiving and executing workload chunks form a LoadManagerMaster implementation. More...
#include <LoadManager.hpp>
Public Member Functions | |
virtual void | calculate (const StackIdentifier *stackIds, const int size) override |
Calculate a list of stacks, where the stack identifiers are provided in list form. More... | |
![]() | |
virtual | ~LoadManager () |
Destroy the LoadManager object. | |
template<class StackT > | |
StackIdentifier | addMasterStackExplicit (StackT *const data, const int size, const std::function< StackT(int)> &calculator, const int recommendedChunkSizeMultiple=1, const int recommendedChunksPerRank=10, const bool autoBroadcast=false) |
Create an explicit data stack and attach it to the LoadManager. More... | |
template<class StackT > | |
StackIdentifier | addMasterStackImplicit (StackT *const data, const int size, const std::function< void(int)> &calculator, const int typeMultiplicity=1, const int recommendedChunkSizeMultiple=1, const int recommendedChunksPerRank=10, const bool autoBroadcast=false) |
Create an implicit data stack and attach it to the LoadManager. More... | |
template<class StackT > | |
StackIdentifier | addSlaveStack (StackT *const data, const int size, const StackIdentifier master, const int typeMultiplicity=1) |
Create a slave data stack and attach it to the LoadManager. More... | |
template<class StackT > | |
StackIdentifier | addPassiveStack (StackT *const data, const int size) |
Create a passive data stack and attach it to the LoadManager. More... | |
void | calculate (const std::initializer_list< StackIdentifier > &stackIds) |
Calculate a list of stacks, where the stack identifiers are provided in initializer list form. More... | |
void | calculate (const StackIdentifier stackId) |
Calculate a single stack. More... | |
void | calculateAll () |
Calculate all stacks. | |
void | broadcast (const StackIdentifier *stackIds, const int size) |
Broadcast a list of stacks, where the stack identifiers are provided in list form. More... | |
void | broadcast (const std::initializer_list< StackIdentifier > &stackIds) |
Broadcast a list of stacks, where the stack identifiers are provided in initializer list form. More... | |
void | broadcast (const StackIdentifier stackId) |
Broadcast a single stack. More... | |
void | broadcastAll () |
Broadcast all stacks. | |
virtual void | printRuntimeStatistics () const |
Virtual implementation to print runtime statistics, including information on the efficiency of LoadManager instances running on different MPI ranks. | |
Protected Member Functions | |
LoadManagerSlave (const int serverRank, const MPI_Comm communicator) | |
Construct a new LoadManagerSlave object. More... | |
virtual StackIdentifier | _registerStack (DataStackBase *stack) override |
Register a DataStackBase with the LoadManager. By registering the stack, the LoadManager assumes responsibility to synchronize data between MPI ranks as necessary. More... | |
void | _waitChunk (Chunk &chunk) const |
Wait until a workload chunk has been received from a LoadManagerMaster instance. More... | |
void | _returnChunk (const Chunk &chunk) const |
Return the result of the workload defined by a specific chunk. More... | |
![]() | |
LoadManager (const int serverRank, const MPI_Comm communicator) | |
Construct a new Load Manager object. More... | |
void | _calculateChunk (const Chunk &chunk) |
Calculate the workload defined by a specific chunk. More... | |
Protected Attributes | |
std::vector< float > | _currentCalculationComputeTimeBuffer |
_currentCalculationComputeTimeBuffer[stack] is a buffer for the time in milliseconds spent on computing stack in the current calculate() call. | |
![]() | |
std::vector< DataStackBase * > | _stacks |
List of all registered stacks. | |
int | _serverRank |
Designated MPI master rank. | |
int | _rank |
MPI rank of the current LoadManager instance. | |
int | _commSize |
MPI communicator size. | |
MPI_Comm | _communicator |
MPI communicator to operate on. | |
Friends | |
LoadManager * | newLoadManager (const int serverRank, const MPI_Comm communicator) |
Create a new LoadManager instance. If the current MPI rank is the designated master rank, returns a LoadManagerMaster instance, otherwise returns a LoadManagerSlave instance. More... | |
LoadManager slave implementation, responsible for receiving and executing workload chunks form a LoadManagerMaster implementation.
|
inlineprotected |
Construct a new LoadManagerSlave object.
serverRank | The MPI rank to take on the master role. |
communicator | The MPI communicator used for communication. |
|
inlineoverrideprotectedvirtual |
Register a DataStackBase with the LoadManager. By registering the stack, the LoadManager assumes responsibility to synchronize data between MPI ranks as necessary.
stack | The stack to be registered. |
Reimplemented from HMP::LoadManager.
|
inlineprotected |
Return the result of the workload defined by a specific chunk.
chunk | The workload definition whose results are to be returned. |
|
inlineprotected |
Wait until a workload chunk has been received from a LoadManagerMaster instance.
[out] | chunk | The workload definition which has been received. |
|
inlineoverridevirtual |
Calculate a list of stacks, where the stack identifiers are provided in list form.
stackIds | Pointer to the first StackIdentifier. |
size | Number of stacks. |
Implements HMP::LoadManager.
|
friend |
Create a new LoadManager instance. If the current MPI rank is the designated master rank, returns a LoadManagerMaster instance, otherwise returns a LoadManagerSlave instance.
serverRank | MPI rank to assume the master role. |
communicator | The MPI communicator to operate on. |