Skip to content

Commit 009c6f8

Browse files
author
Wimmerer
committed
add method
1 parent 7f6f631 commit 009c6f8

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

benchmarks/benchmarks.jl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,50 @@ function CaccumAxB_allbyrow(S, G, nthreads, sizerhs)
206206
end
207207
end
208208

209+
function CaccumAxB_CRC(S, G, nthreads, sizerhs)
210+
printstyled("\nFull_bycol += CSR * Full_bycol\n", color=:green)
211+
GC.gc()
212+
m = rand(size(S, 2), sizerhs)
213+
m2 = GBMatrix(m)
214+
println("Size of dense matrix is $(size(m))")
215+
216+
gbset(m2, :format, :bycol)
217+
gbset(G, :format, :byrow)
218+
219+
printstyled("\nSparseMatrixCSC:\n", bold=true)
220+
A = @benchmark $S * $m
221+
show(stdout, MIME("text/plain"), A)
222+
gbset(:burble, true)
223+
C = GBMatrix(size(G, 1), size(m2, 2), 0.0)
224+
gbset(C, :sparsity_control, :full)
225+
gbset(C, :format, :bycol)
226+
227+
printstyled("\nGBMatrix:\n", bold=true)
228+
#print burble for checking
229+
gbset(:burble, false)
230+
for n nthreads
231+
printstyled("\nF += S' * F with $n threads: \n", bold=true, color=:green)
232+
gbset(:nthreads, n)
233+
gbset(:burble, true)
234+
mul!(C, G, m2; accum=+)
235+
gbset(:burble, false)
236+
B = @benchmark mul!($C, $G, $m2; accum=+)
237+
show(stdout, MIME("text/plain"), B)
238+
tratio = ratio(median(A), median(B))
239+
color = tratio.time >= 1.0 ? :green : :red
240+
printstyled("\nMedian speedup over SparseArrays using $n threads is: $(string(tratio))\n"; bold=true, color)
241+
end
242+
end
243+
209244
# OPTIONS SET 2:
210245
# run these functions for benchmarking:
211-
const functorun = [AxB_allbycol, AxB_ColxRow, CaccumAxB_allbycol, CaccumAxB_allbyrow]
246+
const functorun = [AxB_allbycol, AxB_ColxRow, CaccumAxB_allbycol, CaccumAxB_allbyrow, CaccumAxB_CRC]
212247
#= The choices are:
213248
AxB_allbycol - S * F
214249
AxB_ColxRow - S' * F
215250
CaccumAxB_allbycol - F += S * F
216251
CaccumAxB_allbyrow - F' += S' * F'
252+
CaccumAxB_CRC - F += S' * F
217253
Please open an issue or message me for further functions to add here.
218254
=#
219255

0 commit comments

Comments
 (0)