This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathunibench
executable file
·120 lines (106 loc) · 3.95 KB
/
unibench
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/python
import sys, os
for root, dirs, files in os.walk("./benchmarks"):
break
benchs = {}
argBench = []
if('-mali' in sys.argv):
target = 'mali'
sys.argv.remove('-mali')
else:
target = 'x86'
if('-iomp' in sys.argv):
omplib = 'iomp'
sys.argv.remove('-iomp')
elif('-mtsp' in sys.argv):
omplib = 'mtsp'
sys.argv.remove('-mtsp')
elif('-gomp' in sys.argv):
omplib = 'gomp'
sys.argv.remove('-gomp')
else:
omplib = 'gomp'
for d in dirs:
for root2, dirs2, files2 in os.walk("./benchmarks/" + d):
break
if "common" in dirs2:
dirs2.remove("common")
dirs2.sort()
argBench += [d + "/" + k for k in dirs2]
benchs[d] = dirs2
def printUsage():
print("Usage: ./unibench <Option> <Benchmark>\n")
print("\tThe flag -mali must be used when compiling for mobile devices!\n")
print("\tOptions:\n\t- clean <all/Benchmark(Case sensitive)>\n\t- compile <all/Benchmark(Case sensitive)>\n\t- list\n\t- run <all/Benchmark(Case sensitive)>\n")
print("\tAvailable Benchmarks:")
for k in benchs:
print("\t" + k + ":")
for d in benchs[k]:
print("\t- " + k + "/" + d)
print(" ")
print("\n")
if(len(sys.argv) == 1):
printUsage()
elif(len(sys.argv) == 2):
opt1 = sys.argv[1].lower()
if(opt1 == "clean"):
print("Usage Examples:")
print("./unibench clean all - Clean all binaries, kernels and logs from all benchmarks in all suites")
print("./unibench clean Parboil - Clean all binaries, kernels and logs from all benchmarks in a specific suite")
print("./unibench clean Parboil/stencil - Clean all binaries, kernels and logs from a specific benchmark")
elif(opt1 == "help"):
printUsage()
elif(opt1 == "list"):
print("\tAvailable Benchmarks:")
for k in benchs:
print("\t" + k + ":")
for d in benchs[k]:
print("\t- " + k + "/" + d)
print(" ")
else:
printUsage()
elif(len(sys.argv) == 3):
opt1 = sys.argv[1].lower()
opt2 = sys.argv[2]
opt = opt2.split("/")
if(opt2 != "all" and (opt[0] not in benchs) and opt1 != "clean"):
print("Benchmark not found!")
print("Use \"./unibench list\" to list the available benchmarks.")
exit(0)
omp_lib="OMP_LIB=" + omplib
if(opt1 == "clean"):
if(opt2 == "all"):
os.popen("BENCH_DIR=./benchmarks/*/* make -s cleanall", 'w')
elif(len(opt) == 1 and opt2 in benchs):
os.popen("BENCH_DIR=./benchmarks/" + opt2 + "/* make -s cleanall", 'w')
elif(len(opt) == 2 and opt[0] in benchs and opt2 in argBench):
os.popen("BENCH_DIR=./benchmarks/" + opt2 + " make -s cleanall", 'w')
elif(opt1 == "compile"):
if(opt2 == "all"):
for b in argBench:
os.popen(omp_lib + " BENCH_DIR=./benchmarks/" + b + " BENCH_NAME=" + b.split('/')[1] + " make -s compile", 'w')
elif(len(opt) == 1 and opt[0] in benchs):
for b in benchs[opt[0]]:
os.popen(omp_lib + " BENCH_DIR=./benchmarks/" + opt[0] + "/" + b + " BENCH_NAME=" + b + " make -s compile", 'w')
elif(len(opt) == 2 and opt[0] in benchs and opt2 in argBench):
os.popen(omp_lib + " BENCH_DIR=./benchmarks/" + opt2 + " BENCH_NAME=" + opt2.split('/')[1] + " make -s compile", 'w')
elif(opt1 == "run"):
if(opt2 == "all"):
if(target == 'mali'):
for b in argBench:
os.popen("BENCH_DIR=./benchmarks/" + b + " BENCH_NAME=" + b.split('/')[1] + " make -s runmali", 'w')
else:
for b in argBench:
os.popen("BENCH_DIR=./benchmarks/" + b + " BENCH_NAME=" + b.split('/')[1] + " make -s run", 'w')
elif(len(opt) == 1 and opt[0] in benchs):
if(target == 'mali'):
for b in benchs[opt[0]]:
os.popen("BENCH_DIR=./benchmarks/" + opt[0] + "/" + b + " BENCH_NAME=" + b + " make -s runmali", 'w')
else:
for b in benchs[opt[0]]:
os.popen("BENCH_DIR=./benchmarks/" + opt[0] + "/" + b + " BENCH_NAME=" + b + " make -s run", 'w')
elif(len(opt) == 2 and opt[0] in benchs and opt2 in argBench):
if(target == 'mali'):
os.popen("BENCH_DIR=./benchmarks/" + opt2 + " BENCH_NAME=" + opt2.split('/')[1] + " make -s runmali", 'w')
else:
os.popen("BENCH_DIR=./benchmarks/" + opt2 + " BENCH_NAME=" + opt2.split('/')[1] + " make -s run", 'w')