Fixing merge
authorHarshitha <gplkrsh2@illinois.edu>
Fri, 4 May 2012 21:13:36 +0000 (16:13 -0500)
committerHarshitha <gplkrsh2@illinois.edu>
Fri, 4 May 2012 21:13:36 +0000 (16:13 -0500)
1  2 
src/ck-ldb/LBDatabase.C

index 776ecd452bd67bcdd115f1e138c2fc33b3419f96,8e752ad6e968cc68842c17dd494dd6d80b18b62f..571a8af73b72e1dad45f9207e8f3985ed5988b5f
@@@ -833,13 -871,20 +833,14 @@@ bool LBDatabase::generatePlan(int& peri
      data = adaptive_lbdb.history_data[i];
      max += data.max_load;
      avg += data.avg_load;
-     DEBAD(("max (%d, %lf) avg (%d, %lf)\n", i, data.max_load, i, data.avg_load));
+     //DEBAD(("max (%d, %lf) avg (%d, %lf)\n", i, data.max_load, i, data.avg_load));
+     CkPrintf("max (%d, %lf) avg (%d, %lf)\n", i, data.max_load, i, data.avg_load);
    }
 -//  max /= (adaptive_struct.lb_no_iterations - adaptive_lbdb.history_data[0].iteration);
 -//  avg /= (adaptive_struct.lb_no_iterations - adaptive_lbdb.history_data[0].iteration);
 -//
 -//  adaptive_struct.tentative_period = (adaptive_struct.lb_strategy_cost +
 -//  adaptive_struct.lb_migration_cost) / (max - avg);
 -//  CkPrintf("max : %lf, avg: %lf, strat cost: %lf, migration_cost: %lf, idealperiod : %d \n",
 -//      max, avg, adaptive_struct.lb_strategy_cost, adaptive_struct.lb_migration_cost, adaptive_struct.tentative_period);
 -//
 +//  max /= (adaptive_struct.lb_iteration_no - adaptive_lbdb.history_data[0].iteration);
 +//  avg /= (adaptive_struct.lb_iteration_no - adaptive_lbdb.history_data[0].iteration);
  
    // If linearly varying load, then find lb_period
 -  // area between the max and avg curve 
 +  // area between the max and avg curve
    // If we can attain perfect balance, then the new load is close to the
    // average. Hence we pass 1, else pass in some other value which would be the
    // new max_load after load balancing.
      CkPrintf("Resorting to imb = 1.0 coz max/avg (%lf) < imb(%lf)\n", max/avg, tolerate_imb);
      tolerate_imb = 1.0;
    }
-   CkPrintf("Will generate plan for greedy %lf imb and %lf overhead\n", tolerate_imb, 0.2);
 -  return getPeriodForStrategy(tolerate_imb, 1, period, ratio_at_t);*/
 -  int tmp1;                                                                                                          
 -  double tmp2, tmp3, tolerate_imb;
 -//  GetLBDataForLB(1, tmp2, tmp3);                                                                                     
 -//  tolerate_imb = tmp2;                                                                                        
 -//                                                                                                                     
 -//  if (tmp2 <= 1.01) {                                                                                                
 -//    if (max/avg < tolerate_imb) {                                                                                    
 -//      CkPrintf("Resorting to imb = 1.0 coz max/avg (%lf) < imb(%lf)\n", max/avg, tolerate_imb);                      
 -//      tolerate_imb = 1.0;                                                                                            
 -//    }                                                                                                                
 -//    CkPrintf("Will generate plan for refine %lf imb and %lf overhead\n", tolerate_imb, 0.2);                         
 -//    return getPeriodForStrategy(tolerate_imb, 0.2, period, ratio_at_t);                                                     
 -//  }
 -  
 -  GetLBDataForLB(0, tmp2, tmp3);                                                                                   
 -  tolerate_imb = tmp2;
 -  if (max/avg < tolerate_imb) {                                                                                    
 -    CkPrintf("Resorting to imb = 1.0 coz max/avg (%lf) < imb(%lf)\n", max/avg, tolerate_imb);                      
 -    tolerate_imb = 1.0;                                                                                            
 -  }                                                                                                                
 -  CkPrintf("Will generate plan for greedy %lf imb and %lf overhead\n", tolerate_imb, 1.0);
 -  return getPeriodForStrategy(tolerate_imb, 1, period, ratio_at_t);                                                       
 -
 -//  int refine_period, scratch_period;
 -//  bool obtained_refine, obtained_scratch;
 -//  obtained_refine = getPeriodForStrategy(1, 1, refine_period);
 -//  obtained_scratch = getPeriodForStrategy(1, 1, scratch_period);
 -//
 -//  if (obtained_refine) {
 -//    if (!obtained_scratch) {
 -//      period = refine_period;
 -//      adaptive_struct.isRefine = true;
 -//      return true;
 -//    }
 -//    if (scratch_period < 1.1*refine_period) {
 -//      adaptive_struct.isRefine = false;
 -//      period = scratch_period;
 -//      return true;
 -//    }
 -//    period = refine_period;
 -//    adaptive_struct.isRefine = true;
 -//    return true;
 -//  }
 -//
 -//  if (obtained_scratch) {
 -//    period = scratch_period;
 -//    adaptive_struct.isRefine = false;
 -//    return true;
 -//  }
 -//  return false;
 +  return getPeriodForStrategy(tolerate_imb, 1, period, ratio_at_t);
  }
  
  bool LBDatabase::getPeriodForStrategy(double new_load_percent,