@@ -93,7 +93,7 @@ function tpose(A::SparseMatrixCSC)
9393 return result
9494end
9595
96- function runthreadedt (A, B ; accumdenseoutput= false )
96+ function runthreadedt (A; accumdenseoutput= false )
9797 v = []
9898 for t ∈ threadlist
9999 printstyled (stdout , " \n Running GraphBLAS with $t threads\n " ; bold= true )
@@ -103,6 +103,37 @@ function runthreadedt(A, B; accumdenseoutput=false)
103103 return v
104104end
105105
106+ function idx (C, A, I, J)
107+ if C isa SuiteSparseGraphBLAS. AbstractGBArray
108+ Ao = storageorder (A) == ColMajor () ? " C" : " R"
109+ Co = storageorder (A) == ColMajor () ? " C" : " R"
110+ printstyled (stdout , " \n C::GBArray($(Co) )[I, J] = A::GBArray($Ao , $(size (A)) )\n " )
111+ result = @gbbench begin
112+ C[I, J] = A
113+ wait (C)
114+ end
115+ println (stdout , result, " s" )
116+ GC. gc ()
117+ else
118+ printstyled (stdout , " \n C[I, J] = A::SparseMatrixCSC($(size (A)) )\n " )
119+ result = @bench C[I, J] = A
120+ println (stdou, result, " s" )
121+ GC. gc ()
122+ end
123+ flush (stdout )
124+ return result
125+ end
126+
127+ function runthreadedidx (C, A, I, J)
128+ v = []
129+ for t ∈ threadlist
130+ printstyled (stdout , " \n Running GraphBLAS with $t threads\n " ; bold= true )
131+ gbset (:nthreads , t)
132+ push! (v, idx (C, A, I, J))
133+ end
134+ return v
135+ end
136+
106137function singlebench (pathornum)
107138 x = tryparse (Int64, pathornum)
108139 if x != = nothing
@@ -114,14 +145,14 @@ function singlebench(pathornum)
114145 throw (ErrorException (" Argument is not a path or SuiteSparseMatrixCollection ID number" ))
115146 end
116147 name = basename (path)
117- A = SuiteSparseGraphBLAS. mmread (path)
118- if eltype (A) == Bool
119- A = Int64 .(A)
120- end
121- GC. gc ()
122- printstyled (stdout , " \n #################################################################################\n " ; bold= true , color= :green )
123- printstyled (stdout , " Benchmarking $name :\n " ; bold= true , color= :green )
124- printstyled (stdout , " #################################################################################\n " ; bold= true , color= :green )
148+ # A = SuiteSparseGraphBLAS.mmread(path)
149+ # if eltype(A) == Bool
150+ # A = Int64.(A)
151+ # end
152+ # GC.gc()
153+ # printstyled(stdout, "\n#################################################################################\n"; bold=true, color=:green)
154+ # printstyled(stdout, "Benchmarking $name:\n"; bold=true, color=:green)
155+ # printstyled(stdout, "#################################################################################\n"; bold=true, color=:green)
125156
126157 # printstyled(stdout, "\nSparse * Vec\n"; bold=true)
127158 # println(stdout, "################################")
@@ -214,14 +245,41 @@ function singlebench(pathornum)
214245 # println(stdout, "A by col (1, 2, 16 thread): $gbresultsC")
215246 # println(stdout, "SparseArrays: $SAresults")
216247 # flush(stdout)
217- printstyled (stdout , " \n C = copy(transpose(A))" ; bold= true )
248+ # printstyled(stdout, "\nC = copy(transpose(A))"; bold=true)
249+ # println(stdout, "################################")
250+ # flush(stdout)
251+ # gbset(A, :format, SuiteSparseGraphBLAS.BYROW)
252+ # diag(A)
253+ # gbresultsR = runthreadedt(A)
254+ # gbset(A, :format, SuiteSparseGraphBLAS.BYCOL)
255+ # diag(A)
256+ # gbresultsC = runthreadedt(A)
257+ # A2 = SparseMatrixCSC(A)
258+ # SAresults = tpose(A2)
259+ # println(stdout, )
260+ # printstyled(stdout, "\nRESULTS, C = copy(transpose(A)): \n"; bold=true, color=:green)
261+ # println(stdout, "################################")
262+ # println(stdout, "A by row (1, 2, 16 thread): $gbresultsR")
263+ # println(stdout, "A by col (1, 2, 16 thread): $gbresultsC")
264+ # println(stdout, "SparseArrays: $SAresults")
265+ # flush(stdout)
266+
267+
268+ printstyled (stdout , " \n C[I, J] = A)" ; bold= true )
218269 println (stdout , " ################################" )
270+ C = SuiteSparseGraphBLAS. wait (SuiteSparseGraphBLAS. gbrand (Float64, 25_000_000 , 25_000_000 , 5.76e-8 ))
271+ A = SuiteSparseGraphBLAS. wait (SuiteSparseGraphBLAS. gbrand (Float64, 5_000 , 5_000 , 0.002 ))
272+ I = rand (1 : size (C, 1 ), size (A, 1 ))
273+ J = rand (1 : size (C, 2 ), size (A, 2 ))
274+
219275 flush (stdout )
220276 gbset (A, :format , SuiteSparseGraphBLAS. BYROW)
221- diag (A)
277+ gbset (C, :format , SuiteSparseGraphBLAS. BYROW)
278+ SuiteSparseGraphBLAS. wait (A)
222279 gbresultsR = runthreadedt (A, transpose (A))
223280 gbset (A, :format , SuiteSparseGraphBLAS. BYCOL)
224- diag (A)
281+ gbset (C, :format , SuiteSparseGraphBLAS. BYCOL)
282+ SuiteSparseGraphBLAS. wait (A)
225283 gbresultsC = runthreadedt (A, transpose (A))
226284 A2 = SparseMatrixCSC (A)
227285 SAresults = tpose (A2)
0 commit comments