@@ -13,11 +13,26 @@ function benchmark_result_type(::BenchmarkResult{T}) where {T}
13
13
return T
14
14
end
15
15
16
+ function _benchmark_result_df (sizes, libraries, mat)
17
+ df = DataFrame (Size = sizes)
18
+ for i ∈ eachindex (libraries)
19
+ setproperty! (df, libraries[i], mat[:,i])
20
+ end
21
+ return df
22
+ end
23
+ function _benchmark_result_df (br:: BenchmarkResult , s:: Symbol = :gflops )
24
+ _benchmark_result_df (br. sizes, br. libraries, getproperty (br, s))
25
+ end
26
+
27
+
16
28
"""
17
29
benchmark_result_df(benchmark_result::BenchmarkResult)
18
30
"""
19
31
function benchmark_result_df (benchmark_result:: BenchmarkResult )
20
- return deepcopy (benchmark_result. df)
32
+ df = _benchmark_result_df (benchmark_result, :times )
33
+ df = stack (df, Not (:Size ), variable_name = :Library , value_name = :Seconds )
34
+ df. GFLOPS = @. 2e-9 * matmul_length (df. Size) ./ df. Seconds
35
+ return df
21
36
end
22
37
23
38
"""
29
44
30
45
function Base. show (io:: IO , br:: BenchmarkResult{T} ) where {T}
31
46
println (io, " Bennchmark Result of Matrix{$T }, threaded = $(br. threaded) " )
32
- df = DataFrame (Sizes = br. sizes)
33
- for i ∈ eachindex (br. libraries)
34
- setproperty! (df, br. libraries[i], br. gflops[:,i])
35
- end
47
+ df = _benchmark_result_df (br)
36
48
println (io, df)
37
49
end
38
50
70
82
71
83
matmul_sizes (s:: Integer ) = (s,s,s)
72
84
matmul_sizes (mkn:: Tuple{Vararg{Integer,3}} ) = mkn
85
+ matmul_length (s) = prod (matmul_sizes (s))
73
86
74
87
junk (:: Type{T} ) where {T <: Integer } = typemax (T) >> 1
75
88
junk (:: Type{T} ) where {T} = T (NaN )
0 commit comments