00001
00002 #ifndef _COMMAWARELB_H_
00003 #define _COMMAWARELB_H_
00004
00005 #include "CentralLB.h"
00006 #include "TempAwareCommLB.decl.h"
00007
00008 void CreateTempAwareCommLB();
00009 BaseLB * AllocateTempAwareCommLB();
00010
00011 class TempAwareCommLB : public CBase_TempAwareCommLB {
00012 friend void printCurrentTemperature(void *LB, double curWallTime);
00013 public:
00014 struct HeapData {
00015 double load;
00016 int pe;
00017 int id;
00018
00019 };
00020 void populateEffectiveFreq(int numProcs);
00021 void convertToInsts();
00022 int procsPerNode,*freqsEffect,*procFreq,*procFreqEffect,*procFreqNewEffect,*procFreqNew,numProcs,coresPerChip,*freqs,numAvailFreqs;
00023 int numChips,*procFreqPtr;
00024 void initStructs(LDStats *s);
00025 void tempControl();
00026 FILE *migFile;
00027 double starting;
00028
00029 float *procTemp,*avgChipTemp;
00030 TempAwareCommLB(const CkLBOptions &);
00031 TempAwareCommLB(CkMigrateMessage *m):CBase_TempAwareCommLB(m) {
00032 lbname = "TempAwareCommLB";
00033 }
00034 void work(LDStats* stats);
00035
00036 class ProcLoadGreater;
00037 class ObjLoadGreater;
00038 class PeCommInfo;
00039 class ObjPeCommInfo;
00040 class ProcCommGreater;
00041
00042 private:
00043
00044 enum HeapCmp {GT = '>', LT = '<'};
00045 void Heapify(HeapData*, int, int, HeapCmp);
00046 void HeapSort(HeapData*, int, HeapCmp);
00047 void BuildHeap(HeapData*, int, HeapCmp);
00048 bool Compare(double, double, HeapCmp);
00049 HeapData* BuildCpuArray(BaseLB::LDStats*, int, int *);
00050 HeapData* BuildObjectArray(BaseLB::LDStats*, int, int *);
00051 bool QueryBalanceNow(int step);
00052 };
00053
00054 #endif
00055