Bug fix: consider the cases when the tuner gets timeout
authorHamed Gorjiara <hgorjiar@uci.edu>
Fri, 22 Nov 2019 02:51:04 +0000 (18:51 -0800)
committerHamed Gorjiara <hgorjiar@uci.edu>
Fri, 22 Nov 2019 02:51:04 +0000 (18:51 -0800)
src/Tuner/basictuner.cc
src/Tuner/comptuner.cc

index 30d729b2cb2c12d0a7842e78b4db45505fc0a6a5..f3a00ea460aa1d78dd627805782993b73aa9bffd 100644 (file)
@@ -179,7 +179,9 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
                        myfile >> sat;
                        myfile.close();
                }
-               updateTimeout(problem, metric);
+               if(sat != IS_INDETER){
+                       updateTimeout(problem, metric);
+               }
                snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
                tuner->getTuner()->addUsed(buffer);
        } else if (status == 124 << 8) {// timeout happens ...
@@ -192,7 +194,8 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
        if (problem->getResult() == TUNERUNSETVALUE && sat != IS_INDETER) {
                problem->setResult( sat );
        } else if (problem->getResult() != sat && sat != IS_INDETER) {
-               model_print("******** Result has changed ********\n");
+               model_print("******** Result has changed ******** Found a bug!!\n");
+               ASSERT(0)
        }
        if (sat == IS_INDETER && metric != -1) {//The case when we have a timeout
                metric = -1;
index d630f2d2280d77fc09b259275901710a46c614d2..b8b574c9170e24e6e97328a2fad8ebd2d35bd854 100644 (file)
@@ -31,11 +31,11 @@ void CompTuner::findBestTwoTuners() {
                        for (uint l = 0; l < problems.getSize(); l++) {
                                Problem *problem = problems.get(l);
                                long long time1 = tuner1->getTime(problem);
-                               if(time1 == -1){
+                               if(time1 == -1 || time2 == -2){
                                        time1=LLONG_MAX;
                                }
                                long long time2 = tuner2->getTime(problem);
-                               if(time2 == -1){
+                               if(time2 == -1 || time2 == -2){
                                        time2 = LLONG_MAX;
                                }
                                mintimes[l] = pow(min(time1,time2), (double)1 / problems.getSize());