/
module.py
86 lines (67 loc) · 2.33 KB
/
module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# Collective Knowledge: compiler flags crowdtuning (crowdsource autotuning via spare computers such as mobile devices)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal data)
ck=None # Will be updated by CK (initialized CK kernel)
# Local settings
import copy
##############################################################################
# Initialize module
def init(i):
"""
Input: {}
Output: {
return - return code = 0, if successful
> 0, if error
(error) - error text if return > 0
}
"""
return {'return':0}
##############################################################################
# crowdsource these experiments
def crowdsource(i):
"""
See in module "experiment.tune.compiler.flags"
"""
i['module_uoa']='experiment.tune.compiler.flags'
i['module_cfg']=copy.deepcopy(cfg)
i['module_work']=copy.deepcopy(work)
return ck.access(i)
##############################################################################
# view solutions in html
def html_viewer(i):
"""
See in module "experiment.tune.compiler.flags"
"""
i['module_uoa']='experiment.tune.compiler.flags'
i['module_cfg']=copy.deepcopy(cfg)
i['module_work']=copy.deepcopy(work)
return ck.access(i)
##############################################################################
# replay optimization
def replay(i):
"""
See in module "program.optimization"
"""
i['module_uoa']=cfg['module_deps']['program.optimization']
i['module_ref_uoa']=work['self_module_uid']
i['module_cfg']=copy.deepcopy(cfg)
i['module_work']=copy.deepcopy(work)
return ck.access(i)
##############################################################################
# prune compiler flags to find minimal set of choices
def prune(i):
"""
See in module "program.optimization"
"""
i['module_uoa']=cfg['module_deps']['program.optimization']
i['module_ref_uoa']=work['self_module_uid']
i['module_cfg']=copy.deepcopy(cfg)
i['module_work']=copy.deepcopy(work)
return ck.access(i)