Fixing the steering model that assumes a positive slope on the appliation timesteps...
authorIsaac Dooley <idooley2@illinois.edu>
Sat, 29 May 2010 16:51:57 +0000 (11:51 -0500)
committerIsaac Dooley <idooley2@illinois.edu>
Sat, 29 May 2010 16:51:57 +0000 (11:51 -0500)
src/ck-cp/controlPoints.C

index 63aa89743dea5668d2b7267fb9455bafe86e86bb..40d6141ac92db87e3a1d40a2e087c6d310cc98d2 100644 (file)
 #include "cp_effects.h"
 #include <iostream>
 #include <math.h>
+#include <climits>
+
+#define roundDouble(x)        ((long)(x+0.5))
 
 
-#include <climits>
 //  A framework for tuning "control points" exposed by an application. Tuning decisions are based upon observed performance measurements.
  
 
@@ -1695,13 +1697,14 @@ void controlPointManager::generatePlan() {
       const double ldbStepsTime = times[0] + times[1];
       const double lbcost = ldbStepsTime - 2.0*avg; // An approximation of the 
       
-#if defined(_WIN32) && ! defined(__CYGWIN__)
-#define lround(x)        ((long)(x+0.5))
-#endif
-      int newval = lround(sqrt(2.0*lbcost/m));
-      
 
-      CkPrintf("Optimal Model: lbcost = %f, m = %f, new ldbperiod should be %d\n", lbcost, m, newval);    
+      int newval = roundDouble(sqrt(2.0*lbcost/m));
+      
+      // We don't really know what to do if m<=0, so we'll just double the period
+      if(m<=0)
+       newval = 2*numTimings;     
+      
+      CkPrintf("Optimal Model (double when negative): lbcost = %f, m = %f, new ldbperiod should be %d\n", lbcost, m, newval);    
     
     
       std::map<std::string, std::pair<int,int> >::const_iterator cpsIter;