Skip to content

Commit 0355a23

Browse files
committed
Update benchmarks, using Gadfly now for better control over colors.
1 parent cc71d96 commit 0355a23

27 files changed

+111
-116
lines changed

benchmark/benchmarkflops.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ function matmul_bench!(br, C, A, B, i)
5858
br[8,i] = n_gflop / @belapsed iegemm!($C, $A, $B)
5959
@assert C Cblas "i-eigen gemm wrong?"; fill!(C, NaN)
6060
br[9,i] = n_gflop / @belapsed fgemm_builtin!($C, $A, $B)
61-
@assert C Cblas "Fort intrinsic gemm wrong?"; fill!(C, NaN)
61+
@assert C Cblas "Fort builtin gemm wrong?"; fill!(C, NaN)
6262
br[10,i] = n_gflop / @belapsed ifgemm_builtin!($C, $A, $B)
63-
@assert C Cblas "ifort intrinsic gemm wrong?"; fill!(C, NaN)
63+
@assert C Cblas "ifort builtin gemm wrong?"; fill!(C, NaN)
6464
br[11,i] = n_gflop / @belapsed mul!($C, $A, $B)
6565
br[12,i] = n_gflop / @belapsed dgemmmkl!($C, $A, $B)
6666
@assert C Cblas "MKL JIT gemm wrong?"; fill!(C, NaN)
@@ -107,7 +107,7 @@ blastests() = [
107107
"Julia", "Clang",
108108
"GFortran", "icc", "ifort",
109109
"g++ & Eigen-3", "icpc & Eigen-3",
110-
"GFort-intrinsic", "ifort-intrinsic",
110+
"GFortran-builtin", "ifort-builtin",
111111
BLAS.vendor() === :mkl ? "IntelMKL" : "OpenBLAS", "MKL"
112112
]
113113

benchmark/driver.jl

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ end
2121

2222
# sizes = 23:23
2323
sizes = 256:-1:2
24+
selfdot_bench = benchmark_selfdot(sizes)
2425

2526
AmulB_bench = benchmark_AmulB(sizes)
2627
AmulBt_bench = benchmark_AmulBt(sizes)
@@ -35,7 +36,6 @@ filter2d_unrolled_bench = benchmark_filter2dunrolled(sizes)#512:-1:2)
3536

3637
dot3_bench = benchmark_dot3(sizes)
3738
dot_bench = benchmark_dot(sizes)
38-
selfdot_bench = benchmark_selfdot(sizes)
3939
sse_bench = benchmark_sse(sizes)
4040
aplusBc_bench = benchmark_aplusBc(sizes)
4141
AplusAt_bench = benchmark_AplusAt(sizes)
@@ -44,26 +44,30 @@ randomaccess_bench = benchmark_random_access(sizes)
4444
logdettriangle_bench = benchmark_logdettriangle(sizes)
4545

4646
v = 1
47-
filetype = "svg"
47+
using Cairo, Fontconfig
4848
const PICTURES = joinpath(pkgdir(LoopVectorization), "docs", "src", "assets")
49-
save(joinpath(PICTURES, "bench_filter2d_dynamic_v$v.$filetype"), plot(filter2d_dynamic_bench));
50-
save(joinpath(PICTURES, "bench_filter2d_3x3_v$v.$filetype"), plot(filter2d_3x3_bench));
51-
save(joinpath(PICTURES, "bench_filter2d_unrolled_v$v.$filetype"), plot(filter2d_unrolled_bench));
52-
save(joinpath(PICTURES, "bench_dot_v$v.$filetype"), plot(dot_bench));
53-
save(joinpath(PICTURES, "bench_selfdot_v$v.$filetype"), plot(selfdot_bench));
54-
save(joinpath(PICTURES, "bench_dot3_v$v.$filetype"), plot(dot3_bench));
55-
save(joinpath(PICTURES, "bench_sse_v$v.$filetype"), plot(sse_bench));
56-
save(joinpath(PICTURES, "bench_aplusBc_v$v.$filetype"), plot(aplusBc_bench));
57-
save(joinpath(PICTURES, "bench_AplusAt_v$v.$filetype"), plot(AplusAt_bench));
58-
save(joinpath(PICTURES, "bench_exp_v$v.$filetype"), plot(vexp_bench));
59-
save(joinpath(PICTURES, "bench_random_access_v$v.$filetype"), plot(randomaccess_bench));
60-
save(joinpath(PICTURES, "bench_logdettriangle_v$v.$filetype"), plot(logdettriangle_bench));
61-
save(joinpath(PICTURES, "bench_AmulB_v$v.$filetype"), plot(AmulB_bench));
62-
save(joinpath(PICTURES, "bench_AmulBt_v$v.$filetype"), plot(AmulBt_bench));
63-
save(joinpath(PICTURES, "bench_AtmulB_v$v.$filetype"), plot(AtmulB_bench));
64-
save(joinpath(PICTURES, "bench_AtmulBt_v$v.$filetype"), plot(AtmulBt_bench));
65-
save(joinpath(PICTURES, "bench_Amulvb_v$v.$filetype"), plot(Amulvb_bench));
66-
save(joinpath(PICTURES, "bench_Atmulvb_v$v.$filetype"), plot(Atmulvb_bench));
49+
function saveplot(f, br)
50+
draw(PNG(joinpath(PICTURES, f * "$v.png"), 12inch, 8inch), plot(br))
51+
end
52+
53+
saveplot("bench_filter2d_dynamic_v", filter2d_dynamic_bench);
54+
saveplot("bench_filter2d_3x3_v", filter2d_3x3_bench);
55+
saveplot("bench_filter2d_unrolled_v", filter2d_unrolled_bench);
56+
saveplot("bench_dot_v", dot_bench);
57+
saveplot("bench_selfdot_v", selfdot_bench);
58+
saveplot("bench_dot3_v", dot3_bench);
59+
saveplot("bench_sse_v", sse_bench);
60+
saveplot("bench_aplusBc_v", aplusBc_bench);
61+
saveplot("bench_AplusAt_v", AplusAt_bench);
62+
saveplot("bench_exp_v", vexp_bench);
63+
saveplot("bench_random_access_v", randomaccess_bench);
64+
saveplot("bench_logdettriangle_v", logdettriangle_bench);
65+
saveplot("bench_AmulB_v", AmulB_bench);
66+
saveplot("bench_AmulBt_v", AmulBt_bench);
67+
saveplot("bench_AtmulB_v", AtmulB_bench);
68+
saveplot("bench_AtmulBt_v", AtmulBt_bench);
69+
saveplot("bench_Amulvb_v", Amulvb_bench);
70+
saveplot("bench_Atmulvb_v", Atmulvb_bench);
6771

6872

6973

benchmark/plotbenchmarks.jl

Lines changed: 69 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,76 @@ function Base.show(io::IO, br::BenchmarkResult)
1010
)
1111
end
1212

13-
using VegaLite, IndexedTables
14-
function plot(br::BenchmarkResult)
15-
res = vec(br.sizedresults.results)
16-
brsizes = br.sizedresults.sizes
17-
sizes = Vector{eltype(brsizes)}(undef, length(res))
18-
ntests = length(br.tests) - 1
19-
for i 0:length(brsizes)-1
20-
si = brsizes[i+1]
21-
for j 1:ntests
22-
sizes[j + i*ntests] = si
23-
end
13+
14+
using Colors, Gadfly
15+
const COLORS = distinguishable_colors(21, [RGB(1,1,1), RGB(0,0,0)])
16+
const COLOR_MAP = Dict{String,RGB{Colors.N0f8}}()
17+
function getcolor(s::String)
18+
get!(COLOR_MAP, s) do
19+
COLORS[length(COLOR_MAP) + 2]
2420
end
25-
names = ["$(i > 9 ? string(i) : "0$i"). $test" for (i,test) enumerate(@view(br.tests[2:end]))]
26-
tests = reduce(vcat, (names for _ eachindex(brsizes)))
27-
t = table((GFLOPS = res, Size = sizes, Method = tests))
28-
t |> @vlplot(
29-
:line,
30-
x = :Size,
31-
y = :GFLOPS,
32-
width = 900,
33-
height = 600,
34-
color={
35-
:Method,
36-
scale={scheme="category20"}
37-
}
21+
end
22+
23+
24+
function Gadfly.plot(br::BenchmarkResult)
25+
res = br.sizedresults.results
26+
sizes = br.sizedresults.sizes
27+
# sizes = Vector{eltype(brsizes)}(undef, length(res))
28+
tests = @view(br.tests[2:end])
29+
ntests = length(tests)
30+
colors = getcolor.(tests)
31+
32+
xt = 0:20:260
33+
maxres = maximum(res)
34+
maxtick = 10round(Int, 0.1maxres)
35+
yt = if iszero(maxtick)
36+
maxtick = 10round(0.1maxres)
37+
range(0, maxtick, length = 20)
38+
elseif maxtick < 50
39+
0:5:maxtick
40+
elseif maxtick < 20
41+
0:2:maxtick
42+
elseif maxtick < 10
43+
0:1:maxtick
44+
else
45+
0:10:maxtick
46+
end
47+
p = Gadfly.plot(
48+
Gadfly.Guide.manual_color_key("Methods", tests, colors),
49+
Guide.xlabel("Size"), Guide.ylabel("GFLOPS"),
50+
Guide.xticks(ticks=collect(xt)), Guide.yticks(ticks=collect(yt))
3851
)
52+
for i eachindex(tests)
53+
push!(p, layer(x = sizes, y = res[i,:], Geom.line, Theme(default_color=colors[i])))
54+
end
55+
p
3956
end
4057

58+
# using VegaLite, IndexedTables
59+
# function plot(br::BenchmarkResult)
60+
# res = vec(br.sizedresults.results)
61+
# brsizes = br.sizedresults.sizes
62+
# sizes = Vector{eltype(brsizes)}(undef, length(res))
63+
# ntests = length(br.tests) - 1
64+
# for i ∈ 0:length(brsizes)-1
65+
# si = brsizes[i+1]
66+
# for j ∈ 1:ntests
67+
# sizes[j + i*ntests] = si
68+
# end
69+
# end
70+
# names = ["$(i > 9 ? string(i) : "0$i"). $test" for (i,test) ∈ enumerate(@view(br.tests[2:end]))]
71+
# tests = reduce(vcat, (names for _ ∈ eachindex(brsizes)))
72+
# t = table((GFLOPS = res, Size = sizes, Method = tests))
73+
# t |> @vlplot(
74+
# :line,
75+
# x = :Size,
76+
# y = :GFLOPS,
77+
# width = 900,
78+
# height = 600,
79+
# color={
80+
# :Method,
81+
# scale={scheme="category20"}
82+
# }
83+
# )
84+
# end
85+

docs/src/assets/bench_AmulB_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_AmulBt_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_Amulvb_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_AplusAt_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_AtmulB_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_AtmulBt_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/assets/bench_Atmulvb_v1.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)