Tuning: Android UI improvement
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from os.path import dirname, realpath, join
|
||||
|
||||
from kivy.logger import Logger
|
||||
from kivy.uix.scrollview import ScrollView
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.uix.label import Label
|
||||
from kivy.uix.checkbox import CheckBox
|
||||
@@ -12,11 +14,23 @@ from kivy.uix.settings import SettingsWithNoMenu
|
||||
|
||||
import isaac as sc
|
||||
import json
|
||||
import thread
|
||||
|
||||
from tune.tune import do_tuning
|
||||
from tune.tune import Tuner
|
||||
|
||||
__version__ = '1.0'
|
||||
|
||||
class ScrollableLabel(ScrollView):
|
||||
text = StringProperty('')
|
||||
|
||||
class LabelLogger:
|
||||
def __init__(self, label):
|
||||
self.label = label;
|
||||
|
||||
def info(self, msg):
|
||||
self.label.text += msg + '\n'
|
||||
|
||||
|
||||
class IsaacScreen(Screen):
|
||||
fullscreen = BooleanProperty(False)
|
||||
|
||||
@@ -54,16 +68,24 @@ class IsaacApp(App):
|
||||
|
||||
#Default view
|
||||
self.show_tune()
|
||||
|
||||
#Logger
|
||||
self.logger = LabelLogger(self.screens['Tune'].ids.out)
|
||||
|
||||
def start_tuning(self):
|
||||
#FIXME: will be buggy if two devices from two different platforms have the same name
|
||||
device = next(x for x in self.isaac_handler.devices if x.name==self.config.get('hardware', 'device'))
|
||||
operation = sc.templates.axpy
|
||||
json_path = ''
|
||||
#FIXME: Move profiling logics into tuning
|
||||
sc.driver.default.queue_properties = sc.driver.PROFILING_ENABLE
|
||||
print device.infos
|
||||
do_tuning(device, operation, json_path)
|
||||
button = self.screens['Tune'].ids.action_button
|
||||
if button.text == 'Run':
|
||||
#FIXME: will be buggy if two devices from two different platforms have the same name
|
||||
device = next(x for x in self.isaac_handler.devices if x.name==self.config.get('hardware', 'device'))
|
||||
#FIXME: Move profiling logics into tuning
|
||||
sc.driver.default.queue_properties = sc.driver.PROFILING_ENABLE
|
||||
self.logger.info('Using ' + device.name)
|
||||
self.logger.info('')
|
||||
tuner = Tuner(self.logger, device, sc.templates.axpy, '')
|
||||
tid = thread.start_new_thread(Tuner.run, (tuner,))
|
||||
else:
|
||||
pass
|
||||
button.text = 'Running...' if button.text == 'Run' else button.text
|
||||
|
||||
def show_benchmark(self):
|
||||
pass
|
||||
@@ -77,7 +99,8 @@ class IsaacApp(App):
|
||||
if 'Settings' not in self.screens:
|
||||
self.screens['Settings'] = Screen(name='Settings')
|
||||
self.screens['Settings'].add_widget(settings)
|
||||
self.root.ids.sm.switch_to(self.screens['Settings'], direction='left')
|
||||
if self.root.ids.sm.current != 'Settings':
|
||||
self.root.ids.sm.switch_to(self.screens['Settings'], direction='left')
|
||||
|
||||
def build_config(self, config):
|
||||
self.isaac_handler = IsaacHandler()
|
||||
@@ -104,10 +127,10 @@ class IsaacApp(App):
|
||||
'key': operation.lower(),
|
||||
'options': ['Simple', 'Intermediate', 'Full']}]
|
||||
|
||||
settings.add_json_panel('Settings',
|
||||
settings.add_json_panel('ISAAC',
|
||||
self.config,
|
||||
data=json.dumps(layout))
|
||||
|
||||
|
||||
def close_settings(self, *args):
|
||||
pass
|
||||
|
||||
|
Reference in New Issue
Block a user