Adding settings to usedsettings when tuner hits timeout
authorHamed Gorjiara <hgorjiar@uci.edu>
Fri, 29 Mar 2019 04:10:45 +0000 (21:10 -0700)
committerHamed Gorjiara <hgorjiar@uci.edu>
Fri, 29 Mar 2019 04:10:45 +0000 (21:10 -0700)
src/Tuner/basictuner.cc
src/Tuner/searchtuner.cc
src/Tuner/searchtuner.h

index 8ec104c..7d08098 100644 (file)
@@ -182,7 +182,10 @@ long long BasicTuner::evaluate(Problem *problem, TunerRecord *tuner) {
                updateTimeout(problem, metric);
                snprintf(buffer, sizeof(buffer), "tuner%uused", execnum);
                tuner->getTuner()->addUsed(buffer);
+       } else if (status == 124 << 8){ // timeout happens ...
+               tuner->getTuner()->copySettingstoUsedSettings();
        }
+       
        //Increment execution count
        execnum++;
 
index 3cf94fb..582de74 100644 (file)
@@ -175,8 +175,7 @@ bool SearchTuner::isSubTunerof(SearchTuner *newTuner) {
 
 SearchTuner *SearchTuner::copyUsed() {
        SearchTuner *tuner = new SearchTuner();
-       
-       SetIteratorTunableSetting *iterator = !usedSettings.isEmpty()? usedSettings.iterator():settings.iterator();
+       SetIteratorTunableSetting *iterator = usedSettings.iterator();
        while (iterator->hasNext()) {
                TunableSetting *setting = iterator->next();
                TunableSetting *copy = new TunableSetting(setting);
@@ -186,6 +185,16 @@ SearchTuner *SearchTuner::copyUsed() {
        return tuner;
 }
 
+void SearchTuner::copySettingstoUsedSettings() {
+       SetIteratorTunableSetting *iterator = settings.iterator();
+       while (iterator->hasNext()) {
+               TunableSetting *setting = iterator->next();
+               TunableSetting *copy = new TunableSetting(setting);
+               usedSettings.add(copy);
+       }
+       delete iterator;
+}
+
 SearchTuner::~SearchTuner() {
        SetIteratorTunableSetting *iterator = settings.iterator();
        while (iterator->hasNext()) {
index 9d5913b..dbac07f 100644 (file)
@@ -43,6 +43,7 @@ public:
        void setVarTunable(VarType vartype, TunableParam param, TunableDesc *descriptor, uint value);
        void setVarTunable(VarType vartype1, VarType vartype2, TunableParam param, TunableDesc *descriptor, uint value);
        SearchTuner *copyUsed();
+       void copySettingstoUsedSettings();
        bool isSubTunerof(SearchTuner *newTuner);
        void randomMutate();
        uint getSize() { return usedSettings.getSize();}