Skip to content

Commit 5d1ae0a

Browse files
authored
chore: bump CUDA compat to v6 (cuSPARSE now a separate package) (#314)
* chore: bump CUDA compat to v6 (cuSPARSE now a separate package) * More renaming * Format * Fix compression? * Generic compression and result * Import * No generic result * Fix ambiguity
1 parent 09fc114 commit 5d1ae0a

File tree

6 files changed

+41
-27
lines changed

6 files changed

+41
-27
lines changed

Project.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SparseMatrixColorings"
22
uuid = "0a514795-09f3-496d-8182-132a7b665d35"
3+
version = "0.4.27"
34
authors = ["Guillaume Dalle", "Alexis Montoison"]
4-
version = "0.4.26"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -15,25 +15,30 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1515
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
1616
CliqueTrees = "60701a23-6482-424a-84db-faee86b9b1f8"
1717
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
18+
GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7"
1819
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
1920
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
21+
cuSPARSE = "b26da814-b3bc-49ef-b0ee-c816305aa060"
2022

2123
[extensions]
22-
SparseMatrixColoringsCUDAExt = "CUDA"
24+
SparseMatrixColoringsCUDAExt = ["CUDA", "cuSPARSE"]
2325
SparseMatrixColoringsCliqueTreesExt = "CliqueTrees"
2426
SparseMatrixColoringsColorsExt = "Colors"
27+
SparseMatrixColoringsGPUArraysExt = "GPUArrays"
2528
SparseMatrixColoringsJuMPExt = ["JuMP", "MathOptInterface"]
2629

2730
[compat]
2831
ADTypes = "1.2.1"
29-
CUDA = "5.8.2"
32+
CUDA = "6.0.0"
3033
CliqueTrees = "1"
3134
Colors = "0.12.11, 0.13"
3235
DocStringExtensions = "0.8,0.9"
36+
GPUArrays = "11.5.0"
3337
JuMP = "1.29.1"
3438
LinearAlgebra = "1"
3539
MathOptInterface = "1.45.0"
3640
PrecompileTools = "1.2.1"
3741
Random = "1"
3842
SparseArrays = "1"
43+
cuSPARSE = "6.0.0"
3944
julia = "1.10"

ext/SparseMatrixColoringsCUDAExt.jl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,7 @@ module SparseMatrixColoringsCUDAExt
33
import SparseMatrixColorings as SMC
44
using SparseArrays: SparseMatrixCSC, rowvals, nnz, nzrange
55
using CUDA: CuVector, CuMatrix
6-
using CUDA.CUSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR
7-
8-
SMC.matrix_versions(A::AbstractCuSparseMatrix) = (A,)
9-
10-
## Compression (slow, through CPU)
11-
12-
function SMC.compress(
13-
A::AbstractCuSparseMatrix, result::SMC.AbstractColoringResult{structure,:column}
14-
) where {structure}
15-
return CuMatrix(SMC.compress(SparseMatrixCSC(A), result))
16-
end
17-
18-
function SMC.compress(
19-
A::AbstractCuSparseMatrix, result::SMC.AbstractColoringResult{structure,:row}
20-
) where {structure}
21-
return CuMatrix(SMC.compress(SparseMatrixCSC(A), result))
22-
end
6+
using cuSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR
237

248
## CSC Result
259

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module SparseMatrixColoringsGPUArraysExt
2+
3+
using GPUArrays: AbstractGPUSparseMatrix, dense_array_type
4+
using SparseArrays: SparseMatrixCSC
5+
import SparseMatrixColorings as SMC
6+
7+
SMC.matrix_versions(A::AbstractGPUSparseMatrix) = (A,)
8+
9+
## Compression (slow, through CPU)
10+
11+
function SMC.compress(
12+
A::AbstractGPUSparseMatrix, result::SMC.AbstractColoringResult{structure,:column}
13+
) where {structure}
14+
A_cpu = SparseMatrixCSC(A)
15+
B_cpu = SMC.compress(A_cpu, result)
16+
B = dense_array_type(A)(B_cpu)
17+
return B
18+
end
19+
20+
function SMC.compress(
21+
A::AbstractGPUSparseMatrix, result::SMC.AbstractColoringResult{structure,:row}
22+
) where {structure}
23+
A_cpu = SparseMatrixCSC(A)
24+
B_cpu = SMC.compress(A_cpu, result)
25+
B = dense_array_type(A)(B_cpu)
26+
return B
27+
end
28+
29+
end

test/Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2323
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
2424
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
2525
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
26-
27-
[compat]
28-
CUDA = "=5.9.5"
26+
cuSPARSE = "b26da814-b3bc-49ef-b0ee-c816305aa060"

test/cuda.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
using CUDA.CUSPARSE: CuSparseMatrixCSC, CuSparseMatrixCSR
1+
using cuSPARSE: CuSparseMatrixCSC, CuSparseMatrixCSR
22
using LinearAlgebra
33
using SparseArrays
44
using SparseMatrixColorings
55
import SparseMatrixColorings as SMC
66
using StableRNGs
77
using Test
88

9-
include("utils.jl")
10-
119
rng = StableRNG(63)
1210

1311
asymmetric_params = vcat(

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ include("utils.jl")
1212
@testset verbose = true "SparseMatrixColorings" begin
1313
if get(ENV, "JULIA_SMC_TEST_GROUP", nothing) == "GPU"
1414
@testset "CUDA" begin
15-
using CUDA
15+
using CUDA, cuSPARSE
1616
include("cuda.jl")
1717
end
1818
else

0 commit comments

Comments
 (0)