47 DynamicList<label>& procComms
50 label nOutstanding = 0;
54 if (commToSchedule[procComms[i]] == -1)
71 schedule_(comms.size()),
79 label proc0 = comms[commI][0];
80 label proc1 = comms[commI][1];
82 if (proc0 < 0 || proc0 >= nProcs || proc1 < 0 || proc1 >= nProcs)
88 procToComms[proc0].
append(commI);
89 procToComms[proc1].
append(commI);
95 Pout<<
"commSchedule::commSchedule : Wanted communication:" <<
endl;
102 << twoProcs[0] <<
" with " << twoProcs[1] <<
endl;
107 Pout<<
"commSchedule::commSchedule : Schedule:" <<
endl;
114 for (
int i = 0; i < nProcs; i++)
123 for (
int i = 0; i < nProcs; i++)
134 label nScheduled = 0;
141 while (nScheduled < comms.
size())
143 label oldNScheduled = nScheduled;
157 label proc0 = comms[commI][0];
158 label proc1 = comms[commI][1];
162 commToSchedule[commI] == -1
168 outstandingComms(commToSchedule, procToComms[proc0])
169 + outstandingComms(commToSchedule, procToComms[proc1]);
187 commToSchedule[maxCommI] = nScheduled++;
188 busy[comms[maxCommI][0]] =
true;
189 busy[comms[maxCommI][1]] =
true;
194 label nIterComms = nScheduled-oldNScheduled;
200 forAll(commToSchedule, commI)
202 label sched = commToSchedule[commI];
204 if (sched >= oldNScheduled && sched < nScheduled)
206 label proc0 = comms[commI][0];
207 procToComm[proc0] = commI;
208 label proc1 = comms[commI][1];
209 procToComm[proc1] = commI;
215 os <<
setw(3) << iter <<
" |";
218 if (procToComm[proci] == -1)
224 os <<
setw(3) << procToComm[proci];
250 label commI = schedule_[i];
251 const labelPair& twoProcs = comms[commI];
253 nProcScheduled[twoProcs[0]]++;
254 nProcScheduled[twoProcs[1]]++;
257 forAll(procSchedule_, proci)
259 procSchedule_[proci].
setSize(nProcScheduled[proci]);
265 label commI = schedule_[i];
266 const labelPair& twoProcs = comms[commI];
268 label proc0 = twoProcs[0];
269 procSchedule_[proc0][nProcScheduled[proc0]++] = commI;
271 label proc1 = twoProcs[1];
272 procSchedule_[proc1][nProcScheduled[proc1]++] = commI;
277 Pout<<
"commSchedule::commSchedule : Per processor:" <<
endl;
279 forAll(procSchedule_, proci)
281 const labelList& procComms = procSchedule_[proci];
283 Pout<<
"Processor " << proci <<
" talks to processors:" <<
endl;
287 const labelPair& twoProcs = comms[procComms[i]];
289 label nbr = (twoProcs[1] == proci ? twoProcs[0] : twoProcs[1]);
Istream and Ostream manipulators taking arguments.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
#define forAll(list, i)
Loop across all elements in list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Output to memory buffer stream.
string str() const
Return the string.
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
static bool master(const label communicator=0)
Am I the master process.
Determines the order in which a set of processors should communicate with one another.
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Omanip< int > setw(const int i)
errorManip< error > abort(error &err)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
static const label labelMin