SpinParser  1.0
Public Types | Public Member Functions | Public Attributes | List of all members
HMP::LoadManager::DataStackBase Struct Reference

Abstract base class for DataStack types. More...

#include <LoadManager.hpp>

Inheritance diagram for HMP::LoadManager::DataStackBase:
Inheritance graph
[legend]

Public Types

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

virtual ~DataStackBase ()
 Virtual destructor.
 
virtual void applyCalculator (const int n)
 Virtual function to apply an internal calculator to the n-th value stored in the stack. More...
 
virtual void send (const int offset, const int count, const int serverRank, const MPI_Comm communicator) const
 Virtual function to send a data block to a DataStack on a different MPI rank, typically the server rank. More...
 
virtual void receive (const int offset, const int count, const int rank, const MPI_Comm communicator, MPI_Request &request)
 Virtual function to asynchronously receive a data block from a different MPI rank. More...
 
virtual void broadcast (const int serverRank, const MPI_Comm communicator)
 Virtual function to broadcast a data block from the server rank to all other MPI ranks. More...
 

Public Attributes

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

Abstract base class for DataStack types.

This abstract type does not actually store data or prescriptions for calculations. It merely specifies the virtual interface for inheritance. Subclasses should then implement data storage and calculators, see concrete implementations for more details.

See also
DataStack

Member Enumeration Documentation

◆ MessageTag

Internal message tags for MPI communication.

Enumerator
Chunk 

MPI message contains Chunk information.

ChunkReturn 

MPI message contains the result of a chunk computation.

◆ StackType

List to identify the different traits of DataStack.

Enumerator
Explicit 

Explicit DataStack.

An explicit DataStack contains an explicit calculator, i.e. a function with a single integer as an argument, and a non-void return type. When the calculator is invoked, its return value is written to the data element whose position is specified by the integer argument.

See also
LoadManager::addMasterStackExplicit
Implicit 

Implicit DataStack.

An implicit DataStack contains an implicit calculator, i.e. a function with a single integer as an argument, and a void return type. When the calculator is invoked, it is passed the index of a data element stored in the stack. The calculator is expected to modify that element.

See also
LoadManager::addMasterStackImplicit
Slave 

Slave DataStack.

A slave DataStack does not contain a calculator. Instead, it is associated with an implicit data stack. The data storage is expected to have the same size as the associated implicit stack, and the associated stack's implicit calculator is expected to modify also the slave stack's element with the corresponding index. Whenever data of the associated implicit stack is communicated between different MPI ranks, the corresponding slave stack data is also communicated.

See also
LoadManager::addSlaveStack
Passive 

Passive DataStack.

A passive DataStack does not contain a calculator. Changes to its data can only be made on the MPI server rank and need to be manually broadcasted.

See also
LoadManager::addPassiveStack

Member Function Documentation

◆ applyCalculator()

virtual void HMP::LoadManager::DataStackBase::applyCalculator ( const int  n)
inlinevirtual

Virtual function to apply an internal calculator to the n-th value stored in the stack.

Parameters
nSpecifies the index to which the calculator should be applied.

Reimplemented in HMP::LoadManager::DataStack< StackT >.

◆ broadcast()

virtual void HMP::LoadManager::DataStackBase::broadcast ( const int  serverRank,
const MPI_Comm  communicator 
)
inlinevirtual

Virtual function to 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 in HMP::LoadManager::DataStack< StackT >.

◆ receive()

virtual void HMP::LoadManager::DataStackBase::receive ( const int  offset,
const int  count,
const int  rank,
const MPI_Comm  communicator,
MPI_Request &  request 
)
inlinevirtual

Virtual function to asynchronously receive a data block from a different MPI rank.

Parameters
[in]offsetOffset to the beginning 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 entries 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 in HMP::LoadManager::DataStack< StackT >.

◆ send()

virtual void HMP::LoadManager::DataStackBase::send ( const int  offset,
const int  count,
const int  serverRank,
const MPI_Comm  communicator 
) const
inlinevirtual

Virtual function to send a data block to a DataStack on a different MPI rank, typically the server rank.

Parameters
offsetOffset to the beginning 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 entries to be sent.
serverRankReceiver's MPI rank, typically the server rank.
communicatorThe MPI communicator used for communication.

Reimplemented in HMP::LoadManager::DataStack< StackT >.

Member Data Documentation

◆ master

StackIdentifier HMP::LoadManager::DataStackBase::master

Specifies the id of an associated stack. Only relevant for slave stacks, otherwise set to -1.

See also
StackType::Slave

◆ type

StackType HMP::LoadManager::DataStackBase::type

Specifies the trait of the stack.

See also
StackType.

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