00001
00012
00013
00014
00015 #define MAX_TEMP 49
00016
00017
00018 #include "TempAwareCommLB.h"
00019 #include "ckgraphTemp.h"
00020 #include <algorithm>
00021 #include <map>
00022
00023 #include <time.h>
00024
00025 #define THRESHOLD 0.02
00026 #define SWAP_MULTIPLIER 5
00027 #ifdef TEMP_LDB
00028
00029
00030 static int cpufreq_sysfs_write (
00031 const char *setting,int proc
00032 )
00033 {
00034 char path[100];
00035 sprintf(path,"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_setspeed",proc);
00036 FILE *fd = fopen (path, "w");
00037
00038 if (!fd) {
00039 printf("PROC#%d ooooooo666 FILE OPEN ERROR file=%s\n",CkMyPe(),path);
00040 return -1;
00041 }
00042
00043
00044 fseek ( fd , 0 , SEEK_SET );
00045 int numw=fprintf (fd, setting);
00046 if (numw <= 0) {
00047
00048 fclose (fd);
00049 printf("FILE WRITING ERROR\n");
00050 return 0;
00051 }
00052
00053 fclose(fd);
00054 return 1;
00055 }
00056
00057 static int cpufreq_sysfs_read (int proc)
00058 {
00059 FILE *fd;
00060 char path[100];
00061 int i=proc;
00062 sprintf(path,"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_setspeed",i);
00063
00064 fd = fopen (path, "r");
00065
00066 if (!fd) {
00067 printf("22 FILE OPEN ERROR file=%s\n",path);
00068 return 0;
00069 }
00070 char val[10];
00071 fgets(val,10,fd);
00072 int ff=atoi(val);
00073 fclose (fd);
00074
00075 return ff;
00076 }
00077
00078 void printCurrentTemperature(void *LB, double curWallTime)
00079 {
00080 TempAwareCommLB *taalb = static_cast<TempAwareCommLB *>(LB);
00081 int pe = CkMyPe();
00082 float temp = taalb->getTemp(pe % taalb->physicalCoresPerNode);
00083 int freq = cpufreq_sysfs_read (pe % taalb->logicalCoresPerNode);
00084 fprintf(taalb->logFD, "%f, %d, %f, %d\n", curWallTime, pe, temp, freq);
00085 }
00086
00087 #endif
00088 inline void eraseObjFromParrObjs(std::vector<int> & parr_objs, int remove_objid);
00089 inline void printMapping(std::vector<Vertex> &vertices);
00090 inline void removeFromArray(int pe_id, std::vector<int> &array);
00091 inline int popFromProcHeap(std::vector<int> & parr_above_avg, ProcArray *parr);
00092 inline void handleTransfer(int randomly_obj_id, ProcInfo& p, int possible_pe, std::vector<int> *parr_objs, ObjGraph *ogr, ProcArray* parr);
00093 inline void updateLoadInfo(int p_index, int possible_pe, double upper_threshold_temp, double lower_threshold_temp,
00094 std::vector<int> &parr_above_avg, std::vector<int> &parr_below_avg,
00095 std::vector<bool> &proc_load_info, ProcArray *parr);
00096 inline void getPossiblePes(std::vector<int>& possible_pes, int randomly_obj_id,
00097 ObjGraph *ogr, ProcArray* parr);
00098
00099 double upper_threshold_temp;
00100 double lower_threshold_temp;
00101
00102 extern int quietModeRequested;
00103
00104 CreateLBFunc_Def(TempAwareCommLB, "always assign the heaviest obj onto lightest loaded processor.")
00105
00106 TempAwareCommLB::TempAwareCommLB(const CkLBOptions &opt): CBase_TempAwareCommLB(opt)
00107 {
00108 #ifdef TEMP_LDB
00109 lbname = "TempAwareCommLB";
00110 if (CkMyPe()==0 && !quietModeRequested)
00111 CkPrintf("CharmLB> TempAwareCommLB created.\n");
00112
00113 starting=CmiWallTimer();
00114 migFile=fopen("migInfo","w");
00115 numAvailFreqs = 11;
00116 freqs=new int[numAvailFreqs];
00117 freqsEffect=new int[numAvailFreqs];
00118
00119 freqs[0] = 2395000;
00120 freqs[1] = 2394000;
00121 freqs[2] = 2261000;
00122 freqs[3] = 2128000;
00123 freqs[4] = 1995000;
00124 freqs[5] = 1862000;
00125 freqs[6] = 1729000;
00126 freqs[7] = 1596000;
00127 freqs[8] = 1463000;
00128 freqs[9] = 1330000;
00129 freqs[10] = 1197000;
00130
00131 freqsEffect[0] = 1979886;
00132 freqsEffect[1] = 1943017;
00133 freqsEffect[2] = 1910989;
00134 freqsEffect[3] = 1876619;
00135 freqsEffect[4] = 1824126;
00136 freqsEffect[5] = 1763990;
00137 freqsEffect[6] = 1666773;
00138 freqsEffect[7] = 1560224;
00139 freqsEffect[8] = 1443154;
00140 freqsEffect[9] = 1317009;
00141 freqsEffect[10] = 1200000;
00142
00143 procFreqPtr = new int[CkNumPes()];
00144
00145 for(int i=0;i<CkNumPes();i++)
00146 {
00147 char newfreq[10];
00148 sprintf(newfreq,"%d",freqs[0]);
00149 cpufreq_sysfs_write(newfreq,i%physicalCoresPerNode);
00150 procFreqPtr[i]=0;
00151 }
00152
00153 procFreq=NULL;
00154 procTemp=NULL;
00155 procFreqNew=NULL;
00156 procFreqNewEffect = NULL;
00157 avgChipTemp=NULL;
00158
00159 char logFile[100];
00160 snprintf(logFile, sizeof(logFile), "temp_freq.log.%d", CkMyPe());
00161 if ((logFD = fopen(logFile, "a"))) {
00162 fprintf(logFD, "Time, PE, Temperature, Frequency\n");
00163 } else {
00164 CkAbort("Couldn't open temperature/frequency log file");
00165 }
00166
00167
00168 CcdCallOnConditionKeep(CcdPERIODIC_1second, &printCurrentTemperature, this);
00169 #else
00170 #endif
00171 }
00172
00173 bool TempAwareCommLB::QueryBalanceNow(int _step)
00174 {
00175
00176 return true;
00177 }
00178
00179 class TempAwareCommLB::ProcLoadGreater {
00180 public:
00181 ProcLoadGreater(ProcArray *parr) : parr(parr) {
00182 }
00183 bool operator()(int lhs, int rhs) {
00184 return (parr->procs[lhs].getTotalLoad() < parr->procs[rhs].getTotalLoad());
00185 }
00186
00187 private:
00188 ProcArray *parr;
00189 };
00190
00191 class TempAwareCommLB::ObjLoadGreater {
00192 public:
00193 bool operator()(Vertex v1, Vertex v2) {
00194 return (v1.getVertexLoad() > v2.getVertexLoad());
00195 }
00196 };
00197
00198 class TempAwareCommLB::PeCommInfo {
00199 public:
00200 PeCommInfo() : num_msg(0), num_bytes(0) {
00201 }
00202
00203 PeCommInfo(int pe_id) : pe_id(pe_id), num_msg(0) , num_bytes(0) {
00204 }
00205 int pe_id;
00206 int num_msg;
00207 int num_bytes;
00208
00209 };
00210
00211
00212
00213 class TempAwareCommLB::ObjPeCommInfo {
00214 public:
00215 ObjPeCommInfo() {
00216 }
00217
00218 int obj_id;
00219 std::vector<TempAwareCommLB::PeCommInfo> pcomm;
00220 };
00221
00222 class TempAwareCommLB::ProcCommGreater {
00223 public:
00224 bool operator()(TempAwareCommLB::PeCommInfo p1, TempAwareCommLB::PeCommInfo p2) {
00225
00226 return (p1.num_bytes > p2.num_bytes);
00227 }
00228 };
00229
00230 void PrintProcLoadTemp(ProcArray *parr) {
00231 int vert;
00232 double pe_load;
00233 for (vert = 0; vert < parr->procs.size(); vert++) {
00234 pe_load = parr->procs[vert].getTotalLoad();
00235 if (pe_load > upper_threshold_temp) {
00236 CkPrintf("Above load : %d load : %E overhead : %E\n",
00237 parr->procs[vert].getProcId(), parr->procs[vert].getTotalLoad(),
00238 parr->procs[vert].overhead());
00239 } else if (pe_load < lower_threshold_temp) {
00240 CkPrintf("Below load : %d load : %E overhead : %E\n",
00241 parr->procs[vert].getProcId(), parr->procs[vert].getTotalLoad(),
00242 parr->procs[vert].overhead());
00243 } else {
00244 CkPrintf("Within avg load : %d load : %E overhead : %E\n",
00245 parr->procs[vert].getProcId(), parr->procs[vert].getTotalLoad(),
00246 parr->procs[vert].overhead());
00247 }
00248 }
00249 }
00250
00251 void PrintProcObjTemp(ProcArray *parr, std::vector<int>* parr_objs) {
00252 int i, j;
00253 CkPrintf("---------------------\n");
00254 for (i = 0; i < parr->procs.size(); i++) {
00255 CkPrintf("[%d] contains ", i);
00256 for (j = 0; j < parr_objs[i].size(); j++) {
00257 CkPrintf(" %d, ", parr_objs[i][j]);
00258 }
00259 CkPrintf("\n");
00260 }
00261 CkPrintf("---------------------\n");
00262 }
00263
00264 void TempAwareCommLB::populateEffectiveFreq(int numProcs)
00265 {
00266 #ifdef TEMP_LDB
00267 for(int i=0;i<numProcs;i++)
00268 {
00269 for(int j=0;j<numAvailFreqs;j++)
00270 {
00271 if(freqs[j] == procFreqNew[i])
00272 {
00273 procFreqNewEffect[i] = freqsEffect[j];
00274
00275 }
00276 if(freqs[j] == procFreq[i])
00277 {
00278 procFreqEffect[i] = freqsEffect[j];
00279
00280 }
00281 }
00282 }
00283 #endif
00284 }
00285
00286
00287 void TempAwareCommLB::initStructs(LDStats* stats)
00288 {
00289 #ifdef TEMP_LDB
00290 numProcs=stats->nprocs();
00291 numChips=numProcs/logicalCoresPerChip;
00292 avgChipTemp=new float[numChips];
00293 if(procFreq!=NULL) delete [] procFreq;
00294 if(procFreqEffect!=NULL) delete [] procFreqEffect;
00295 if(procTemp!=NULL) delete [] procTemp;
00296 if(procFreqNew!=NULL) delete [] procFreqNew;
00297 if(procFreqNewEffect!=NULL) delete [] procFreqNewEffect;
00298 if(avgChipTemp!=NULL) delete [] avgChipTemp;
00299
00300 procFreq = new int[numProcs];
00301 procFreqEffect = new int[numProcs];
00302 procTemp = new float[numProcs];
00303 procFreqNew = new int[numProcs];
00304 procFreqNewEffect = new int[numProcs];
00305 avgChipTemp = new float[numChips];
00306
00307 for(int i=0;i<numChips;i++) avgChipTemp[i]=0;
00308
00309 for(int i=0;i<numProcs;i++)
00310 {
00311 procFreq[i] = stats->procs[i].pe_speed;
00312 procTemp[i] = stats->procs[i].pe_temp;
00313 avgChipTemp[i/logicalCoresPerChip] += procTemp[i];
00314 }
00315 for(int i=0;i<numChips;i++)
00316 {
00317 avgChipTemp[i]/=logicalCoresPerChip;
00318
00319 }
00320 #endif
00321 }
00322
00323 void TempAwareCommLB::tempControl()
00324 {
00325 #ifdef TEMP_LDB
00326 CkPrintf("----------- TempAwareCommLB::tempControl ---------\n");
00327 for(int i=0;i<numChips;i++)
00328 {
00329 int over=0,under=0;
00330 if(avgChipTemp[i] > MAX_TEMP)
00331 {
00332 over=1;
00333 if(procFreqPtr[i*logicalCoresPerChip]==numAvailFreqs-1)
00334 {
00335 for(int j=i*logicalCoresPerChip;j<i*logicalCoresPerChip+logicalCoresPerChip;j++) procFreqNew[j] = freqs[procFreqPtr[j]];
00336 CkPrintf("CHIP#%d RUNNING HOT EVEN WITH MIN FREQUENCY!!\n",i);
00337 }
00338 else
00339 {
00340 for(int j=i*logicalCoresPerChip;j<i*logicalCoresPerChip+logicalCoresPerChip;j++)
00341 {
00342 if(procFreqPtr[j]<numAvailFreqs-1) procFreqPtr[j]++;
00343 #ifdef MAX_MIN
00345 if(i==0) {procFreqPtr[j] = numAvailFreqs-1;}
00346
00347 else procFreqPtr[j]=0;
00349 #endif
00350 procFreqNew[j] = freqs[procFreqPtr[j]];
00351 }
00352 #ifndef ORG_VERSION
00353 CkPrintf("!!!!! Chip#%d running HOT shifting from %d to %d temp=%f\n",i,procFreq[i*logicalCoresPerChip],procFreqNew[i*logicalCoresPerChip],avgChipTemp[i]);
00354 #endif
00355 }
00356 }
00357 else
00358
00359 {
00360 under=1;
00361 if(procFreqPtr[i*logicalCoresPerChip]>0)
00362 {
00363 for(int j=i*logicalCoresPerChip;j<i*logicalCoresPerChip+logicalCoresPerChip;j++)
00364 {
00365 if(procFreqPtr[j]>0)
00366 procFreqPtr[j]--;
00367 #ifdef MAX_MIN
00369 if(i==0) procFreqPtr[j] = numAvailFreqs-1;
00370
00371 else procFreqPtr[j]=0;
00373 #endif
00374 procFreqNew[j] = freqs[procFreqPtr[j]];
00375 }
00376 #ifndef ORG_VERSION
00377 CkPrintf("!!!!! Chip#%d running COLD shifting from %d to %d temp=%f\n",i,procFreq[i*logicalCoresPerChip],procFreqNew[i*logicalCoresPerChip],avgChipTemp[i]);
00378 #endif
00379 }
00380 else
00381 {
00382 for(int j=i*logicalCoresPerChip;j<i*logicalCoresPerChip+logicalCoresPerChip;j++) procFreqNew[j] = freqs[procFreqPtr[j]];
00383 }
00384 }
00385 #ifdef ORG_VERSION
00386 for(int j=i*logicalCoresPerChip;j<i*logicalCoresPerChip+logicalCoresPerChip;j++) procFreqNew[j] = freqs[0];
00387 #endif
00388 }
00389 for(int x=0;x<numProcs;x++)
00390 {
00391
00392 if(procFreq[x]!=procFreqNew[x]) thisProxy[x].changeFreq(procFreqNew[x]);
00393 }
00394 #endif
00395 }
00396
00397 void TempAwareCommLB::work(LDStats* stats) {
00399 #ifdef TEMP_LDB
00401 // initialize structures for TempLBs
00402 initStructs(stats);
00403 tempControl();
00404 populateEffectiveFreq(stats->nprocs());
00406 CkPrintf(" ================== in TempAwareCommLB::work() ===========\n");
00407 ProcArrayTemp *parr = new ProcArrayTemp(stats,procFreq,procFreqNew);
00408 parr->convertToInsts(stats);
00409 ObjGraphTemp *ogr = new ObjGraphTemp(stats,procFreq,procFreqNew);
00410 ogr->convertToInsts(stats);
00411 double avgload = parr->getAverageLoad();
00412
00413
00414 vector<bool> proc_load_info(parr->procs.size(), false);
00415
00416
00417
00418 std::vector<int>* parr_objs = new std::vector<int>[parr->procs.size()];
00419
00420 upper_threshold_temp = avgload + (avgload * THRESHOLD);
00421
00422 lower_threshold_temp = avgload;
00423
00424 int less_loaded_counter = 0;
00425
00426 srand(time(NULL));
00429 if (_lb_args.debug()>1)
00430 CkPrintf("[%d] In TempAwareCommLB strategy\n",CkMyPe());
00431
00432 CkPrintf("Average load %E\n", avgload);
00433
00434 int vert, i, j;
00435 int curr_pe;
00436
00437
00438 for(vert = 0; vert < ogr->vertices.size(); vert++) {
00439 curr_pe = ogr->vertices[vert].getCurrentPe();
00440 parr_objs[curr_pe].push_back(vert);
00441 ogr->vertices[vert].setNewPe(curr_pe);
00442 }
00443
00444 std::vector<int> parr_above_avg;
00445 std::vector<int> parr_below_avg;
00446
00447 double pe_load;
00448
00449
00450
00451
00452 for (vert = 0; vert < parr->procs.size(); vert++) {
00453 pe_load = parr->procs[vert].getTotalLoad();
00454 if (pe_load > upper_threshold_temp) {
00455
00456 parr_above_avg.push_back(vert);
00457 } else if (pe_load < lower_threshold_temp) {
00458 parr_below_avg.push_back(parr->procs[vert].getProcId());
00459 proc_load_info[parr->procs[vert].getProcId()] = true;
00460 less_loaded_counter++;
00461 }
00462 }
00463
00464 std::make_heap(parr_above_avg.begin(), parr_above_avg.end(),
00465 TempAwareCommLB::ProcLoadGreater(parr));
00466
00467 int random;
00468 int randomly_obj_id;
00469 bool obj_allocated;
00470 int num_tries;
00471
00472 int total_swaps = ogr->vertices.size() * SWAP_MULTIPLIER;
00473 int possible_pe;
00474 double obj_load;
00475
00476
00477 while (parr_above_avg.size() != 0 && total_swaps > 0 && parr_below_avg.size() != 0) {
00478
00479
00480 obj_allocated = false;
00481 num_tries = 0;
00482
00483
00484 int p_index = popFromProcHeap(parr_above_avg, parr);
00485 ProcInfo& p = parr->procs[p_index];
00486
00487 while (!obj_allocated && num_tries < parr_objs[p.getProcId()].size()) {
00488
00489
00490
00491 if (parr_objs[p.getProcId()].size() == 0) {
00492
00493 obj_allocated = true;
00494 break;
00495 }
00496
00497 int randd = rand();
00498 random = randd % parr_objs[p.getProcId()].size();
00499 randomly_obj_id = parr_objs[p.getProcId()][random];
00500
00501 obj_load = ogr->vertices[randomly_obj_id].getVertexLoad();
00502
00503
00504
00505 std::vector<int> possible_pes;
00506 getPossiblePes(possible_pes, randomly_obj_id, ogr, parr);
00507 for (i = 0; i < possible_pes.size(); i++) {
00508
00509
00510
00511 possible_pe = possible_pes[i];
00512
00513 if ((parr->procs[possible_pe].getTotalLoad() + obj_load) < upper_threshold_temp) {
00514
00515
00516
00517
00518
00519 handleTransfer(randomly_obj_id, p, possible_pe, parr_objs, ogr, parr);
00520 obj_allocated = true;
00521 total_swaps--;
00522 updateLoadInfo(p_index, possible_pe, upper_threshold_temp, lower_threshold_temp,
00523 parr_above_avg, parr_below_avg, proc_load_info, parr);
00524
00525 break;
00526 }
00527 }
00528
00529
00530
00531 if (!obj_allocated) {
00532
00533 for (int x = 0; x < parr_below_avg.size(); x++) {
00534 int random_pe = parr_below_avg[x];
00535 if ((parr->procs[random_pe].getTotalLoad() + obj_load) < upper_threshold_temp) {
00536 obj_allocated = true;
00537 total_swaps--;
00538 handleTransfer(randomly_obj_id, p, random_pe, parr_objs, ogr, parr);
00539 updateLoadInfo(p_index, random_pe, upper_threshold_temp, lower_threshold_temp,
00540 parr_above_avg, parr_below_avg, proc_load_info, parr);
00541 break;
00542 }
00543 num_tries++;
00544 }
00545 }
00546 }
00547
00548 if (!obj_allocated) {
00549
00550
00551
00552
00553 }
00554 }
00555
00556
00557
00559 ogr->convertDecisions(stats);
00560 delete parr;
00561 delete ogr;
00562 delete[] parr_objs;
00563 #else
00564 CmiAbort("TempLBs are not supported without the TEMP_LDB flag\n");
00565 #endif
00566 }
00567
00568 inline void eraseObjFromParrObjs(std::vector<int> & parr_objs, int remove_objid) {
00569 for (int i = 0; i < parr_objs.size(); i++) {
00570 if (parr_objs[i] == remove_objid) {
00571 parr_objs.erase(parr_objs.begin() + i);
00572 return;
00573 }
00574 }
00575 }
00576
00577 inline void printMapping(std::vector<Vertex> &vertices) {
00578 for (int i = 0; i < vertices.size(); i++) {
00579 CkPrintf("%d: old map : %d new map : %d\n", i, vertices[i].getCurrentPe(),
00580 vertices[i].getNewPe());
00581 }
00582 }
00583
00584 inline void removeFromArray(int pe_id, std::vector<int> &array) {
00585 for (int i = 0; i < array.size(); i++) {
00586 if (array[i] == pe_id) {
00587 array.erase(array.begin() + i);
00588 }
00589 }
00590 }
00591
00592 inline int popFromProcHeap(std::vector<int> & parr_above_avg, ProcArray *parr) {
00593 int p_index = parr_above_avg.front();
00594 std::pop_heap(parr_above_avg.begin(), parr_above_avg.end(),
00595 TempAwareCommLB::ProcLoadGreater(parr));
00596 parr_above_avg.pop_back();
00597 return p_index;
00598 }
00599
00600
00601 inline void handleTransfer(int randomly_obj_id, ProcInfo& p, int possible_pe, std::vector<int>* parr_objs, ObjGraph *ogr, ProcArray* parr) {
00602 ogr->vertices[randomly_obj_id].setNewPe(possible_pe);
00603 parr_objs[possible_pe].push_back(randomly_obj_id);
00604 ProcInfo &possible_pe_procinfo = parr->procs[possible_pe];
00605
00606 p.totalLoad() -= ogr->vertices[randomly_obj_id].getVertexLoad();
00607 possible_pe_procinfo.totalLoad() += ogr->vertices[randomly_obj_id].getVertexLoad();
00608 eraseObjFromParrObjs(parr_objs[p.getProcId()], randomly_obj_id);
00609
00610
00611 }
00612
00613 inline void updateLoadInfo(int p_index, int possible_pe, double upper_threshold_temp, double lower_threshold_temp,
00614 std::vector<int>& parr_above_avg, std::vector<int>& parr_below_avg,
00615 std::vector<bool> &proc_load_info, ProcArray *parr) {
00616
00617 ProcInfo& p = parr->procs[p_index];
00618 ProcInfo& possible_pe_procinfo = parr->procs[possible_pe];
00619
00620
00621
00622 if (p.getTotalLoad() > upper_threshold_temp) {
00623 parr_above_avg.push_back(p_index);
00624 std::push_heap(parr_above_avg.begin(), parr_above_avg.end(),
00625 TempAwareCommLB::ProcLoadGreater(parr));
00626
00627 } else if (p.getTotalLoad() < lower_threshold_temp) {
00628 parr_below_avg.push_back(p_index);
00629 proc_load_info[p_index] = true;
00630
00631 }
00632
00633
00634
00635 if (possible_pe_procinfo.getTotalLoad() > upper_threshold_temp) {
00636
00637 parr_above_avg.push_back(possible_pe);
00638 std::push_heap(parr_above_avg.begin(), parr_above_avg.end(),
00639 TempAwareCommLB::ProcLoadGreater(parr));
00640 removeFromArray(possible_pe, parr_below_avg);
00641 proc_load_info[possible_pe] = false;
00642
00643 } else if (possible_pe_procinfo.getTotalLoad() < lower_threshold_temp) {
00644 } else {
00645 removeFromArray(possible_pe, parr_below_avg);
00646 proc_load_info[possible_pe] = false;
00647
00648 }
00649
00650 }
00651
00652 inline void getPossiblePes(std::vector<int>& possible_pes, int vert,
00653 ObjGraph *ogr, ProcArray* parr) {
00654 std::map<int, int> tmp_map_pid_index;
00655 int counter = 0;
00656 int index;
00657 int i, j, nbrid;
00658 TempAwareCommLB::ObjPeCommInfo objpcomm;
00659
00660
00661
00662
00663 for (i = 0; i < ogr->vertices[vert].sendToList.size(); i++) {
00664 nbrid = ogr->vertices[vert].sendToList[i].getNeighborId();
00665 j = ogr->vertices[nbrid].getNewPe();
00666
00667 if (tmp_map_pid_index.count(j) == 0) {
00668 tmp_map_pid_index[j] = counter;
00669 TempAwareCommLB::PeCommInfo pecomminf(j);
00670
00671 objpcomm.pcomm.push_back(pecomminf);
00672 counter++;
00673 }
00674 index = tmp_map_pid_index[j];
00675
00676 objpcomm.pcomm[index].num_msg +=
00677 ogr->vertices[vert].sendToList[i].getNumMsgs();
00678 objpcomm.pcomm[index].num_bytes +=
00679 ogr->vertices[vert].sendToList[i].getNumBytes();
00680 }
00681
00682 for (i = 0; i < ogr->vertices[vert].recvFromList.size(); i++) {
00683 nbrid = ogr->vertices[vert].recvFromList[i].getNeighborId();
00684 j = ogr->vertices[nbrid].getNewPe();
00685
00686 if (tmp_map_pid_index.count(j) == 0) {
00687 tmp_map_pid_index[j] = counter;
00688 TempAwareCommLB::PeCommInfo pecomminf(j);
00689
00690 objpcomm.pcomm.push_back(pecomminf);
00691 counter++;
00692 }
00693 index = tmp_map_pid_index[j];
00694
00695 objpcomm.pcomm[index].num_msg +=
00696 ogr->vertices[vert].sendToList[i].getNumMsgs();
00697 objpcomm.pcomm[index].num_bytes +=
00698 ogr->vertices[vert].sendToList[i].getNumBytes();
00699 }
00700
00701
00702 std::sort(objpcomm.pcomm.begin(), objpcomm.pcomm.end(),
00703 TempAwareCommLB::ProcCommGreater());
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724 }
00725
00726
00727 #include "TempAwareCommLB.def.h"
00728