Skip to content

Commit

Permalink
Add benchmark suite for MTTKRP for order-4 tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmul1114 committed Jan 8, 2024
1 parent 020a758 commit c31bd82
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions benchmark/suites/mttkrp_large.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module BenchmarkMTTKRP

using BenchmarkTools, GCPDecompositions
using Random

const SUITE = BenchmarkGroup()

# Collect setups
const SETUPS = []

## Balanced order-4 tensors
append!(
SETUPS,
[
(; size = sz, rank = r, mode = n) for
sz in [ntuple(n -> In, 4) for In in 30:30:120], r in 30:30:180, n in 1:4
],
)

## Imbalanced order-4 tensors
append!(
SETUPS,
[
(; size = sz, rank = r, mode = n) for sz in [(30, 60, 100, 1000), (1000, 100, 60, 30)],
r in 100:100:300, n in 1:4
]
)

# Generate random benchmarks
for SETUP in SETUPS
Random.seed!(0)
X = randn(SETUP.size)
U = [randn(In, SETUP.rank) for In in SETUP.size]
SUITE["size=$(SETUP.size), rank=$(SETUP.rank), mode=$(SETUP.mode)"] = @benchmarkable(
GCPDecompositions.mttkrp($X, $U, $(SETUP.mode)),
seconds = 2,
samples = 5,
)
end

end

0 comments on commit c31bd82

Please sign in to comment.