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))
57 for (
const int proci : UPstream::subProcs(communicator))
80 Value = bop(Value, value);
105 if (UPstream::master(communicator))
107 for (
const int proci : UPstream::subProcs(communicator))
137 UPstream::masterNo(),
165 profilingPstream::addReduceTime();
174 MPI_Datatype MPIType,
176 const label communicator,
180 if (!UPstream::parRun())
185 if (UPstream::warnComm != -1 && communicator != UPstream::warnComm)
187 Pout<<
"** non-blocking reducing:"
188 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
189 <<
" with comm:" << communicator
190 <<
" warnComm:" << UPstream::warnComm <<
endl;
191 error::printStack(
Pout);
194 profilingPstream::beginTiming();
196 #if defined(MPI_VERSION) && (MPI_VERSION >= 3)
213 <<
"MPI_Iallreduce failed for "
214 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
231 Pout<<
"UPstream::allocateRequest for non-blocking reduce"
232 <<
" : request:" << requestID <<
endl;
250 <<
"MPI_Allreduce failed for "
251 <<
UList<Type>(
static_cast<Type*
>(recvBuf), MPICount)
257 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
OSstream wrapped stdout (std::cout) with parallel prefix.
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.