Fixing bug when previous phase isn't available at startup
authorIsaac Dooley <isaacdooley@hope.cs.uiuc.edu>
Tue, 22 Dec 2009 22:02:22 +0000 (16:02 -0600)
committerIsaac Dooley <isaacdooley@hope.cs.uiuc.edu>
Tue, 22 Dec 2009 22:02:22 +0000 (16:02 -0600)
src/ck-cp/controlPoints.C

index 60b4e76a4230f01f03e6a3b954696b21f056d825..72b93df0059ac462d7a8becc8f67af75c0bcc579 100644 (file)
@@ -951,8 +951,11 @@ int valueProvidedByOptimizer(const char * name, int lb, int ub){
     static int count = 0;
     count++;
     instrumentedPhase *p = controlPointManagerProxy.ckLocalBranch()->previousPhaseData();
-    int result;
-
+    std::map<std::string, pair<int,int> > &controlPointSpace = controlPointManagerProxy.ckLocalBranch()->controlPointSpace;  
+    int minValue =  controlPointSpace[std::string(name)].first;
+    int maxValue =  controlPointSpace[std::string(name)].second;
+    int result = minValue;
     if(count > 3){
       CkPrintf("Steering strategy\n");
       CkPrintf("Steering based on previous phase =:\n");
@@ -981,9 +984,7 @@ int valueProvidedByOptimizer(const char * name, int lb, int ub){
          break;
        }
 
-       std::map<std::string, pair<int,int> > &controlPointSpace = controlPointManagerProxy.ckLocalBranch()->controlPointSpace;  
-       int minValue =  controlPointSpace[std::string(name)].first;
-       int maxValue =  controlPointSpace[std::string(name)].second;
+
        result = p->controlPoints[std::string(name)] + 1; // increase it from previous phase
 
        if(found && result <= maxValue){