Skip to content

Commit 1fe73ec

Browse files
author
Will Kimmerer
committed
tpose to bench
1 parent 000a873 commit 1fe73ec

File tree

2 files changed

+68
-22
lines changed

2 files changed

+68
-22
lines changed

benchmarks/benchmarks2.jl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function mxm(A::SparseMatrixCSC, B)
4747
printstyled(stdout, "\nC = A::SparseMatrixCSC($(size(A))) * B::$(typeof(B))($(size(B)))\n")
4848
result = @bench A * B
4949
println(stdout, result, "s")
50+
GC.gc()
5051
flush(stdout)
5152
return result
5253
end
@@ -65,10 +66,34 @@ function mxm(A::SuiteSparseGraphBLAS.GBArray, B::SuiteSparseGraphBLAS.GBArray; a
6566
result = @gbbench mul!(C, A, B; accum=+)
6667
end
6768
println(stdout, result, "s")
69+
GC.gc()
70+
flush(stdout)
71+
return result
72+
end
73+
74+
function tpose(A::SuiteSparseGraphBLAS.GBArray)
75+
Ao = storageorder(A) == ColMajor() ? "C" : "R"
76+
Bo = storageorder(B) == ColMajor() ? "C" : "R"
77+
printstyled(stdout, "\nC::GBArray = transpose(A::GBArray($Ao, $(size(A))))\n")
78+
result = @gbbench copy(transpose(A))
79+
println(stdout, result, "s")
80+
GC.gc()
6881
flush(stdout)
6982
return result
7083
end
7184

85+
function tpose(A::SparseMatrixCSC)
86+
printstyled(stdout, "\nC = transpose(A::SparseMatrixCSC($(size(A))))\n")
87+
result = @bench copy(transpose(A))
88+
println(stdout, result, "s")
89+
GC.gc()
90+
flush(stdout)
91+
return result
92+
end
93+
94+
function spdbench(A)
95+
end
96+
7297
function singlebench(pathornum)
7398
x = tryparse(Int64, pathornum)
7499
if x !== nothing
@@ -160,6 +185,26 @@ function singlebench(pathornum)
160185
println(stdout, "A by col (1, 2, 16 thread): $gbresultsC")
161186
println(stdout, "SparseArrays: $SAresults")
162187
flush(stdout)
188+
189+
printstyled(stdout, "\nSparse * Sparse'"; bold=true)
190+
println(stdout, "################################")
191+
flush(stdout)
192+
gbset(A, :format, SuiteSparseGraphBLAS.BYROW)
193+
diag(A)
194+
gbresultsR = runthreaded(A, transpose(A))
195+
gbset(A, :format, SuiteSparseGraphBLAS.BYCOL)
196+
diag(A)
197+
gbresultsC = runthreaded(A, transpose(A))
198+
A2 = SparseMatrixCSC(A)
199+
SAresults = mxm(A2, transpose(A2))
200+
println(stdout, )
201+
printstyled(stdout, "\nRESULTS, Sparse * Sparse: \n"; bold=true, color=:green)
202+
println(stdout, "################################")
203+
println(stdout, "A by row (1, 2, 16 thread): $gbresultsR")
204+
println(stdout, "A by col (1, 2, 16 thread): $gbresultsC")
205+
println(stdout, "SparseArrays: $SAresults")
206+
flush(stdout)
207+
163208
return nothing
164209
end
165210

benchmarks/mtx.txt

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
# You may provide paths or SuiteSparse ID numbers here.
2-
# A hashtag denotes a commented line.
3-
# /home/faculty/d/davis/Freescale2.mtx
4-
2662
5-
# /home/faculty/d/davis/indochina-2004.mtx
6-
2451
7-
# /home/faculty/d/davis/nd24k.mtx
8-
939
9-
# /home/faculty/d/davis/nd6k.mtx
10-
937
11-
# /home/faculty/d/davis/roadNet-CA.mtx
12-
2317
13-
# /raid/GAP/GAP-twitter/GAP-twitter.mtx
14-
2852
15-
# /raid/GAP/GAP-road/GAP-road.mtx
16-
2854
17-
# /raid/GAP/GAP-web/GAP-web.mtx
18-
# 2853
19-
# /raid/GAP/GAP-urand/GAP-urand.mtx
20-
# 2856
21-
# /raid/GAP/GAP-kron/GAP-kron.mtx
22-
# 2855
1+
# # You may provide paths or SuiteSparse ID numbers here.
2+
# # A hashtag denotes a commented line.
3+
# # /home/faculty/d/davis/Freescale2.mtx
4+
# 2662
5+
# # /home/faculty/d/davis/indochina-2004.mtx
6+
# 2451
7+
# # /home/faculty/d/davis/nd24k.mtx
8+
# 939
9+
# # /home/faculty/d/davis/nd6k.mtx
10+
# 937
11+
# # /home/faculty/d/davis/roadNet-CA.mtx
12+
# 2317
13+
# # /raid/GAP/GAP-twitter/GAP-twitter.mtx
14+
# 2852
15+
# # /raid/GAP/GAP-road/GAP-road.mtx
16+
# 2854
17+
# # /raid/GAP/GAP-web/GAP-web.mtx
18+
# # 2853
19+
# # /raid/GAP/GAP-urand/GAP-urand.mtx
20+
# # 2856
21+
# # /raid/GAP/GAP-kron/GAP-kron.mtx
22+
# # 2855
23+
# C:\Users\wrkim\Freescale2\Freescale2.mtx

0 commit comments

Comments
 (0)