@@ -24,6 +24,18 @@ def sched_time(logs):
24
24
_BACKUP_TIME_ELAPSED = re .compile (r'(?P<elapsed>\d+) total seconds elapsed' )
25
25
_PLAIDML_TIME_ELAPSED = re .compile (
26
26
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' )
27
39
28
40
29
41
def plaidml_total_compile_time_seconds (logs ):
@@ -54,7 +66,8 @@ def total_compile_time_seconds(logs):
54
66
def total_compile_time_seconds_f (benchsuite ):
55
67
return {
56
68
'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 ,
58
71
}[benchsuite ]
59
72
60
73
@@ -69,6 +82,7 @@ def total_compile_time_seconds_f(benchsuite):
69
82
'sched' : sched_time ,
70
83
'total' : total_compile_time_seconds ,
71
84
'plaidml' : plaidml_total_compile_time_seconds ,
85
+ 'shoc' : shoc_total_compile_time_seconds ,
72
86
}[args .variant ]
73
87
results = foreach_bench (fn , args .logs , combine = sum )
74
88
writer = csv .DictWriter (sys .stdout , fieldnames = results .keys ())
0 commit comments