Go to the documentation of this file.
34 template<
class Type,
class BinaryOp>
43 const label communicator
46 if (!UPstream::parRun())
51 profilingPstream::beginTiming();
53 if (UPstream::nProcs(communicator) <= UPstream::nProcsSimpleSum)
55 if (UPstream::master(communicator))
59 int slave=UPstream::firstSlave();
60 slave<=UPstream::lastSlave(communicator);
85 Value = bop(Value, value);
110 if (UPstream::master(communicator))
114 int slave=UPstream::firstSlave();
115 slave<=UPstream::lastSlave(communicator);
147 UPstream::masterNo(),
175 profilingPstream::addReduceTime();
184 MPI_Datatype MPIType,
186 const label communicator,
190 if (!UPstream::parRun())
195 if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
197 Pout<<
"** non-blocking reducing:"
198 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
199 <<
" with comm:" << communicator
200 <<
" warnComm:" << UPstream::warnComm <<
endl;
201 error::printStack(
Pout);
204 profilingPstream::beginTiming();
206 #if defined(MPI_VERSION) && (MPI_VERSION >= 3)
223 <<
"MPI_Iallreduce failed for "
224 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
241 Pout<<
"UPstream::allocateRequest for non-blocking reduce"
242 <<
" : request:" << requestID <<
endl;
260 <<
"MPI_Allreduce failed for "
261 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
267 profilingPstream::addReduceTime();
int debug
Static debugging option.
DynamicList< label > freedRequests_
DynamicList< MPI_Request > outstandingRequests_
Outstanding non-blocking operations.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void iallReduce(void *Value, int count, MPI_Datatype MPIType, MPI_Op op, const label communicator, label &requestID)
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
DynamicList< MPI_Comm > MPICommunicators_
void allReduce(Type &Value, int count, MPI_Datatype MPIType, MPI_Op op, const BinaryOp &bop, const int tag, const label communicator)
errorManip< error > abort(error &err)
Various functions to wrap MPI_Allreduce.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
T remove()
Remove and return the last element. Fatal on an empty list.