
00001 00005 00006 /* 00007 A Hybrid strategy that uses 3 level tree 00008 The top level applies refinement strategy 00009 The test applies greedy strategy 00010 */ 00011 00012 #include "HybridLB.h" 00013 #include "LBDBManager.h" 00014 00015 #include "GreedyLB.h" 00016 #include "GreedyCommLB.h" 00017 #include "RefineCommLB.h" 00018 #include "RefineLB.h" 00019 #include "MetisLB.h" 00020 00021 #define DEBUGF(x) // CmiPrintf x; 00022 00023 CreateLBFunc_Def(HybridLB, "Hybrid load balancer") 00024 00025 HybridLB::HybridLB(const CkLBOptions &opt): HybridBaseLB(opt) 00026 { 00027 #if CMK_LBDB_ON 00028 lbname = (char *)"HybridLB"; 00029 00030 // defines topology in base class 00031 // tree = new ThreeLevelTree; 00032 00033 // decide which load balancer to call 00034 // IMPORTANT: currently, the greedy LB must allow objects that 00035 // are not from existing processors. 00036 refine = (CentralLB *)AllocateRefineLB(); 00037 // greedy = (CentralLB *)AllocateMetisLB(); 00038 greedy = (CentralLB *)AllocateGreedyLB(); 00039 00040 initTree(); 00041 #endif 00042 } 00043 00044 HybridLB::~HybridLB() 00045 { 00046 delete greedy; 00047 delete refine; 00048 } 00049 00050 void HybridLB::work(LDStats* stats) 00051 { 00052 #if CMK_LBDB_ON 00053 LevelData *lData = levelData[currentLevel]; 00054 00055 // TODO: let's generate LBMigrateMsg ourself 00056 // take into account the outObjs 00057 //if (currentLevel == tree->numLevels()-1) 00058 if (currentLevel == 1) 00059 greedy->work(stats); 00060 else 00061 refine->work(stats); 00062 #endif 00063 } 00064 00065 #include "HybridLB.def.h" 00066
1.5.5