SpinParser  1.0
Protected Member Functions | Protected Attributes | Friends | List of all members
HMP::LoadManager::DataStack< StackT > Struct Template Reference

Concrete derivation of DataStackBase, managing an array of fundamental data types (or tuples thereof, if DataStackBase::typeMultiplicity is greater than one). More...

#include <LoadManager.hpp>

Inheritance diagram for HMP::LoadManager::DataStack< StackT >:
Inheritance graph
[legend]
Collaboration diagram for HMP::LoadManager::DataStack< StackT >:
Collaboration graph
[legend]

Protected Member Functions

 DataStack ()
 Construct a new Data Stack object. More...
 
void applyCalculator (const int i) override
 Invoke internal calculator and write result to the data array at the specified index. More...
 
void send (const int offset, const int count, const int serverRank, const MPI_Comm communicator) const override
 Send a data block to a different MPI rank, typically the server rank. More...
 
void receive (const int offset, const int count, const int rank, const MPI_Comm communicator, MPI_Request &request) override
 Asynchronously receive a data block from a different MPI rank. More...
 
void broadcast (const int serverRank, const MPI_Comm communicator) override
 Broadcast a data block from the server rank to all other MPI ranks. More...
 

Protected Attributes

std::function< StackT(int)> explicitCalculator
 Explicit calculator. Only relevant if DataStackBase::type is set to StackType::Explicit.
 
std::function< void(int)> implicitCalculator
 Implicit calculator. Only relevant if DataStackBase::type is set to StackType::Implicit.
 
StackT * data
 Internal data array.
 

Friends

class LoadManager
 

Additional Inherited Members

- Public Types inherited from HMP::LoadManager::DataStackBase
enum  StackType { StackType::Explicit, StackType::Implicit, StackType::Slave, StackType::Passive }
 List to identify the different traits of DataStack. More...
 
enum  MessageTag { MessageTag::Chunk, MessageTag::ChunkReturn }
 Internal message tags for MPI communication. More...
 
- Public Member Functions inherited from HMP::LoadManager::DataStackBase
virtual ~DataStackBase ()
 Virtual destructor.
 
- Public Attributes inherited from HMP::LoadManager::DataStackBase
StackType type
 Specifies the trait of the stack. More...
 
StackIdentifier master
 Specifies the id of an associated stack. Only relevant for slave stacks, otherwise set to -1. More...
 
int size
 Number of elements (or tuples of elements if DataStackBase::typeMultiplicity is greater than one) stored in the stack.
 
int typeMultiplicity
 Multiplicity of each element. Cannot be greater than one for explicit stacks. If greater than one, the data stack is assumed to consist of tuples of fundamental data types. Element indexing then refers to the tuples, not the fundamental data types.
 
int recommendedChunkSizeMultiple
 When breaking the data stack down into smaller work chunks, attempt to form chunks whose size is a multiple of the given value. This is helpful if calculators vary in runtime, but can be joined to groups whose collective runtime is expected to be constant.
 
int recommendedChunksPerRank
 When breaking the data stack down into smaller work chunks, attempt to form approximately the specified number of chunks per MPI rank.
 
bool autoBroadcast
 If set to true, modifications to the stack's data that are a consequence of the onvication of calculators are automatically communicated across all MPI ranks. If set to false, they are only sent to the MPI server rank.
 

Detailed Description

template<class StackT>
struct HMP::LoadManager::DataStack< StackT >

Concrete derivation of DataStackBase, managing an array of fundamental data types (or tuples thereof, if DataStackBase::typeMultiplicity is greater than one).

Template Parameters
StackTThe fundamental data type stored in the internal data array.

Constructor & Destructor Documentation

◆ DataStack()

template<class StackT >
HMP::LoadManager::DataStack< StackT >::DataStack ( )
inlineprotected

Member Function Documentation

◆ applyCalculator()

template<class StackT >
void HMP::LoadManager::DataStack< StackT >::applyCalculator ( const int  i)
inlineoverrideprotectedvirtual

Invoke internal calculator and write result to the data array at the specified index.

Parameters
iIndex of the element to which the result is written.

Reimplemented from HMP::LoadManager::DataStackBase.

◆ broadcast()

template<class StackT >
void HMP::LoadManager::DataStack< StackT >::broadcast ( const int  serverRank,
const MPI_Comm  communicator 
)
inlineoverrideprotectedvirtual

Broadcast a data block from the server rank to all other MPI ranks.

Parameters
serverRankThe MPI rank to take the role of the sender.
communicatorThe MPI communicator used for communication.

Reimplemented from HMP::LoadManager::DataStackBase.

◆ receive()

template<class StackT >
void HMP::LoadManager::DataStack< StackT >::receive ( const int  offset,
const int  count,
const int  rank,
const MPI_Comm  communicator,
MPI_Request &  request 
)
inlineoverrideprotectedvirtual

Asynchronously receive a data block from a different MPI rank.

Parameters
[in]offsetId of the first element of the data block to be received, measured in number of entries (or number of entry tuples, if DataStackBase::typeMultiplicity is greater than one).
[in]countNumber of elements (or element tuples) to be received.
[in]rankSender's MPI rank.
[in]communicatorThe MPI communicator used for communication.
[out]requestMPI request object for the communication; Should be used to determine whether the non-blocking receive has been completed.

Reimplemented from HMP::LoadManager::DataStackBase.

◆ send()

template<class StackT >
void HMP::LoadManager::DataStack< StackT >::send ( const int  offset,
const int  count,
const int  serverRank,
const MPI_Comm  communicator 
) const
inlineoverrideprotectedvirtual

Send a data block to a different MPI rank, typically the server rank.

Parameters
offsetId of the first element of the data block to be sent, measured in number of entries (or number of entry tuples, if DataStackBase::typeMultiplicity is greater than one).
countNumber of elements (or element tuples) to be sent.
serverRankReceiver's MPI rank, typically the server rank.
communicatorThe MPI communicator used for communication.

Reimplemented from HMP::LoadManager::DataStackBase.


The documentation for this struct was generated from the following file: