-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_poly.py
More file actions
93 lines (83 loc) · 3.69 KB
/
Copy pathmain_poly.py
File metadata and controls
93 lines (83 loc) · 3.69 KB
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
87
88
89
90
91
92
93
from Dataset.process.heads import PolyBench
from Engine.baseline_tuners import RandomTuner
from Engine.satuner import SATuner
from Engine.grouptuner import GroupTuner
from Engine.bocatuner import BOCATuner
from Engine.srtuner import SRTuner
from Engine.cfsca import CFSCATuner
from Space.search_space import Default_Space,Group_Space
import argparse
import os
import csv
module_path = os.path.abspath(__file__)
MODULE_DIR = os.path.dirname(module_path)
parser = argparse.ArgumentParser()
parser.add_argument("--gcc-path", type=str, default='gcc')
parser.add_argument("--round", type=str, default=500)
args = parser.parse_args()
bin_path=args.gcc_path
round=int(args.round)
if __name__ == '__main__':
prog=[]
with open(f'{MODULE_DIR}/Dataset/dataset/poly_prog_info.csv','r') as f:
f_csv=csv.reader(f)
for row in f_csv:
prog.append(row[1])
test_cases=['linear-algebra/solvers/cholesky','medley/floyd-warshall',
'linear-algebra/blas/gemm']
for p in test_cases:
print(p)
print(f'{p} GroupTuner:')
space=Group_Space('opts_group.txt')
evaluator=PolyBench(p,f'test','GroupTuner',bin_path)
tuner=GroupTuner(search_space=space,evaluator=evaluator,name='GroupTuner')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')
print(f'{p} SA:')
space=Default_Space()
evaluator=PolyBench(p,f'test','SA',bin_path)
tuner=SATuner(search_space=space,evaluator=evaluator,name='SA')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')
print(f'{p} SRTuner:')
space=Default_Space()
evaluator=PolyBench(p,'test','SRTuner',bin_path)
tuner=SRTuner(search_space=space,evaluator=evaluator,name='SRTuner')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')
print(f'{p} BOCA:')
space=Default_Space()
evaluator=PolyBench(p,'test','BOCA',bin_path)
tuner=BOCATuner(search_space=space,evaluator=evaluator,name='BOCA')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')
print(f'{p} RIO:')
space=Default_Space()
evaluator=PolyBench(p,'test','RIO',bin_path)
tuner=RandomTuner(search_space=space,evaluator=evaluator,name='RIO')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')
print(f'{p} CFSCA:')
space=Default_Space()
evaluator=PolyBench(p,'test','CFSCA',bin_path)
tuner=CFSCATuner(search_space=space,evaluator=evaluator,name='CFSCA')
tuner.tune(round)
best_time,best_seq=tuner.get_best_result()
print(f'Tunning finished, best time: {best_time:.3f}s')
print(f'Best sequence: {best_seq}')
print(f'The detaild tuning process is saved in {evaluator.db_path}')