Skip to content

Commit

Permalink
Merge branch 'wma/plusonevectorbenchmark'
Browse files Browse the repository at this point in the history
  • Loading branch information
willow-ahrens committed May 21, 2024
2 parents c6b94f5 + 4a4f237 commit ee59084
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ee59084

Please sign in to comment.