00001 00005 00006 #ifndef _GREEDYCOMMLB_H_ 00007 #define _GREEDYCOMMLB_H_ 00008 00009 #include "CentralLB.h" 00010 #include "GreedyCommLB.decl.h" 00011 #include "CommLBHeap.h" 00012 00013 #define CUT_OFF_FACTOR 1.200 00014 00015 void CreateGreedyCommLB(); 00016 BaseLB * AllocateGreedyCommLB(); 00017 00018 struct graph{ 00019 int id; 00020 int data; 00021 int nmsg; 00022 struct graph * next; 00023 }; 00024 00025 class processorInfo; 00026 00027 class GreedyCommLB : public CBase_GreedyCommLB { 00028 public: 00029 int nobj,npe, nmigobj; 00030 int * assigned_array; 00031 processorInfo* processors; 00032 graph * object_graph; 00033 GreedyCommLB(const CkLBOptions &); 00034 GreedyCommLB(CkMigrateMessage *m); 00035 void pup(PUP::er &p){ } 00036 bool QueryBalanceNow(int step); 00037 void work(LDStats* stats); 00038 00039 private: 00040 void init(); 00041 void alloc(int pe, int id, double load); 00042 double compute_com(LDStats* stats, int id,int pe); 00043 void add_graph(int x, int y, int data, int nmsg); 00044 void update(LDStats* stats, int id, int pe); 00045 00046 double alpha, beta; 00047 }; 00048 00049 #endif 00050 00051