ls1-MarDyn
ls1-MarDyn molecular dynamics code
Classes | Public Member Functions | Protected Attributes | List of all members
CollectiveCommBase Class Reference

This class is a dummy class which ensures that the collective communication commands also work if the program is executed sequentially without MPI. More...

#include <CollectiveCommBase.h>

Inheritance diagram for CollectiveCommBase:
CollectiveCommBaseInterface CollectiveCommunication CollectiveCommunicationSingleNonBlocking

Classes

union  valType
 

Public Member Functions

void init (int numValues)
 allocate memory for the values to be stored, initialize getter-iterator More...
 
virtual void appendInt (int intValue) override
 
virtual void appendUnsLong (unsigned long unsLongValue) override
 
virtual void appendFloat (float floatValue) override
 
virtual void appendDouble (double doubleValue) override
 
virtual void appendLongDouble (long double longDoubleValue) override
 
virtual void broadcast (int=0) override
 
virtual void allreduceSum () override
 Performs an all-reduce (sum) More...
 
virtual void allreduceCustom (ReduceType type) override
 
virtual void scanSum () override
 Performs a scan (sum) More...
 
virtual int getInt () override
 
virtual unsigned long getUnsLong () override
 
virtual float getFloat () override
 
virtual double getDouble () override
 
virtual long double getLongDouble () override
 
virtual void finalize () override
 delete memory and MPI_Type More...
 
virtual size_t getTotalSize () override
 
- Public Member Functions inherited from CollectiveCommBaseInterface
virtual ~CollectiveCommBaseInterface ()
 virtual destructor
 

Protected Attributes

std::vector< valType_values
 Vector to store the values which shall be communicated.
 
std::vector< valType >::const_iterator _getter
 Iterator to extract the values which were communicated.
 

Detailed Description

This class is a dummy class which ensures that the collective communication commands also work if the program is executed sequentially without MPI.

Refactored to increase code-reuse

Author
Nikola Tchipev, Martin Buchholz

To fully understand the purpose of this class, read the documentation of the class CollectiveCommunication. The application developer should not have to care whether the program will be executed in parallel or sequentially. The only thing that the application developer should know that there might be several processes and at some point in the simulation those have to do a collective communication to broadcast or reduce values. Those values are given to the domain decomposition method, the communication command is executed by the domain decomp and the values can be read again. This class just has to ensure that this also works if there is no real domain decomposition but the class DomainDecompBase is used.

Member Function Documentation

◆ allreduceCustom()

virtual void CollectiveCommBase::allreduceCustom ( ReduceType  type)
inlineoverridevirtual

Performs an allreduce operation with a custom reduce type.

Parameters
typethe type of the operation

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ allreduceSum()

virtual void CollectiveCommBase::allreduceSum ( )
inlineoverridevirtual

Performs an all-reduce (sum)

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ appendDouble()

virtual void CollectiveCommBase::appendDouble ( double  doubleValue)
inlineoverridevirtual

Append a double value to the list of values to be stored

Parameters
doubleValuethe value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ appendFloat()

virtual void CollectiveCommBase::appendFloat ( float  floatValue)
inlineoverridevirtual

Append a float value to the list of values to be stored

Parameters
floatValuethe value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ appendInt()

virtual void CollectiveCommBase::appendInt ( int  intValue)
inlineoverridevirtual

Append an int value to the list of values to be stored

Parameters
intValuethe value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ appendLongDouble()

virtual void CollectiveCommBase::appendLongDouble ( long double  longDoubleValue)
inlineoverridevirtual

Append a long double value to the list of values to be stored

Parameters
longDoubleValuethe value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ appendUnsLong()

virtual void CollectiveCommBase::appendUnsLong ( unsigned long  unsLongValue)
inlineoverridevirtual

Append a unsigned long value to the list of values to be stored

Parameters
unsLongValuethe value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ broadcast()

virtual void CollectiveCommBase::broadcast ( int  = 0)
inlineoverridevirtual

Performs a broadcast of the values to all processes in the communicator

Parameters
rootof the broadcast

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ finalize()

virtual void CollectiveCommBase::finalize ( )
inlineoverridevirtual

delete memory and MPI_Type

Returns
the value

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication, and CollectiveCommunicationSingleNonBlocking.

◆ getDouble()

virtual double CollectiveCommBase::getDouble ( )
inlineoverridevirtual

Get the next value from the list, which must be double

no check is performed that the type is correct, so we rely on the sanity of the programmer to ensure FIFO ordering w.r.t. append-get order

Returns
the value

Implements CollectiveCommBaseInterface.

◆ getFloat()

virtual float CollectiveCommBase::getFloat ( )
inlineoverridevirtual

Get the next value from the list, which must be float

no check is performed that the type is correct, so we rely on the sanity of the programmer to ensure FIFO ordering w.r.t. append-get order

Returns
the value

Implements CollectiveCommBaseInterface.

◆ getInt()

virtual int CollectiveCommBase::getInt ( )
inlineoverridevirtual

Get the next value from the list, which must be int

no check is performed that the type is correct, so we rely on the sanity of the programmer to ensure FIFO ordering w.r.t. append-get order3

Returns
the value

Implements CollectiveCommBaseInterface.

◆ getLongDouble()

virtual long double CollectiveCommBase::getLongDouble ( )
inlineoverridevirtual

Get the next value from the list, which must be long double

no check is performed that the type is correct, so we rely on the sanity of the programmer to ensure FIFO ordering w.r.t. append-get order

Returns
the value

Implements CollectiveCommBaseInterface.

◆ getTotalSize()

virtual size_t CollectiveCommBase::getTotalSize ( )
inlineoverridevirtual

get the size of the entire object allocated memory

Returns
size of the dynamically allocated memory in bytes

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.

◆ getUnsLong()

virtual unsigned long CollectiveCommBase::getUnsLong ( )
inlineoverridevirtual

Get the next value from the list, which must be unsigned long

no check is performed that the type is correct, so we rely on the sanity of the programmer to ensure FIFO ordering w.r.t. append-get order

Returns
the value

Implements CollectiveCommBaseInterface.

◆ init()

void CollectiveCommBase::init ( int  numValues)
inline

allocate memory for the values to be stored, initialize getter-iterator

Parameters
numValuesnumber of values that shall be stored

◆ scanSum()

virtual void CollectiveCommBase::scanSum ( )
inlineoverridevirtual

Performs a scan (sum)

Implements CollectiveCommBaseInterface.

Reimplemented in CollectiveCommunication.


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