Skip to content

Commit

Permalink
Add sweep across modes to mttkrp benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
dahong67 committed Nov 6, 2023
1 parent 64976b4 commit e44fd58
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
31 changes: 31 additions & 0 deletions benchmark/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,43 @@ if haskey(PkgBenchmark.benchmarkgroup(results), "mttkrp")
</table>
"""

# 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
<table>
<tr>
$(join(["<th>$(string(key)[begin+1:end-1])</th>" for key in keys(mode_plts)], '\n'))
</tr>
<tr>
$(join(["<td>\n\n```\n$(string(plt; color=false))\n```\n\n</td>" for plt in mode_plts], '\n'))
</tr>
</table>
"""

# Add to the report
report *= "\n\n" * """
# MTTKRP benchmark plots
$size_report
$rank_report
$mode_report
"""
end

Expand Down
4 changes: 2 additions & 2 deletions benchmark/suites/mttkrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit e44fd58

Please sign in to comment.