Skip to content

Commit b3851d5

Browse files
committed
Add shoc total compile time analysis
1 parent 5199911 commit b3851d5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

util/analyze/lib/compile_times.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ def sched_time(logs):
2424
_BACKUP_TIME_ELAPSED = re.compile(r'(?P<elapsed>\d+) total seconds elapsed')
2525
_PLAIDML_TIME_ELAPSED = re.compile(
2626
r'Example finished, elapsed: (?P<elapsed>\S+)s \(compile\), (?P<exec>\S+)s \(execution\)')
27+
_SHOC_TIME_ELAPSED = re.compile(r'Finished compiling; total ns = (?P<elapsed>\d+)')
28+
29+
30+
def shoc_total_compile_time_seconds(logs):
31+
try:
32+
elapsed = sum(int(m['elapsed'])
33+
for bench in logs.benchmarks
34+
for blk in bench
35+
for m in _SHOC_TIME_ELAPSED.finditer(blk.raw_log))
36+
return float(elapsed) * 1e-9
37+
except TypeError:
38+
raise KeyError('Logs must contain "Finished compiling; total ns = " output by the modified SHOC benchmark suite')
2739

2840

2941
def plaidml_total_compile_time_seconds(logs):
@@ -54,7 +66,8 @@ def total_compile_time_seconds(logs):
5466
def total_compile_time_seconds_f(benchsuite):
5567
return {
5668
'spec': total_compile_time_seconds,
57-
'plaidml': plaidml_total_compile_time_seconds
69+
'plaidml': plaidml_total_compile_time_seconds,
70+
'shoc': shoc_total_compile_time_seconds,
5871
}[benchsuite]
5972

6073

@@ -69,6 +82,7 @@ def total_compile_time_seconds_f(benchsuite):
6982
'sched': sched_time,
7083
'total': total_compile_time_seconds,
7184
'plaidml': plaidml_total_compile_time_seconds,
85+
'shoc': shoc_total_compile_time_seconds,
7286
}[args.variant]
7387
results = foreach_bench(fn, args.logs, combine=sum)
7488
writer = csv.DictWriter(sys.stdout, fieldnames=results.keys())

0 commit comments

Comments
 (0)