-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark suite for MTTKRP for order-4 tensors
- Loading branch information
1 parent
020a758
commit c31bd82
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |