-
Notifications
You must be signed in to change notification settings - Fork 0
/
timer.py
62 lines (60 loc) · 1.62 KB
/
timer.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
import sys
import subprocess
import re
template = "/Users/yscore/Sync/This/CS526/Hydride/benchmarks/{0}/halide/{1}/bin/{1}_run.out 3840 2160 /Users/yscore/Sync/This/CS526/Hydride/benchmarks/{0}/test_vectors/football3840x2160.bin /Users/yscore/Sync/This/CS526/Hydride/benchmarks/{0}/halide/{1}/out/out.bin"
folder = ["arm", "arm-disable-hydride"]
benchmarks = [
# "sobel3x3",
# "sobel5x5",
# "dilate3x3",
# "dilate5x5",
# "dilate7x7",
# "blur3x3",
# "blur5x5",
# "blur7x7",
# "median3x3",
# "gaussian3x3",
# "gaussian5x5",
# "gaussian7x7",
# "l2norm",
# "conv_nn",
# "conv3x3a16",
# "depthwise_conv",
# "matmul",
# "average_pool",
# "max_pool",
# "fully_connected",
# "add",
# "mul",
"softmax",
# "batched_matmul_256_32bit",
# "average_pool_add",
# "max_pool_add",
# "matmul_256_32bit_bias_add",
# "matmul_256_32bit_bias_add_relu",
# "matmul_256_32bit_bias_add_gelu",
# "matmul_256_32bit_bias_add_add",
# "matmul_bias_relu_matmul",
# "matmul_bias_gelu_matmul",
]
# benchmarks=["blur3x3","sobel3x3"]
benchmarks = sys.argv[1:]
result = []
for b in benchmarks:
# cmd=template.format(f,b)
cmd = "make armr."+b
if "fully_connected" in b:
cmd += " -B"
# print(b)
print(cmd)
time = []
k = subprocess.check_output(cmd.split(' '))
# print(k)
for d in k.split(b"\n"):
if b"Execution took" in d:
match = re.search(r'\d+\.\d+', str(d))
time.append(float(match.group()))
time.sort()
print(time, b)
result += [f"{time[0]},{b}"]
print("\n".join(result))