55 label nOutstanding = 0;
57 for (
const label commPairi : procComms)
59 if (commToSchedule[commPairi] == -1)
78 schedule_(comms.size()),
86 const label proc0 = comms[commPairi].
first();
87 const label proc1 = comms[commPairi].second();
89 if (proc0 < 0 || proc0 >= nProcs || proc1 < 0 || proc1 >= nProcs)
92 <<
"Illegal processor(s): " 103 Pout<<
"commSchedule : Wanted communication:" <<
endl;
110 << twoProcs.first() <<
" <-> " << twoProcs.second() <<
endl;
115 Pout<<
"commSchedule : Schedule:" <<
endl;
122 for (
int i = 0; i < nProcs; i++)
131 for (
int i = 0; i < nProcs; i++)
142 label nScheduled = 0;
149 while (nScheduled < comms.
size())
151 label oldNScheduled = nScheduled;
165 const label proc0 = comms[commPairi].
first();
166 const label proc1 = comms[commPairi].second();
170 commToSchedule[commPairi] == -1
197 commToSchedule[maxComm] = nScheduled++;
198 busy[comms[maxComm].
first()] =
true;
199 busy[comms[maxComm].second()] =
true;
204 label nIterComms = nScheduled-oldNScheduled;
210 forAll(commToSchedule, commPairi)
212 const label sched = commToSchedule[commPairi];
214 if (sched >= oldNScheduled && sched < nScheduled)
216 const label proc0 = comms[commPairi].first();
217 const label proc1 = comms[commPairi].second();
218 procToComm[proc0] = commPairi;
219 procToComm[proc1] = commPairi;
225 os <<
setw(3) << iter <<
" |";
228 if (procToComm[proci] == -1)
234 os <<
setw(3) << procToComm[proci];
259 for (
const label commPairi : schedule_)
261 const labelPair& twoProcs = comms[commPairi];
263 nProcScheduled[twoProcs.first()]++;
264 nProcScheduled[twoProcs.second()]++;
268 forAll(procSchedule_, proci)
276 for (
const label commPairi : schedule_)
278 const labelPair& twoProcs = comms[commPairi];
280 const label proc0 = twoProcs.
first();
281 const label proc1 = twoProcs.second();
283 procSchedule_[proc0][nProcScheduled[proc0]++] = commPairi;
284 procSchedule_[proc1][nProcScheduled[proc1]++] = commPairi;
289 Pout<<
"commSchedule::commSchedule : Per processor:" <<
endl;
291 forAll(procSchedule_, proci)
293 const labelList& procComms = procSchedule_[proci];
295 Pout<<
"Processor " << proci <<
" talks to processors:" <<
endl;
297 for (
const label commPairi : procComms)
299 const labelPair& twoProcs = comms[commPairi];
302 << (proci == twoProcs[1] ? twoProcs[0] : twoProcs[1])
const T & first() const noexcept
Access the first element.
void size(const label n)
Older name for setAddressableSize.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Input/output from string buffers.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
T & first()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between two processors. Can be a one-way communication or two-way communication, that is up to the caller.
void push_back(const T &val)
Append an element at the end of the list.
#define forAll(list, i)
Loop across all elements in list.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
errorManip< error > abort(error &err)
Istream and Ostream manipulators taking arguments.
int debug
Static debugging option.
Pair< label > labelPair
A pair of labels.
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
Omanip< int > setw(const int i)
List< label > labelList
A List of labels.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
static label outstandingComms(const labelUList &commToSchedule, const DynamicList< label > &procComms)
static constexpr const zero Zero
Global zero (0)