From ae92ea37bd4b0be7708b3ac86c757c6fcb9fda7f Mon Sep 17 00:00:00 2001 From: stecrotti Date: Tue, 17 Oct 2023 15:59:46 +0200 Subject: [PATCH] more detailed benchmark --- benchmark/benchmarks.jl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index b8131de..2ed00fe 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -1,5 +1,6 @@ using BenchmarkTools using TensorTrains +import TensorTrains: accumulate_L, accumulate_R SUITE = BenchmarkGroup() @@ -7,15 +8,26 @@ L = 10 qs = (2, 5, 3) d = 10 q = rand_tt(d, L, qs...) +p = rand_periodic_tt(d, L+1, qs...) + +SUITE["accumulators"] = BenchmarkGroup() +SUITE["accumulators"]["accumL_tensortrain"] = @benchmarkable accumulate_L($q) +# SUITE["accumulators"]["accumR_tensortrain"] = @benchmarkable accumulate_R($q) +SUITE["accumulators"]["accumL_periodic"] = @benchmarkable accumulate_L($p) +# SUITE["accumulators"]["accumR_periodic"] = @benchmarkable accumulate_R($p) SUITE["marginals"] = BenchmarkGroup() SUITE["marginals"]["marginals_tensortrain"] = @benchmarkable marginals($q) +SUITE["marginals"]["marginals_periodic"] = @benchmarkable marginals($p) SUITE["twovar_marginals"] = BenchmarkGroup() SUITE["marginals"]["twovar_marginals_tensortrain"] = @benchmarkable twovar_marginals($q) +SUITE["marginals"]["twovar_marginals_periodic"] = @benchmarkable twovar_marginals($p) SUITE["orthogonalize"] = BenchmarkGroup() -SUITE["orthogonalize"]["orth_left_tensortrain"] = @benchmarkable orthogonalize_left!($q) +svd_trunc = TruncThresh(0.0) +SUITE["orthogonalize"]["orth_left_tensortrain"] = @benchmarkable orthogonalize_left!($q; svd_trunc=$svd_trunc) +SUITE["orthogonalize"]["orth_left_periodic"] = @benchmarkable orthogonalize_left!($p; svd_trunc=$svd_trunc) SUITE["sampling"] = BenchmarkGroup() x = [[rand(1:q) for q in qs] for _ in 1:L] @@ -25,7 +37,10 @@ function nsamples!(x, q, n) end end SUITE["sampling"]["sample_tensortrain"] = @benchmarkable nsamples!($x, $q, 20) +SUITE["sampling"]["sample_periodic"] = @benchmarkable nsamples!($x, $p, 20) SUITE["dot"] = BenchmarkGroup() q2 = rand_tt(d, L, qs...) SUITE["dot"]["dot_tensortrain"] = @benchmarkable dot($q, $q2) +p2 = rand_periodic_tt(d, L, qs...) +SUITE["dot"]["dot_periodic"] = @benchmarkable dot($p, $p2) \ No newline at end of file