From 4a4f2377b66f790afc2426fae113f0ea669813d6 Mon Sep 17 00:00:00 2001 From: Willow Ahrens Date: Tue, 21 May 2024 16:18:32 -0400 Subject: [PATCH] add benchmarks to measure improvements to #565 --- benchmark/benchmarks.jl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index dc58dd08d..be9c8c762 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -158,6 +158,23 @@ for mtx in ["SNAP/soc-Epinions1"]#, "SNAP/soc-LiveJournal1"] SUITE["indices"]["SpMV_32"][mtx] = @benchmarkable spmv32($A, $x) end +function spmv_p1(A, x) + y = Tensor(Dense(Element(0.0))) + @finch (y .= 0; for i=_, j=_; y[i] += A[j, i] * x[j] end) + return y +end + +SUITE["indices"]["SpMV_p1"] = BenchmarkGroup() +for mtx in ["SNAP/soc-Epinions1"]#, "SNAP/soc-LiveJournal1"] + A = SparseMatrixCSC(matrixdepot(mtx)) + (m, n) = size(A) + ptr = A.colptr .- 1 + idx = A.rowval .- 1 + A = Tensor(Dense(SparseList(Element(0.0, A.nzval), m, Finch.PlusOneVector(ptr), Finch.PlusOneVector(idx)), n)) + x = Tensor(Dense(Element(0.0)), rand(n)) + SUITE["indices"]["SpMV_p1"][mtx] = @benchmarkable spmv_p1($A, $x) +end + function spmv64(A, x) y = Tensor(Dense{Int64}(Element{0.0, Float64, Int64}())) @finch (y .= 0; for i=_, j=_; y[i] += A[j, i] * x[j] end)