00001
00005
00006 #ifndef _REFINER_H_
00007 #define _REFINER_H_
00008
00009 #include "elements.h"
00010 #include "ckheap.h"
00011 #include "CentralLB.h"
00012
00013 class RefinerTemp {
00014 public:
00015 RefinerTemp(double _overload)
00016 : overLoad(_overload), P(CkNumPes()), computes(0)
00017 {
00018 processors=0;
00019 procFreq = new int[P];
00020 procFreqNew = new int[P];
00021 for (int i = 0; i < P; ++i)
00022 procFreq[i] = procFreqNew[i] = 1;
00023
00024 sumFreqs=0;
00025 }
00026
00027 RefinerTemp(double _overload,int *p,int *pn,int i);
00028 ~RefinerTemp() {}
00029 int sumFreqs,*procFreq,*procFreqNew;
00030 double totalInst;
00031 static int* AllocProcs(int count, BaseLB::LDStats* stats);
00032 static void FreeProcs(int* bufs);
00033 void Refine(int count, BaseLB::LDStats* stats, int* cur_p, int* new_p);
00034
00035 protected:
00036 void create(int count, BaseLB::LDStats* stats, int* cur_p);
00037 virtual int refine();
00038 int multirefine();
00039 void assign(computeInfo *c, int p);
00040 void assign(computeInfo *c, processorInfo *p);
00041 void deAssign(computeInfo *c, processorInfo *pRec);
00042 virtual void computeAverage();
00043 double computeMax();
00044 double computeMax(int*);
00045 bool isHeavy(processorInfo *p);
00046 bool isLight(processorInfo *p);
00047 void removeComputes();
00048
00049 double overLoad;
00050 double averageLoad;
00051 int P;
00052 int numAvail;
00053 int numComputes;
00054 computeInfo* computes;
00055 processorInfo* processors;
00056 };
00057
00058 #endif
00059
00060