Skip to content

Commit

Permalink
Split out MTTKRP benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
dahong67 committed Nov 4, 2023
1 parent 564ab03 commit 3aa8c86
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 19 deletions.
2 changes: 2 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using BenchmarkTools

BenchmarkTools.DEFAULT_PARAMETERS.seconds = 1

const SUITE = BenchmarkGroup()

module BenchmarkGCP
Expand Down
20 changes: 1 addition & 19 deletions benchmark/gcp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ using Distributions

const SUITE = BenchmarkGroup()

BenchmarkTools.DEFAULT_PARAMETERS.seconds = 1

bench_gcp = SUITE["gcp"] = BenchmarkGroup()
bench_gcp = SUITE

# Benchmark least squares loss
for sz in [(15, 20, 25), (30, 40, 50)], r in 1:2
Expand Down Expand Up @@ -42,19 +40,3 @@ for sz in [(15, 20, 25), (30, 40, 50)], r in 1:2
X = [rand(Bernoulli(M[I]/(M[I] + 1))) for I in CartesianIndices(size(M))]
bench_gcp["bernoulliOdds-size(X)=$sz, rank(X)=$r"] = @benchmarkable gcp($X, $r, BernoulliOddsLoss())
end


# MTTKRP benchmarks
bench_mttkrp = SUITE["mttkrp"] = BenchmarkGroup()

szs = [10,30,50,80,120,200]
shapes = [(sz, sz, sz) for sz in szs]
n = 1
rs = 20:20:200

for sz in shapes, r in rs
Random.seed!(0)
X = randn(sz)
U = [randn(Ik,r) for Ik in sz]
bench_mttkrp["mttkrp-size(X)=$sz, rank(X)=$r"] = @benchmarkable GCPDecompositions.mttkrp($X, $U, $n)
end
20 changes: 20 additions & 0 deletions benchmark/mttkrp.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using BenchmarkTools

using Random
using GCPDecompositions

const SUITE = BenchmarkGroup()

bench_mttkrp = SUITE

szs = [10,30,50,80,120,200]
shapes = [(sz, sz, sz) for sz in szs]
n = 1
rs = 20:20:200

for sz in shapes, r in rs
Random.seed!(0)
X = randn(sz)
U = [randn(Ik,r) for Ik in sz]
bench_mttkrp["mttkrp-size(X)=$sz, rank(X)=$r"] = @benchmarkable GCPDecompositions.mttkrp($X, $U, $n)
end

0 comments on commit 3aa8c86

Please sign in to comment.