19 #define TINYLOAD 0.0005 23 int nPatches,
int nPes) :
25 processorArray, nComps,
38 int nPatches, nProxies, badForComm;
49 int neighbor = 0, neighbor_alt = 0;
69 if(neighbor_alt == 1 && neighbor == 1) {
75 else if(neighbor_alt == 0 && neighbor == 1)
78 else if(neighbor_alt == 1 && neighbor == 0)
88 int alt_dist = 0, dist = 0;
89 int ax,ay,az, x,y,z, p1x,p1y,p1z, p2x,p2y,p2z;
91 tmgr.rankToCoordinates(altp->
Id, ax,ay,az);
92 tmgr.rankToCoordinates(p->
Id, x,y,z);
96 alt_dist = abs(p1x - ax) + abs(p2x - ax) +
97 abs(p1y - ay) + abs(p1z - az) +
98 abs(p2y - ay) + abs(p2z - az);
100 dist = abs(p1x - x) + abs(p2x - x) +
101 abs(p1y - y) + abs(p1z - z) +
102 abs(p2y - y) + abs(p2z - z);
109 if (!altp || p->
load < altp->
load ) {
116 processorInfo* &altp = poorP[nPatches][nProxies][badForComm];
117 if (!altp || p->
load < altp->
load ) {
123 void Alg7::strategy()
131 double startTime = CmiWallTimer();
166 if ( ! c )
NAMD_bug(
"Alg7: computesHeap empty!");
182 togrid(goodP, poorP, p, c);
185 togrid(goodP, poorP, p, c);
188 proxiesOn.iterator((
Iterator *)&nextProc);
190 togrid(goodP, poorP, p, c);
192 proxiesOn.next((
Iterator*)&nextProc);
196 proxiesOn.iterator((
Iterator *)&nextProc);
198 togrid(goodP, poorP, p, c);
200 proxiesOn.next((
Iterator*)&nextProc);
204 if ((p = goodP[0][2][0])
205 || (p = goodP[1][1][0])
206 || (p = goodP[2][0][0])
207 || (p = goodP[0][1][0])
208 || (p = goodP[1][0][0])
209 || (p = goodP[0][0][0])
210 || (p = goodP[0][1][1])
211 || (p = goodP[1][0][1])
212 || (p = goodP[0][0][1])
214 assign(c,p); numAssigned++;
225 togrid(goodP, poorP, p, c);
233 if ((p = goodP[0][2][0])
234 || (p = goodP[1][1][0])
235 || (p = goodP[2][0][0])
236 || (p = goodP[0][1][0])
237 || (p = goodP[1][0][0])
238 || (p = goodP[0][0][0])
239 || (p = goodP[0][1][1])
240 || (p = goodP[1][0][1])
241 || (p = goodP[0][0][1])
243 assign(c,p); numAssigned++;
246 || (p = poorP[1][1][0])
247 || (p = poorP[2][0][0])
248 || (p = poorP[0][1][0])
249 || (p = poorP[1][0][0])
250 || (p = poorP[0][0][0])
251 || (p = poorP[0][1][1])
252 || (p = poorP[1][0][1])
253 || (p = poorP[0][0][1])
256 assign(c,p); numAssigned++;
258 NAMD_bug(
"*** Alg 7 No receiver found 1 ***");
Alg7(computeInfo *computeArray, patchInfo *patchArray, processorInfo *processorArray, int nComps, int nPatches, int nPes)
void assign(computeInfo *c, processorInfo *pRec)
processorInfo * processors
void printLoads(int phase=0)
void numAvailable(computeInfo *c, processorInfo *p, int *nPatches, int *nProxies, int *isBadForCommunication)
InfoRecord * next(heapIterator *)
void multirefine(double overload_start=1.02)
void NAMD_bug(const char *err_msg)
maxHeap * computeBgSelfHeap
maxHeap * computeSelfHeap
maxHeap * computePairHeap
void adjustBackgroundLoadAndComputeAverage()
maxHeap * computeBgPairHeap
InfoRecord * iterator(heapIterator *)
const char * strategyName