UPstream.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2015-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::UPstream
29 
30 Description
31  Inter-processor communications stream
32 
33 SourceFiles
34  UPstream.C
35  UPstreamCommsStruct.C
36  gatherScatter.C
37  combineGatherScatter.C
38  gatherScatterList.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef UPstream_H
43 #define UPstream_H
44 
45 #include "labelList.H"
46 #include "DynamicList.H"
47 #include "HashTable.H"
48 #include "string.H"
49 #include "Enum.H"
50 #include "ListOps.H"
51 #include "LIFOStack.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 /*---------------------------------------------------------------------------*\
59  Class UPstream Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class UPstream
63 {
64 public:
65 
66  //- Int ranges are used for MPI ranks (processes)
67  typedef IntRange<int> rangeType;
68 
69  //- Types of communications
70  enum class commsTypes
71  {
72  blocking,
73  scheduled,
75  };
76 
77  //- Names of the communication types
78  static const Enum<commsTypes> commsTypeNames;
79 
80 
81  // Public Classes
82 
83  //- Structure for communicating between processors
84  class commsStruct
85  {
86  // Private data
87 
88  //- procID of above processor
89  label above_;
90 
91  //- procIDs of processors directly below me
92  labelList below_;
93 
94  //- procIDs of all processors below (so not just directly below)
95  labelList allBelow_;
96 
97  //- procIDs of all processors not below.
98  // (inverse set of allBelow_ and minus myProcNo)
99  labelList allNotBelow_;
100 
101 
102  public:
103 
104  // Constructors
105 
106  //- Construct null
107  commsStruct();
108 
109  //- Construct from components
111  (
112  const label above,
113  const labelList& below,
114  const labelList& allBelow,
115  const labelList& allNotBelow
116  );
117 
118  //- Construct from components; construct allNotBelow_
120  (
121  const label nProcs,
122  const label myProcID,
123  const label above,
124  const labelList& below,
125  const labelList& allBelow
126  );
127 
128 
129  // Member Functions
130 
131  // Access
132 
133  label above() const
134  {
135  return above_;
136  }
137 
138  const labelList& below() const
139  {
140  return below_;
141  }
142 
143  const labelList& allBelow() const
144  {
145  return allBelow_;
146  }
147 
148  const labelList& allNotBelow() const
149  {
150  return allNotBelow_;
151  }
152 
153 
154  // Member operators
155 
156  bool operator==(const commsStruct&) const;
157 
158  bool operator!=(const commsStruct&) const;
159 
160 
161  // Ostream Operator
162 
163  friend Ostream& operator<<(Ostream&, const commsStruct&);
164  };
165 
166 
167  //- combineReduce operator for lists. Used for counting.
168  struct listEq
169  {
170  template<class T>
171  void operator()(T& x, const T& y) const
172  {
173  forAll(y, i)
174  {
175  if (y[i].size())
176  {
177  x[i] = y[i];
178  }
179  }
180  }
181  };
182 
183 
184 private:
185 
186  // Private Data
187 
188  //- By default this is not a parallel run
189  static bool parRun_;
190 
191  //- Have support for threads?
192  static bool haveThreads_;
193 
194  //- Standard transfer message type
195  static int msgType_;
196 
197  //- Names of all worlds
198  static wordList allWorlds_;
199 
200  //- Per processor the name of the world
201  static labelList worldIDs_;
202 
203 
204  // Communicator specific data
205 
206  //- Free communicators
207  static LIFOStack<label> freeComms_;
208 
209  //- My processor number
210  static DynamicList<int> myProcNo_;
211 
212  //- List of process IDs
213  static DynamicList<List<int>> procIDs_;
214 
215  //- Parent communicator
216  static DynamicList<label> parentCommunicator_;
217 
218  //- Linear communication schedule
219  static DynamicList<List<commsStruct>> linearCommunication_;
220 
221  //- Multi level communication schedule
222  static DynamicList<List<commsStruct>> treeCommunication_;
223 
224 
225  // Private Member Functions
226 
227  //- Set data for parallel running
228  static void setParRun(const label nProcs, const bool haveThreads);
229 
230  //- Calculate linear communication schedule
231  static List<commsStruct> calcLinearComm(const label nProcs);
232 
233  //- Calculate tree communication schedule
234  static List<commsStruct> calcTreeComm(const label nProcs);
235 
236  //- Helper function for tree communication schedule determination
237  // Collects all processorIDs below a processor
238  static void collectReceives
239  (
240  const label procID,
241  const List<DynamicList<label>>& receives,
242  DynamicList<label>& allReceives
243  );
244 
245  //- Allocate a communicator with index
246  static void allocatePstreamCommunicator
247  (
248  const label parentIndex,
249  const label index
250  );
251 
252  //- Free a communicator
253  static void freePstreamCommunicator
254  (
255  const label index
256  );
257 
258 
259 protected:
260 
261  // Protected Data
262 
263  //- Communications type of this stream
265 
266 public:
267 
268  // Declare name of the class and its debug switch
269  ClassName("UPstream");
270 
271 
272  // Static Data
273 
274  //- Should compact transfer be used in which floats replace doubles
275  //- reducing the bandwidth requirement at the expense of some loss
276  //- in accuracy
277  static bool floatTransfer;
278 
279  //- Number of processors at which the sum algorithm changes from linear
280  //- to tree
281  static int nProcsSimpleSum;
282 
283  //- Default commsType
285 
286  //- Number of polling cycles in processor updates
287  static int nPollProcInterfaces;
288 
289  //- Optional maximum message size (bytes)
290  static int maxCommsSize;
291 
292  //- MPI buffer-size (bytes)
293  static const int mpiBufferSize;
294 
295  //- Default communicator (all processors)
296  static label worldComm;
297 
298  //- Debugging: warn for use of any communicator differing from warnComm
299  static label warnComm;
300 
301 
302  // Constructors
303 
304  //- Construct given optional buffer size
306  :
308  {}
309 
310 
311  // Member Functions
312 
313  //- Allocate a new communicator
314  static label allocateCommunicator
315  (
316  const label parent,
317  const labelList& subRanks,
318  const bool doPstream = true
319  );
320 
321  //- Free a previously allocated communicator
322  static void freeCommunicator
323  (
324  const label communicator,
325  const bool doPstream = true
326  );
327 
328  //- Free all communicators
329  static void freeCommunicators(const bool doPstream);
330 
331  //- Helper class for allocating/freeing communicators
332  class communicator
333  {
334  label comm_;
335 
336  //- No copy construct
337  communicator(const communicator&) = delete;
338 
339  //- No copy assignment
340  void operator=(const communicator&) = delete;
341 
342  public:
343 
345  (
346  const label parent,
347  const labelList& subRanks,
348  const bool doPstream
349  )
350  :
351  comm_(allocateCommunicator(parent, subRanks, doPstream))
352  {}
353 
354  ~communicator()
355  {
356  freeCommunicator(comm_);
357  }
358 
359  operator label() const
360  {
361  return comm_;
362  }
363  };
364 
365  //- Return physical processor number (i.e. processor number in
366  //- worldComm) given communicator and procssor
367  static int baseProcNo(const label myComm, const int procID);
368 
369  //- Return processor number in communicator (given physical processor
370  //- number) (= reverse of baseProcNo)
371  static label procNo(const label comm, const int baseProcID);
372 
373  //- Return processor number in communicator (given processor number
374  //- and communicator)
375  static label procNo
376  (
377  const label myComm,
378  const label currentComm,
379  const int currentProcID
380  );
381 
382  //- Add the valid option this type of communications library
383  //- adds/requires on the command line
384  static void addValidParOptions(HashTable<string>& validParOptions);
385 
386  //- Initialisation function called from main
387  // Spawns sub-processes and initialises inter-communication
388  static bool init(int& argc, char**& argv, const bool needsThread);
389 
390  //- Special purpose initialisation function.
391  // Performs a basic MPI_Init without any other setup.
392  // Only used for applications that need MPI communication when
393  // OpenFOAM is running in a non-parallel mode.
394  // \note Behaves as a no-op if MPI has already been initialized.
395  // Fatal if MPI has already been finalized.
396  static bool initNull();
397 
398 
399  // Non-blocking comms
400 
401  //- Get number of outstanding requests
402  static label nRequests();
403 
404  //- Truncate number of outstanding requests
405  static void resetRequests(const label sz);
406 
407  //- Wait until all requests (from start onwards) have finished.
408  static void waitRequests(const label start = 0);
409 
410  //- Wait until request i has finished.
411  static void waitRequest(const label i);
412 
413  //- Non-blocking comms: has request i finished?
414  static bool finishedRequest(const label i);
415 
416  static int allocateTag(const char*);
417 
418  static int allocateTag(const word&);
419 
420  static void freeTag(const char*, const int tag);
421 
422  static void freeTag(const word&, const int tag);
423 
424 
425  //- Set as parallel run on/off.
426  // \return the previous value
427  static bool parRun(const bool on)
428  {
429  bool old(parRun_);
430  parRun_ = on;
431  return old;
432  }
433 
434  //- Test if this a parallel run, or allow modify access
435  static bool& parRun()
436  {
437  return parRun_;
438  }
439 
440  //- Have support for threads
441  static bool haveThreads()
442  {
443  return haveThreads_;
444  }
445 
446  //- Number of processes in parallel run, and 1 for serial run
447  static label nProcs(const label communicator = worldComm)
448  {
449  return procIDs_[communicator].size();
450  }
451 
452  //- Process index of the master (always 0)
453  static constexpr int masterNo() noexcept
454  {
455  return 0;
456  }
457 
458  //- Am I the master process
459  static bool master(const label communicator = worldComm)
460  {
461  return myProcNo_[communicator] == masterNo();
462  }
463 
464  //- Number of this process (starting from masterNo() = 0)
465  static int myProcNo(const label communicator = worldComm)
466  {
467  return myProcNo_[communicator];
468  }
469 
470  static label parent(const label communicator)
471  {
472  return parentCommunicator_(communicator);
473  }
474 
475  //- Process ID of given process index
476  static List<int>& procID(label communicator)
477  {
478  return procIDs_[communicator];
479  }
480 
481 
482  // Worlds
483 
484  //- All worlds
485  static const wordList& allWorlds()
486  {
487  return allWorlds_;
488  }
489 
490  //- worldID (index in allWorlds) of all processes
491  static const labelList& worldIDs()
492  {
493  return worldIDs_;
494  }
495 
496  //- My worldID
497  static label myWorldID()
498  {
499  return worldIDs_[myProcNo(0)];
500  }
501 
502  //- My world
503  static const word& myWorld()
504  {
505  return allWorlds()[myWorldID()];
506  }
507 
508 
509  //- Range of process indices for all processes
510  static rangeType allProcs(const label communicator = worldComm)
511  {
512  // Proc 0 -> nProcs (int value)
513  return rangeType(static_cast<int>(nProcs(communicator)));
514  }
515 
516  //- Range of process indices for sub-processes
517  static rangeType subProcs(const label communicator = worldComm)
518  {
519  // Proc 1 -> nProcs (int value)
520  return rangeType(1, static_cast<int>(nProcs(communicator)-1));
521  }
522 
523  //- Communication schedule for linear all-to-master (proc 0)
525  (
526  const label communicator = worldComm
527  )
528  {
529  return linearCommunication_[communicator];
530  }
531 
532  //- Communication schedule for tree all-to-master (proc 0)
534  (
535  const label communicator = worldComm
536  )
537  {
538  return treeCommunication_[communicator];
539  }
540 
541  //- Message tag of standard messages
542  static int& msgType()
543  {
544  return msgType_;
545  }
546 
547 
548  //- Get the communications type of the stream
549  commsTypes commsType() const
550  {
551  return commsType_;
552  }
553 
554  //- Set the communications type of the stream
556  {
557  commsTypes oldCommsType = commsType_;
558  commsType_ = ct;
559  return oldCommsType;
560  }
561 
562 
563  //- Shutdown (finalize) MPI as required.
564  // Uses MPI_Abort instead of MPI_Finalize if errNo is non-zero
565  static void shutdown(int errNo = 0);
566 
567  //- Call MPI_Abort with no other checks or cleanup
568  static void abort();
569 
570  //- Shutdown (finalize) MPI as required and exit program with errNo.
571  static void exit(int errNo = 1);
572 
573  //- Exchange label with all processors (in the communicator).
574  // sendData[proci] is the label to send to proci.
575  // After return recvData contains the data from the other processors.
576  static void allToAll
577  (
578  const labelUList& sendData,
579  labelUList& recvData,
580  const label communicator = worldComm
581  );
582 
583  //- Exchange data with all processors (in the communicator)
584  // sendSizes, sendOffsets give (per processor) the slice of
585  // sendData to send, similarly recvSizes, recvOffsets give the slice
586  // of recvData to receive
587  static void allToAll
588  (
589  const char* sendData,
590  const UList<int>& sendSizes,
591  const UList<int>& sendOffsets,
592 
593  char* recvData,
594  const UList<int>& recvSizes,
595  const UList<int>& recvOffsets,
596 
597  const label communicator = worldComm
598  );
599 
600  //- Receive data from all processors on the master
601  static void gather
602  (
603  const char* sendData,
604  int sendSize,
605 
606  char* recvData,
607  const UList<int>& recvSizes,
608  const UList<int>& recvOffsets,
609  const label communicator = worldComm
610  );
611 
612  //- Send data to all processors from the root of the communicator
613  static void scatter
614  (
615  const char* sendData,
616  const UList<int>& sendSizes,
617  const UList<int>& sendOffsets,
618 
619  char* recvData,
620  int recvSize,
621  const label communicator = worldComm
622  );
623 
624 
625  // Housekeeping
626 
627  //- Process index of first sub-process
628  // \deprecated(2020-09) use subProcs() method instead
629  static constexpr int firstSlave() noexcept
630  {
631  return 1;
632  }
633 
634  //- Process index of last sub-process
635  // \deprecated(2020-09) use subProcs() method instead
636  static int lastSlave(const label communicator = worldComm)
637  {
638  return nProcs(communicator) - 1;
639  }
640 };
641 
642 
643 Ostream& operator<<(Ostream&, const UPstream::commsStruct&);
644 
645 // Template specialisation for access of commsStruct
646 template<>
647 UPstream::commsStruct&
649 
650 template<>
651 const UPstream::commsStruct&
653 
654 
655 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
656 
657 } // End namespace Foam
658 
659 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
660 
661 #endif
662 
663 // ************************************************************************* //
Foam::UPstream::allocateTag
static int allocateTag(const char *)
Definition: UPstream.C:1293
Foam::UPstream::warnComm
static label warnComm
Debugging: warn for use of any communicator differing from warnComm.
Definition: UPstream.H:298
Foam::UPstream::linearCommunication
static const List< commsStruct > & linearCommunication(const label communicator=worldComm)
Communication schedule for linear all-to-master (proc 0)
Definition: UPstream.H:524
Foam::UPstream::commsTypes::blocking
Foam::UPstream::resetRequests
static void resetRequests(const label sz)
Truncate number of outstanding requests.
Definition: UPstream.C:230
Foam::UPstream::commsTypes::nonBlocking
Foam::Enum< commsTypes >
Foam::UPstream::masterNo
static constexpr int masterNo() noexcept
Process index of the master (always 0)
Definition: UPstream.H:452
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
HashTable.H
Foam::UPstream::communicator::~communicator
~communicator()
Definition: UPstream.H:353
Foam::UPstream::commsStruct::commsStruct
commsStruct()
Construct null.
Definition: UPstreamCommsStruct.C:33
Foam::UPstream::baseProcNo
static int baseProcNo(const label myComm, const int procID)
Definition: UPstream.C:205
Foam::UPstream::haveThreads
static bool haveThreads()
Have support for threads.
Definition: UPstream.H:440
Foam::DynamicList< int >
Foam::IntRange
An interval of (signed) integers defined by a start and a size.
Definition: IntRange.H:63
Foam::UPstream::worldIDs
static const labelList & worldIDs()
worldID (index in allWorlds) of all processes
Definition: UPstream.H:490
Foam::UPstream::parRun
static bool & parRun()
Test if this a parallel run, or allow modify access.
Definition: UPstream.H:434
Foam::UPstream::lastSlave
static int lastSlave(const label communicator=worldComm)
Process index of last sub-process.
Definition: UPstream.H:635
Foam::UPstream::listEq
combineReduce operator for lists. Used for counting.
Definition: UPstream.H:167
Foam::UPstream::commsStruct::operator<<
friend Ostream & operator<<(Ostream &, const commsStruct &)
Foam::UPstream::waitRequests
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
Definition: UPstream.C:234
Foam::UPstream::master
static bool master(const label communicator=worldComm)
Am I the master process.
Definition: UPstream.H:458
string.H
Foam::UPstream::abort
static void abort()
Call MPI_Abort with no other checks or cleanup.
Definition: UPstream.C:70
Foam::UPstream::defaultCommsType
static commsTypes defaultCommsType
Default commsType.
Definition: UPstream.H:283
Foam::UPstream::UPstream
UPstream(const commsTypes commsType)
Construct given optional buffer size.
Definition: UPstream.H:304
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::UPstream::commsStruct::operator==
bool operator==(const commsStruct &) const
Definition: UPstreamCommsStruct.C:95
Foam::UPstream::commsStruct::allBelow
const labelList & allBelow() const
Definition: UPstream.H:142
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::UPstream::subProcs
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
Definition: UPstream.H:516
Foam::UPstream::mpiBufferSize
static const int mpiBufferSize
MPI buffer-size (bytes)
Definition: UPstream.H:292
Foam::UPstream::allocateCommunicator
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
Definition: UPstream.C:100
Foam::UPstream::myWorldID
static label myWorldID()
My worldID.
Definition: UPstream.H:496
Foam::UPstream
Inter-processor communications stream.
Definition: UPstream.H:61
labelList.H
Foam::UPstream::floatTransfer
static bool floatTransfer
Definition: UPstream.H:276
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::UPstream::waitRequest
static void waitRequest(const label i)
Wait until request i has finished.
Definition: UPstream.C:238
Foam::UPstream::commsType
commsTypes commsType() const
Get the communications type of the stream.
Definition: UPstream.H:548
Foam::UPstream::addValidParOptions
static void addValidParOptions(HashTable< string > &validParOptions)
Definition: UPstream.C:34
Foam::UPstream::procID
static List< int > & procID(label communicator)
Process ID of given process index.
Definition: UPstream.H:475
Foam::UPstream::freeCommunicator
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
Definition: UPstream.C:166
Foam::UPstream::commsTypeNames
static const Enum< commsTypes > commsTypeNames
Names of the communication types.
Definition: UPstream.H:77
Foam::UPstream::commsTypes::scheduled
Foam::UPstream::myWorld
static const word & myWorld()
My world.
Definition: UPstream.H:502
Foam::UPstream::commsStruct::allNotBelow
const labelList & allNotBelow() const
Definition: UPstream.H:147
Foam::UPstream::allWorlds
static const wordList & allWorlds()
All worlds.
Definition: UPstream.H:484
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsStruct::above
label above() const
Definition: UPstream.H:132
Foam::UPstream::commsStruct
Structure for communicating between processors.
Definition: UPstream.H:83
Foam::UPstream::nProcsSimpleSum
static int nProcsSimpleSum
Definition: UPstream.H:280
Foam::UPstream::firstSlave
static constexpr int firstSlave() noexcept
Process index of first sub-process.
Definition: UPstream.H:628
Foam::HashTable
A HashTable similar to std::unordered_map.
Definition: HashTable.H:105
Foam::UPstream::msgType
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:541
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::UPstream::allProcs
static rangeType allProcs(const label communicator=worldComm)
Range of process indices for all processes.
Definition: UPstream.H:509
Foam::UPstream::nRequests
static label nRequests()
Get number of outstanding requests.
Definition: UPstream.C:224
Foam::UPstream::myProcNo
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Definition: UPstream.H:464
Foam::UPstream::listEq::operator()
void operator()(T &x, const T &y) const
Definition: UPstream.H:170
Foam::UPstream::commsType_
commsTypes commsType_
Communications type of this stream.
Definition: UPstream.H:263
Foam::UPstream::scatter
static void scatter(const char *sendData, const UList< int > &sendSizes, const UList< int > &sendOffsets, char *recvData, int recvSize, const label communicator=worldComm)
Send data to all processors from the root of the communicator.
Definition: UPstream.C:198
Foam::UPstream::rangeType
IntRange< int > rangeType
Int ranges are used for MPI ranks (processes)
Definition: UPstream.H:66
Foam::UPstream::initNull
static bool initNull()
Special purpose initialisation function.
Definition: UPstream.C:38
Foam::UPstream::maxCommsSize
static int maxCommsSize
Optional maximum message size (bytes)
Definition: UPstream.H:289
Foam::UPstream::worldComm
static label worldComm
Default communicator (all processors)
Definition: UPstream.H:295
Foam::List< label >
Foam::UList::operator[]
T & operator[](const label i)
Return element of UList.
Definition: UListI.H:246
Foam::UPstream::procNo
static label procNo(const label comm, const int baseProcID)
Definition: UPstream.C:221
Foam::UList< label >
Foam::UPstream::ClassName
ClassName("UPstream")
Foam::UPstream::commsType
commsTypes commsType(const commsTypes ct)
Set the communications type of the stream.
Definition: UPstream.H:554
Foam::UPstream::shutdown
static void shutdown(int errNo=0)
Shutdown (finalize) MPI as required.
Definition: UPstream.C:59
Foam::UPstream::finishedRequest
static bool finishedRequest(const label i)
Non-blocking comms: has request i finished?
Definition: UPstream.C:242
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::UPstream::freeCommunicators
static void freeCommunicators(const bool doPstream)
Free all communicators.
Definition: UPstream.C:193
DynamicList.H
ListOps.H
Various functions to operate on Lists.
Foam::UPstream::treeCommunication
static const List< commsStruct > & treeCommunication(const label communicator=worldComm)
Communication schedule for tree all-to-master (proc 0)
Definition: UPstream.H:533
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::UPstream::parent
static label parent(const label communicator)
Definition: UPstream.H:469
Foam::UPstream::communicator
Helper class for allocating/freeing communicators.
Definition: UPstream.H:331
Foam::LIFOStack< label >
Foam::UPstream::init
static bool init(int &argc, char **&argv, const bool needsThread)
Initialisation function called from main.
Definition: UPstream.C:48
Foam::UPstream::allToAll
static void allToAll(const labelUList &sendData, labelUList &recvData, const label communicator=worldComm)
Exchange label with all processors (in the communicator).
Definition: UPstream.C:172
Foam::UPstream::commsStruct::operator!=
bool operator!=(const commsStruct &) const
Definition: UPstreamCommsStruct.C:107
LIFOStack.H
Foam::UPstream::nProcs
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
Definition: UPstream.H:446
Foam::UPstream::gather
static void gather(const char *sendData, int sendSize, char *recvData, const UList< int > &recvSizes, const UList< int > &recvOffsets, const label communicator=worldComm)
Receive data from all processors on the master.
Definition: UPstream.C:183
Foam::UPstream::nPollProcInterfaces
static int nPollProcInterfaces
Number of polling cycles in processor updates.
Definition: UPstream.H:286
Foam::UPstream::commsStruct::below
const labelList & below() const
Definition: UPstream.H:137
y
scalar y
Definition: LISASMDCalcMethod1.H:14
Enum.H
Foam::UPstream::exit
static void exit(int errNo=1)
Shutdown (finalize) MPI as required and exit program with errNo.
Definition: UPstream.C:63
Foam::UPstream::freeTag
static void freeTag(const char *, const int tag)
Definition: UPstream.C:1351