00001
00005
00006 #ifndef _CommLB_H_
00007 #define _CommLB_H_
00008
00009 #include <CentralLB.h>
00010 #include "CommLB.decl.h"
00011
00012 #include "CommLBHeap.h"
00013 #include "GreedyCommLB.h"
00014
00015 #define CUT_OFF_FACTOR 1.200
00016
00017 void CreateCommLB();
00018
00019 struct alloc_struct{
00020 double load;
00021 int nbyte;
00022 int nmsg;
00023 };
00024
00025 class CommLB : public CBase_CommLB {
00026 public:
00027 int nobj,npe;
00028 alloc_struct ** alloc_array;
00029 graph * object_graph;
00030 CommLB(const CkLBOptions &);
00031 CommLB(CkMigrateMessage *m):CBase_CommLB(m) {}
00032 private:
00033 bool QueryBalanceNow(int step);
00034 void work(LDStats* stats);
00035 void alloc(int pe, int id, double load, int nmsg, int nbyte);
00036 double compute_cost(int id, int pe, int n_alloc, int &out_msg, int &out_byte);
00037 void add_graph(int x, int y, int data, int nmsg);
00038 };
00039
00040 #endif
00041
00042