Go to the documentation of this file.
68 <<
"problem : comm:" << comm
87 <<
"problem : comm:" << comm
122 for (
label procID = 1; procID < nProcs; procID++)
133 return linearCommunication;
147 forAll(myChildren, childI)
149 allReceives.
append(myChildren[childI]);
150 collectReceives(myChildren[childI], receives, allReceives);
187 while ((1 << nLevels) < nProcs)
198 label childOffset = offset/2;
200 for (
label level = 0; level < nLevels; level++)
203 while (receiveID < nProcs)
206 label sendID = receiveID + childOffset;
210 receives[receiveID].
append(sendID);
211 sends[sendID] = receiveID;
224 for (
label procID = 0; procID < nProcs; procID++)
226 collectReceives(procID, receives, allReceives[procID]);
232 for (
label procID = 0; procID < nProcs; procID++)
239 receives[procID].shrink(),
240 allReceives[procID].shrink()
243 return treeCommunication;
249 const label parentIndex,
255 if (!freeComms_.empty())
257 index = freeComms_.pop();
262 index = parentCommunicator_.size();
264 myProcNo_.append(-1);
266 parentCommunicator_.append(-1);
273 Pout<<
"Communicators : Allocating communicator " << index <<
endl
274 <<
" parent : " << parentIndex <<
endl
275 <<
" procs : " << subRanks <<
endl
280 myProcNo_[index] = 0;
283 procIDs_[index].setSize(subRanks.
size());
284 forAll(procIDs_[index], i)
286 procIDs_[index][i] = subRanks[i];
289 if (i >= 1 && subRanks[i] <= subRanks[i-1])
292 <<
"subranks not sorted : " << subRanks
293 <<
" when allocating subcommunicator from parent "
298 parentCommunicator_[index] = parentIndex;
300 linearCommunication_[index] = calcLinearComm(procIDs_[index].size());
301 treeCommunication_[index] = calcTreeComm(procIDs_[index].size());
304 if (doPstream && parRun())
306 allocatePstreamCommunicator(parentIndex, index);
327 if (doPstream && parRun())
355 int procID = myProcID;
358 while (parent(comm) != -1)
361 procID = parentRanks[procID];
371 const List<int>& parentRanks = procID(myComm);
372 label parentComm = parent(myComm);
374 if (parentComm == -1)
376 return findIndex(parentRanks, baseProcID);
380 label parentRank = procNo(parentComm, baseProcID);
381 return findIndex(parentRanks, parentRank);
389 const label currentComm,
390 const int currentProcID
394 return procNo(myComm, physProcID);
520 "nPollProcInterfaces",
virtual void readData(Foam::Istream &is)
Read.
static DynamicList< List< int > > procIDs_
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
List< label > labelList
A List of labels.
static int baseProcNo(const label myComm, const int procID)
Return physical processor number (i.e. processor number in.
#define forAll(list, i)
Loop across all elements in list.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
Foam::UPstream::communicator serialComm(-1, Foam::labelList(1, Foam::label(0)), false)
static DynamicList< List< commsStruct > > linearCommunication_
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
prefixOSstream Perr(cerr, "Perr")
static const NamedEnum< commsTypes, 3 > commsTypeNames
static LIFOStack< label > freeComms_
Ostream & endl(Ostream &os)
Add newline and flush stream.
static commsTypes defaultCommsType
Default commsType.
addcommsTypeToOpt(const char *name)
int optimisationSwitch(const char *name, const int defaultValue=0)
Lookup optimisation switch or add default value.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
static void setParRun(const label nProcs)
Set data for parallel running. Special case nProcs=0 to switch off.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void append(const T &)
Append an element at the end of the list.
virtual ~addcommsTypeToOpt()
static bool floatTransfer
Should compact transfer be used in which floats replace doubles.
static List< int > & procID(label communicator)
Process ID of given process index.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
addcommsTypeToOpt addcommsTypeToOpt_("commsType")
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
registerOptSwitch("floatTransfer", bool, Foam::UPstream::floatTransfer)
errorManip< error > abort(error &err)
Structure for communicating between processors.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static int nProcsSimpleSum
Number of processors at which the sum algorithm changes from linear.
Enum read(Istream &) const
Read a word from Istream and return the corresponding.
commsTypes
Types of communications.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual void writeData(Foam::Ostream &os) const
Write.
static void collectReceives(const label procID, const List< DynamicList< label > > &receives, DynamicList< label > &allReceives)
Helper function for tree communication schedule determination.
prefixOSstream Pout(cout, "Pout")
static label worldComm
Default communicator (all processors)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static label procNo(const label comm, const int baseProcID)
Return processor number in communicator (given physical processor.
static void freeCommunicators(const bool doPstream)
Free all communicators.
static List< commsStruct > calcLinearComm(const label nProcs)
Calculate linear communication schedule.
static DynamicList< int > myProcNo_
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static label parent(const label communicator)
Helper class for allocating/freeing communicators.
A LIFO stack based on a singly-linked list.
static DynamicList< label > parentCommunicator_
dictionary & optimisationSwitches()
The OptimisationSwitches sub-dictionary in the central controlDict.
defineTypeNameAndDebug(combustionModel, 0)
static List< commsStruct > calcTreeComm(const label nProcs)
Calculate tree communication schedule.
const string & prefix() const
Return the prefix of the stream.
void addOptimisationObject(const char *name, simpleRegIOobject *obj)
Register optimisation switch read/write object.
Abstract base class for registered object with I/O. Used in debug symbol registration.
word name(const complex &)
Return a string representation of a complex.
Initialise the NamedEnum HashTable from the static list of names.
static int nPollProcInterfaces
Number of polling cycles in processor updates.
static DynamicList< List< commsStruct > > treeCommunication_