@@ -13,45 +13,46 @@ using StorageOrders
13
13
BenchmarkTools. DEFAULT_PARAMETERS. samples = 3
14
14
BenchmarkTools. DEFAULT_PARAMETERS. evals = 1
15
15
# 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
17
17
18
18
# Comment or uncomment this line to disable or enable MKLSparse respectively.
19
19
# This will only work for SpMM and SpMV and only operates on CSC.
20
20
# using MKLSparse
21
21
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 ]
26
23
27
24
const suite = BenchmarkGroup ()
28
25
const ssmc = ssmc_db ()
29
26
30
27
function 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
33
30
show (stdout , MIME (" text/plain" ), result)
31
+ flush (stdout )
34
32
return median (result)
35
33
end
36
34
37
35
function mxm (A:: SuiteSparseGraphBLAS.GBArray , B:: SuiteSparseGraphBLAS.GBArray ; accumdenseoutput= false )
38
36
Ao = storageorder (A) == ColMajor () ? " C" : " R"
39
37
Bo = storageorder (B) == ColMajor () ? " C" : " R"
40
38
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 )
42
41
gbset (:burble , true )
43
42
mul (A, B)
44
43
gbset (:burble , false )
45
- result = @benchmark mul ($ A, $ B) samples = 3 evals = 1 seconds = 2
44
+ result = @benchmark mul ($ A, $ B)
46
45
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 " )
48
47
C = GBMatrix (zeros (eltype (A), size (A, 1 ), size (B, 2 )))
48
+ flush (stdout )
49
49
gbset (:burble , true )
50
50
mul! (C, A, B; accum= + )
51
51
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= + )
53
53
end
54
54
show (stdout , MIME (" text/plain" ), result)
55
+ flush (stdout )
55
56
return median (result)
56
57
end
57
58
@@ -67,57 +68,52 @@ function singlebench(pathornum)
67
68
end
68
69
name = basename (path)
69
70
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 )
76
76
B = rand (eltype (A), size (A, 2 ))
77
77
B = GBVector (B)
78
-
79
- printstyled (" B matrix: \n " )
80
- show (stdout , MIME (" text/plain" ), B)
81
78
82
79
gbresultsR = runthreaded (A, B; accumdenseoutput= true )
83
80
gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
84
81
diag (A)
85
82
gbresultsC = runthreaded (A, B; accumdenseoutput= true )
86
83
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 )
91
89
92
90
B = GBMatrix (rand (eltype (A), size (A, 2 ), 2 ))
93
- printstyled (" B matrix: \n " )
94
- show (stdout , MIME (" text/plain" ), B)
95
91
gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
96
92
diag (A)
97
93
gbresultsR = runthreaded (A, B; accumdenseoutput= true )
98
94
gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
99
95
diag (A)
100
96
gbresultsC = runthreaded (A, B; accumdenseoutput= true )
101
97
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 )
106
103
107
104
B = GBMatrix (rand (eltype (A), size (A, 2 ), 32 ))
108
- printstyled (" B matrix: \n " )
109
- show (stdout , MIME (" text/plain" ), B)
110
105
gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
111
106
diag (A)
112
107
gbresultsR = runthreaded (A, B; accumdenseoutput= true )
113
108
gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
114
109
diag (A)
115
110
gbresultsC = runthreaded (A, B; accumdenseoutput= true )
116
111
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 )
121
117
122
118
123
119
gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
@@ -128,19 +124,19 @@ function singlebench(pathornum)
128
124
gbresultsC = runthreaded (A, transpose (A))
129
125
A2 = SparseMatrixCSC (A)
130
126
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 )
137
133
return nothing
138
134
end
139
135
140
136
function runthreaded (A, B; accumdenseoutput= false )
141
137
v = []
142
138
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 )
144
140
gbset (:nthreads , t)
145
141
push! (v, mxm (A, B; accumdenseoutput))
146
142
end
0 commit comments