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]);
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A list that is sorted upon construction or when explicitly requested with the sort() method...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
commSchedule(const label nProcs, const List< labelPair > &comms)
Construct from wanted communication. Wanted communication is between.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
An ordered pair of two objects of type <T> with first() and second() elements.
void append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
Istream and Ostream manipulators taking arguments.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
string str() const
Return the string.
Omanip< int > setw(const int i)
Output to memory buffer stream.
static const label labelMin