From e44fd581d309adbeb9a5e6629e4823e032c13861 Mon Sep 17 00:00:00 2001 From: David Hong Date: Mon, 6 Nov 2023 09:10:04 -0500 Subject: [PATCH] Add sweep across modes to mttkrp benchmark --- benchmark/run.jl | 31 +++++++++++++++++++++++++++++++ benchmark/suites/mttkrp.jl | 4 ++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/benchmark/run.jl b/benchmark/run.jl index 342ecfc..9f81e6d 100644 --- a/benchmark/run.jl +++ b/benchmark/run.jl @@ -121,12 +121,43 @@ if haskey(PkgBenchmark.benchmarkgroup(results), "mttkrp") """ + # Runtime vs. mode + mode_sweeps = (sortkeys ∘ group)( + ((key, _),) -> (; size = key.size, rank = key.rank), + ((key, result),) -> ("mode $(key.mode)", result), + pairs(mttkrp_dict), + ) + mode_plts = map(pairs(mode_sweeps)) do (key, sweep) + return boxplot( + getindex.(sweep, 1), + getproperty.(getindex.(sweep, 2), :times) ./ 1e6; + title = string(key)[begin+1:end-1], + xlabel = "Time (ms)", + canvas = DotCanvas, + width = 30, + height = 10, + margin = 0, + ) + end + mode_report = """ + ## Runtime vs. mode + + + $(join(["" for key in keys(mode_plts)], '\n')) + + + $(join(["" for plt in mode_plts], '\n')) + +
$(string(key)[begin+1:end-1])
\n\n```\n$(string(plt; color=false))\n```\n\n
+ """ + # Add to the report report *= "\n\n" * """ # MTTKRP benchmark plots $size_report $rank_report + $mode_report """ end diff --git a/benchmark/suites/mttkrp.jl b/benchmark/suites/mttkrp.jl index e72272c..b1cc79f 100644 --- a/benchmark/suites/mttkrp.jl +++ b/benchmark/suites/mttkrp.jl @@ -17,10 +17,10 @@ szs = [ (120, 120, 120), (200, 200, 200), ] -n = 1 +ns = 1:3 rs = 20:20:200 -for sz in szs, r in rs +for sz in szs, r in rs, n in ns Random.seed!(0) X = randn(sz) U = [randn(Ik,r) for Ik in sz]