Modifying adaptive LB to handle case when neither refine nor greedy does good lb
authorHarshitha <gplkrsh2@illinois.edu>
Sun, 1 Apr 2012 22:55:47 +0000 (17:55 -0500)
committerHarshitha <gplkrsh2@illinois.edu>
Sun, 1 Apr 2012 22:55:47 +0000 (17:55 -0500)
src/ck-ldb/AdaptiveLB.C

index 057ea838432fd4abf3f26cefffe16934bf65c24a..ab85ed909ea9819fdcb0112f592d7558043d6fab 100644 (file)
@@ -84,9 +84,12 @@ void AdaptiveLB::work(LDStats* stats)
   CkPrintf("AdaptiveLB> Total Bytes %ld\n", totalBytes);
   CkPrintf("AdaptiveLB> Total Comm Overhead %E Total Load %E\n", commOverhead, totalLoad);
 
-  double lb_max_avg_ratio;
+  double refine_max_avg_ratio, lb_max_avg_ratio;
   int lb_type;
   GetPrevLBData(lb_type, lb_max_avg_ratio);
+  GetLBDataForLB(1, refine_max_avg_ratio);
+  double greedy_max_avg_ratio;
+  GetLBDataForLB(0, greedy_max_avg_ratio);
 
   CkPrintf("AdaptiveLB> Previous LB %d\n", lb_type);
 
@@ -100,17 +103,15 @@ void AdaptiveLB::work(LDStats* stats)
     lb_type = 2;
     CkPrintf("---METIS LB\n");
   } else {
-    if (lb_type == 1) {
-      if (lb_max_avg_ratio < 1.01) {
-        lb_type = 1;
-        refineLB->work(stats);
-        CkPrintf("---REFINE LB\n");
-      } else {
-        lb_type = 0;
-        greedyLB->work(stats);
-        CkPrintf("---GREEDY LB\n");
-      }
-    } else if (lb_type == -1) {
+    if (lb_type == -1) {
+      lb_type = 0;
+      greedyLB->work(stats);
+      CkPrintf("---GREEDY LB\n");
+    } else if (refine_max_avg_ratio <= 1.01) {
+      lb_type = 1;
+      refineLB->work(stats);
+      CkPrintf("---REFINE LB\n");
+    } else if (greedy_max_avg_ratio <= 1.01) {
       lb_type = 0;
       greedyLB->work(stats);
       CkPrintf("---GREEDY LB\n");