@@ -5,88 +5,6 @@ using SparseArrays: SparseMatrixCSC, rowvals, nnz, nzrange
55using CUDA: CuVector, CuMatrix
66using cuSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR
77
8- SMC. matrix_versions (A:: AbstractCuSparseMatrix ) = (A,)
9-
10- # # Compression (slow, through CPU)
11-
12- function SMC. compress (A:: AbstractCuSparseMatrix , result:: SMC.AbstractColoringResult )
13- return CuMatrix (SMC. compress (SparseMatrixCSC (A), result))
14- end
15-
16- # # CSC Result
17-
18- function SMC. ColumnColoringResult (
19- A:: CuSparseMatrixCSC , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
20- ) where {T<: Integer }
21- group = SMC. group_by_color (T, color)
22- compressed_indices = SMC. column_csc_indices (bg, color)
23- additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
24- return SMC. ColumnColoringResult (
25- A, bg, color, group, compressed_indices, additional_info
26- )
27- end
28-
29- function SMC. RowColoringResult (
30- A:: CuSparseMatrixCSC , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
31- ) where {T<: Integer }
32- group = SMC. group_by_color (T, color)
33- compressed_indices = SMC. row_csc_indices (bg, color)
34- additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
35- return SMC. RowColoringResult (A, bg, color, group, compressed_indices, additional_info)
36- end
37-
38- function SMC. StarSetColoringResult (
39- A:: CuSparseMatrixCSC ,
40- ag:: SMC.AdjacencyGraph{T} ,
41- color:: Vector{<:Integer} ,
42- star_set:: SMC.StarSet{<:Integer} ,
43- ) where {T<: Integer }
44- group = SMC. group_by_color (T, color)
45- compressed_indices = SMC. star_csc_indices (ag, color, star_set)
46- additional_info = (; compressed_indices_gpu_csc= CuVector (compressed_indices))
47- return SMC. StarSetColoringResult (
48- A, ag, color, group, compressed_indices, additional_info
49- )
50- end
51-
52- # # CSR Result
53-
54- function SMC. ColumnColoringResult (
55- A:: CuSparseMatrixCSR , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
56- ) where {T<: Integer }
57- group = SMC. group_by_color (T, color)
58- compressed_indices = SMC. column_csc_indices (bg, color)
59- compressed_indices_csr = SMC. column_csr_indices (bg, color)
60- additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices_csr))
61- return SMC. ColumnColoringResult (
62- A, bg, color, group, compressed_indices, additional_info
63- )
64- end
65-
66- function SMC. RowColoringResult (
67- A:: CuSparseMatrixCSR , bg:: SMC.BipartiteGraph{T} , color:: Vector{<:Integer}
68- ) where {T<: Integer }
69- group = SMC. group_by_color (T, color)
70- compressed_indices = SMC. row_csc_indices (bg, color)
71- compressed_indices_csr = SMC. row_csr_indices (bg, color)
72- additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices_csr))
73- return SMC. RowColoringResult (A, bg, color, group, compressed_indices, additional_info)
74- end
75-
76- function SMC. StarSetColoringResult (
77- A:: CuSparseMatrixCSR ,
78- ag:: SMC.AdjacencyGraph{T} ,
79- color:: Vector{<:Integer} ,
80- star_set:: SMC.StarSet{<:Integer} ,
81- ) where {T<: Integer }
82- group = SMC. group_by_color (T, color)
83- compressed_indices = SMC. star_csc_indices (ag, color, star_set)
84- additional_info = (; compressed_indices_gpu_csr= CuVector (compressed_indices))
85- return SMC. StarSetColoringResult (
86- A, ag, color, group, compressed_indices, additional_info
87- )
88- end
89-
908# # Decompression
919
9210for R in (:ColumnColoringResult , :RowColoringResult )
0 commit comments