8#ifndef DOMAINDECOMPMPIBASE_H_
9#define DOMAINDECOMPMPIBASE_H_
15#include "utils/Logger.h"
16#include "DomainDecompBase.h"
17#include "CollectiveCommunicationInterface.h"
18#include "CommunicationPartner.h"
19#include "ParticleDataForwardDeclaration.h"
37 MPI_CHECK(MPI_Barrier(_comm));
41 unsigned Ndistribution(
unsigned localN,
float* minrnd,
float* maxrnd);
57 _collCommunication->init(_comm, numValues, key);
61 _collCommunication->finalize();
65 _collCommunication->appendInt(intValue);
69 _collCommunication->appendUnsLong(unsLongValue);
73 _collCommunication->appendFloat(floatValue);
77 _collCommunication->appendDouble(doubleValue);
81 _collCommunication->appendLongDouble(longDoubleValue);
85 return _collCommunication->getInt();
89 return _collCommunication->getUnsLong();
93 return _collCommunication->getFloat();
97 return _collCommunication->getDouble();
101 return _collCommunication->getLongDouble();
105 _collCommunication->allreduceSum();
111 _collCommunication->allreduceCustom(
type);
115 _collCommunication->scanSum();
119 _collCommunication->broadcast(root);
143 unsigned int stageNumber) = 0;
154 unsigned int stageNumber) = 0;
168 bool doHaloPositionCheck =
true,
bool removeRecvDuplicates =
false);
172 std::vector<int> getNeighbourRanks()
override = 0;
173 std::vector<int> getNeighbourRanksFullShell()
override = 0;
175 virtual std::vector<CommunicationPartner> getNeighboursFromHaloRegion(
Domain* domain,
const HaloRegion& haloRegion,
double cutoff) = 0;
178#if defined(ENABLE_MPI)
179 MPI_Datatype getMPIParticleType() {
180 return _mpiParticleType;
182 MPI_Datatype getMPIParticleForceType() {
183 return _mpiParticleForceType;
185 MPI_Comm getCommunicator()
override {
220 virtual size_t getTotalSize()
override;
222 virtual void printSubInfo(
int offset)
override;
227 return "DomainDecompMPIBase";
230 void printCommunicationPartners(
std::string filename)
const override;
241 unsigned int stageNumber, MessageType msgType,
bool removeRecvDuplicates =
false);
252 unsigned int stageNumber, MessageType msgType,
bool removeRecvDuplicates =
false);
254 MPI_Datatype _mpiParticleType;
255 MPI_Datatype _mpiParticleForceType;
259 std::unique_ptr<NeighbourCommunicationScheme> _neighbourCommunicationScheme;
268 std::unique_ptr<CollectiveCommunicationInterface> _collCommunication;
273 unsigned long _overlappingStartAtStep {5ul};
handle boundary region and multiple processes
Definition: DomainDecompBase.h:51
Definition: DomainDecompMPIBase.h:30
void barrier() const override
synchronizes all processes
Definition: DomainDecompMPIBase.h:36
double collCommGetDouble() override
has to call getDouble method of a CollComm class
Definition: DomainDecompMPIBase.h:96
unsigned Ndistribution(unsigned localN, float *minrnd, float *maxrnd)
returns total number of molecules
Definition: DomainDecompMPIBase.cpp:173
virtual void prepareNonBlockingStage(bool forceRebalancing, ParticleContainer *moleculeContainer, Domain *domain, unsigned int stageNumber)=0
void collCommInit(int numValues, int key=0) override
has to call init method of a CollComm class
Definition: DomainDecompMPIBase.h:56
void collCommFinalize() override
has to call finalize method of a CollComm class
Definition: DomainDecompMPIBase.h:60
void assertDisjunctivity(ParticleContainer *moleculeContainer) const override
Definition: DomainDecompMPIBase.cpp:206
float collCommGetFloat() override
has to call getFloat method of a CollComm class
Definition: DomainDecompMPIBase.h:92
virtual void balanceAndExchangeInitNonBlocking(bool forceRebalancing, ParticleContainer *moleculeContainer, Domain *domain)
Definition: DomainDecompMPIBase.cpp:260
long double collCommGetLongDouble() override
has to call getLongDouble method of a CollComm class
Definition: DomainDecompMPIBase.h:100
int collCommGetInt() override
has to call getInt method of a CollComm class
Definition: DomainDecompMPIBase.h:84
virtual void prepareNonBlockingStageImpl(ParticleContainer *moleculeContainer, Domain *domain, unsigned int stageNumber, MessageType msgType, bool removeRecvDuplicates=false)
Definition: DomainDecompMPIBase.cpp:266
void collCommScanSum() override
has to call scanSum method of a CollComm class (none in sequential version)
Definition: DomainDecompMPIBase.h:114
virtual int getNonBlockingStageCount() override
Definition: DomainDecompMPIBase.cpp:131
void collCommAllreduceSum() override
has to call allreduceSum method of a CollComm class (none in sequential version)
Definition: DomainDecompMPIBase.h:104
void collCommAppendDouble(double doubleValue) override
has to call appendDouble method of a CollComm class
Definition: DomainDecompMPIBase.h:76
void collCommBroadcast(int root=0) override
has to call broadcast method of a CollComm class (none in sequential version)
Definition: DomainDecompMPIBase.h:118
virtual void finishNonBlockingStage(bool forceRebalancing, ParticleContainer *moleculeContainer, Domain *domain, unsigned int stageNumber)=0
void collCommAllreduceSumAllowPrevious() override
has to call allreduceSum method of a CollComm class (none in sequential version), allows for values o...
Definition: DomainDecompMPIBase.cpp:361
virtual void finishNonBlockingStageImpl(ParticleContainer *moleculeContainer, Domain *domain, unsigned int stageNumber, MessageType msgType, bool removeRecvDuplicates=false)
Definition: DomainDecompMPIBase.cpp:273
void collCommAppendLongDouble(long double longDoubleValue) override
has to call appendLongDouble method of a CollComm class
Definition: DomainDecompMPIBase.h:80
virtual void printDecomp(const std::string &filename, Domain *domain, ParticleContainer *particleContainer) override
writes information about the current decomposition into the given file
Definition: DomainDecompMPIBase.cpp:306
void collCommAppendInt(int intValue) override
has to call appendInt method of a CollComm class
Definition: DomainDecompMPIBase.h:64
void collCommAppendUnsLong(unsigned long unsLongValue) override
has to call appendUnsLong method of a CollComm class
Definition: DomainDecompMPIBase.h:68
virtual void readXML(XMLfileUnits &xmlconfig)
Read in XML configuration for DomainDecompMPIBase.
Definition: DomainDecompMPIBase.cpp:58
void exchangeForces(ParticleContainer *moleculeContainer, Domain *domain) override
Exchanges forces at the domain boundaries if it's required by the cell container.
Definition: DomainDecompMPIBase.cpp:292
virtual void setCommunicationScheme(const std::string &scheme, const std::string &comScheme)
Definition: DomainDecompMPIBase.cpp:135
void exchangeMoleculesMPI(ParticleContainer *moleculeContainer, Domain *domain, MessageType msgType, bool doHaloPositionCheck=true, bool removeRecvDuplicates=false)
exchange molecules between processes
Definition: DomainDecompMPIBase.cpp:279
void collCommAppendFloat(float floatValue) override
has to call appendFloat method of a CollComm class
Definition: DomainDecompMPIBase.h:72
void assertIntIdentity(int IX)
checks identity of random number generators
Definition: DomainDecompMPIBase.cpp:189
void collCommAllreduceCustom(ReduceType type) override
has to call allreduceCustom method of a CollComm class (none in sequential version)
Definition: DomainDecompMPIBase.h:110
bool _forceDirectPP
Definition: DomainDecompMPIBase.h:266
unsigned long collCommGetUnsLong() override
has to call getUnsLong method of a CollComm class
Definition: DomainDecompMPIBase.h:88
This class is used to read in the phasespace and to handle macroscopic values.
Definition: Domain.h:47
Definition: NeighbourCommunicationScheme.h:18
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
Enumeration class corresponding to the type schema type.
Definition: vtk-unstructured.h:1746
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
Definition: HaloRegion.h:10