diff --git a/tune/android/main.py b/tune/android/main.py index 262ad57b1..07f9e5dfd 100644 --- a/tune/android/main.py +++ b/tune/android/main.py @@ -15,6 +15,7 @@ from kivy.uix.settings import SettingsWithNoMenu import isaac as sc import json import thread +from time import sleep from tune.tune import Tuner from tune.tools import metric_name_of @@ -40,11 +41,16 @@ class LabelProgressBar: self.label = label self.metric_name = metric_name self.length = length + self.old_percent = 0 def set_prefix(self, prefix): self.prefix = prefix self.text_start = self.label.text + def set_finished(self): + self.old_percent = 0 + self.label.text += '\n' + def update(self, i, total, x, y, complete=False): percent = float(i) / total hashes = '#' * int(round(percent * self.length)) @@ -52,11 +58,12 @@ class LabelProgressBar: #Format of structures to print xformat = ','.join(map(str,map(int, x))) yformat = int(y) - percentformat = int(round(percent * 100)) - msg = (self.prefix.ljust(10) + ": [{0}] {1: >3}% [{2} " + self.metric_name + "] ({3})\n").format(hashes + spaces, percentformat, yformat, xformat) - self.label.text = self.text_start + msg - #if complete: - # self.label.text += '\n' + percent = int(round(percent * 100)) + msg = (self.prefix.ljust(10) + ": [{0}] {1: >3}% [{2} " + self.metric_name + "] ({3})").format(hashes + spaces, percent, yformat, xformat) + if percent > self.old_percent: + sleep(.01) + self.label.text = self.text_start + msg + self.old_percent = percent class IsaacScreen(Screen): @@ -112,7 +119,7 @@ class IsaacApp(App): def run(): operations = [('blas1', (sc.templates.axpy,)), - ('blas2', (sc.templates.ger, sc.templates.gemv_n, sc.templates.gemv_t)), + ('blas2', (sc.templates.gemv_n, sc.templates.gemv_t)), ('blas3', (sc.templates.gemm_nn, sc.templates.gemm_tn, sc.templates.gemm_nt, sc.templates.gemm_tt))] for opclass, optype in operations: for op in optype: diff --git a/tune/android/tune/optimize.py b/tune/android/tune/optimize.py index 42bdac1e8..409da8b75 100644 --- a/tune/android/tune/optimize.py +++ b/tune/android/tune/optimize.py @@ -13,6 +13,7 @@ from numpy import cumsum import tools from tools import profile_execution_failure +from time import sleep fetch_types = [sc.templates.fetching_policy_type.FETCH_FROM_GLOBAL_CONTIGUOUS, sc.templates.fetching_policy_type.FETCH_FROM_GLOBAL_STRIDED, diff --git a/tune/android/tune/tune.py b/tune/android/tune/tune.py index e5518ffe5..d92dd93f4 100644 --- a/tune/android/tune/tune.py +++ b/tune/android/tune/tune.py @@ -129,12 +129,13 @@ class Tuner: ##### Exploration ##### for idx, x in enumerate(sizes): - + self.progress_bar.set_prefix(', '.join(map(str, x))) #Skip if saved if x in X: row = Y[X.index(x)] - self.progress_bar.update(1, 1, profiles[argmax(row)], max(row), complete=True) + self.progress_bar.update(1, 1, profiles[argmax(row)], max(row)) + self.progress_bar.set_finished() continue #Check if the current best prediction is not a local optimum @@ -197,7 +198,8 @@ class Tuner: #print performance info in case no tuning was done if not retune: row = Y[X.index(x)] - self.progress_bar.update(1, 1, profiles[argmax(row)], max(row), complete=True) + self.progress_bar.update(1, 1, profiles[argmax(row)], max(row)) + self.progress_bar.set_finished() ##### Exportation ##### diff --git a/tune/main.py b/tune/main.py index 48f757211..ffd305334 100644 --- a/tune/main.py +++ b/tune/main.py @@ -45,6 +45,9 @@ class ProgressBar: def set_prefix(self, prefix): self.prefix = prefix + + def set_finished(self): + sys.stdout.write("\n") def update(self, i, total, x, y, complete=False): percent = float(i) / total @@ -55,8 +58,6 @@ class ProgressBar: yformat = int(y) percentformat = int(round(percent * 100)) sys.stdout.write(("\r" + self.prefix.ljust(10) + ": [{0}] {1: >3}% [{2} " + self.metric_name + "] ({3})").format(hashes + spaces, percentformat, yformat, xformat)) - if complete: - sys.stdout.write("\n") sys.stdout.flush() if __name__ == "__main__":