@@ -13,45 +13,46 @@ using StorageOrders
1313BenchmarkTools. DEFAULT_PARAMETERS. samples = 3
1414BenchmarkTools. DEFAULT_PARAMETERS. evals = 1
1515# Total amount of time allowed for each benchmark, minimum of 1 sample taken.
16- BenchmarkTools. DEFAULT_PARAMETERS. seconds = 1000
16+ BenchmarkTools. DEFAULT_PARAMETERS. seconds = 180
1717
1818# Comment or uncomment this line to disable or enable MKLSparse respectively.
1919# This will only work for SpMM and SpMV and only operates on CSC.
2020# using MKLSparse
2121
22- # Change this to change the size of the dense RHS of csrtimesfull and csctimesfull
23- const sizefullrhs = [1 , 4 , 16 , 64 , 1024 ]
24-
25- const threadlist = [1 , Sys. CPU_THREADS ÷ 2 ]
22+ const threadlist = [1 , 16 ]
2623
2724const suite = BenchmarkGroup ()
2825const ssmc = ssmc_db ()
2926
3027function mxm (A:: SparseMatrixCSC , B)
31- printstyled (" \n C = A::SparseMatrixCSC($(size (A)) ) * B::$(typeof (B)) ($(size (B)) )\n " )
32- result = @benchmark $ A * $ B samples = 3 evals = 1 seconds = 2
28+ printstyled (stdout , " \n C = A::SparseMatrixCSC($(size (A)) ) * B::$(typeof (B)) ($(size (B)) )\n " )
29+ result = @benchmark $ A * $ B
3330 show (stdout , MIME (" text/plain" ), result)
31+ flush (stdout )
3432 return median (result)
3533end
3634
3735function mxm (A:: SuiteSparseGraphBLAS.GBArray , B:: SuiteSparseGraphBLAS.GBArray ; accumdenseoutput= false )
3836 Ao = storageorder (A) == ColMajor () ? " C" : " R"
3937 Bo = storageorder (B) == ColMajor () ? " C" : " R"
4038 if ! accumdenseoutput
41- printstyled (" \n C::GBArray = A::GBArray($Ao , $(size (A)) ) * B::GBArray($Bo , $(size (B)) )\n " )
39+ printstyled (stdout , " \n C::GBArray = A::GBArray($Ao , $(size (A)) ) * B::GBArray($Bo , $(size (B)) )\n " )
40+ flush (stdout )
4241 gbset (:burble , true )
4342 mul (A, B)
4443 gbset (:burble , false )
45- result = @benchmark mul ($ A, $ B) samples = 3 evals = 1 seconds = 2
44+ result = @benchmark mul ($ A, $ B)
4645 else
47- printstyled (" \n C::GBArray += A::GBArray($Ao , $(size (A)) ) * B::GBArray($Bo , $(size (B)) )\n " )
46+ printstyled (stdout , " \n C::GBArray += A::GBArray($Ao , $(size (A)) ) * B::GBArray($Bo , $(size (B)) )\n " )
4847 C = GBMatrix (zeros (eltype (A), size (A, 1 ), size (B, 2 )))
48+ flush (stdout )
4949 gbset (:burble , true )
5050 mul! (C, A, B; accum= + )
5151 gbset (:burble , false )
52- result = @benchmark mul! ($ C, $ A, $ B; accum= + ) samples = 3 evals = 1 seconds = 2
52+ result = @benchmark mul! ($ C, $ A, $ B; accum= + )
5353 end
5454 show (stdout , MIME (" text/plain" ), result)
55+ flush (stdout )
5556 return median (result)
5657end
5758
@@ -67,57 +68,52 @@ function singlebench(pathornum)
6768 end
6869 name = basename (path)
6970 A = SuiteSparseGraphBLAS. mmread (path)
70- printstyled (" \n #################################################################################\n " ; bold= true , color= :green )
71- printstyled (" Benchmarking $name :\n " ; bold= true , color= :green )
72- printstyled (" #################################################################################\n " ; bold= true , color= :green )
73- printstyled (" Sparse * Vec\n " ; bold= true )
74- printstyled (" A matrix: \n " )
75- show (stdout , MIME (" text/plain" ), A)
71+ printstyled (stdout , " \n #################################################################################\n " ; bold= true , color= :green )
72+ printstyled (stdout , " Benchmarking $name :\n " ; bold= true , color= :green )
73+ printstyled (stdout , " #################################################################################\n " ; bold= true , color= :green )
74+ printstyled (stdout , " Sparse * Vec\n " ; bold= true )
75+ flush (stdout )
7676 B = rand (eltype (A), size (A, 2 ))
7777 B = GBVector (B)
78-
79- printstyled (" B matrix: \n " )
80- show (stdout , MIME (" text/plain" ), B)
8178
8279 gbresultsR = runthreaded (A, B; accumdenseoutput= true )
8380 gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
8481 diag (A)
8582 gbresultsC = runthreaded (A, B; accumdenseoutput= true )
8683 SAresults = mxm (SparseMatrixCSC (A), Vector (B))
87- printstyled (" RESULTS, Sparse * DenseVec: \n " ; bold= true , color= :green )
88- println (" A by row: $gbresultsR " )
89- println (" A by col: $gbresultsC " )
90- println (" SparseArrays: $SAresults " )
84+ printstyled (stdout , " RESULTS, Sparse * DenseVec: \n " ; bold= true , color= :green )
85+ println (stdout , " A by row: $gbresultsR " )
86+ println (stdout , " A by col: $gbresultsC " )
87+ println (stdout , " SparseArrays: $SAresults " )
88+ flush (stdout )
9189
9290 B = GBMatrix (rand (eltype (A), size (A, 2 ), 2 ))
93- printstyled (" B matrix: \n " )
94- show (stdout , MIME (" text/plain" ), B)
9591 gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
9692 diag (A)
9793 gbresultsR = runthreaded (A, B; accumdenseoutput= true )
9894 gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
9995 diag (A)
10096 gbresultsC = runthreaded (A, B; accumdenseoutput= true )
10197 SAresults = mxm (SparseMatrixCSC (A), Matrix (B))
102- printstyled (" RESULTS, Sparse * n x 2 Dense: \n " ; bold= true , color= :green )
103- println (" A by row: $gbresultsR " )
104- println (" A by col: $gbresultsC " )
105- println (" SparseArrays: $SAresults " )
98+ printstyled (stdout , " RESULTS, Sparse * n x 2 Dense: \n " ; bold= true , color= :green )
99+ println (stdout , " A by row: $gbresultsR " )
100+ println (stdout , " A by col: $gbresultsC " )
101+ println (stdout , " SparseArrays: $SAresults " )
102+ flush (stdout )
106103
107104 B = GBMatrix (rand (eltype (A), size (A, 2 ), 32 ))
108- printstyled (" B matrix: \n " )
109- show (stdout , MIME (" text/plain" ), B)
110105 gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
111106 diag (A)
112107 gbresultsR = runthreaded (A, B; accumdenseoutput= true )
113108 gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
114109 diag (A)
115110 gbresultsC = runthreaded (A, B; accumdenseoutput= true )
116111 SAresults = mxm (SparseMatrixCSC (A), Matrix (B))
117- printstyled (" RESULTS, Sparse * n x 32 Dense: \n " ; bold= true , color= :green )
118- println (" A by row: $gbresultsR " )
119- println (" A by col: $gbresultsC " )
120- println (" SparseArrays: $SAresults " )
112+ printstyled (stdout , " RESULTS, Sparse * n x 32 Dense: \n " ; bold= true , color= :green )
113+ println (stdout , " A by row: $gbresultsR " )
114+ println (stdout , " A by col: $gbresultsC " )
115+ println (stdout , " SparseArrays: $SAresults " )
116+ flush (stdout )
121117
122118
123119 gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
@@ -128,19 +124,19 @@ function singlebench(pathornum)
128124 gbresultsC = runthreaded (A, transpose (A))
129125 A2 = SparseMatrixCSC (A)
130126 SAresults = mxm (A2, transpose (A2))
131- println ()
132- printstyled (" \n\n RESULTS, Sparse * Sparse: \n " ; bold= true , color= :green )
133- println (" A by row: $gbresultsR " )
134- println (" A by col: $gbresultsC " )
135- println (" SparseArrays: $SAresults " )
136- println ( )
127+ println (stdout , )
128+ printstyled (stdout , " \n\n RESULTS, Sparse * Sparse: \n " ; bold= true , color= :green )
129+ println (stdout , " A by row: $gbresultsR " )
130+ println (stdout , " A by col: $gbresultsC " )
131+ println (stdout , " SparseArrays: $SAresults " )
132+ flush ( stdout )
137133 return nothing
138134end
139135
140136function runthreaded (A, B; accumdenseoutput= false )
141137 v = []
142138 for t ∈ threadlist
143- printstyled (" \n Running GraphBLAS with $t threads\n " ; bold= true )
139+ printstyled (stdout , " \n Running GraphBLAS with $t threads\n " ; bold= true )
144140 gbset (:nthreads , t)
145141 push! (v, mxm (A, B; accumdenseoutput))
146142 end
0 commit comments