Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SparseMatrixColorings"
uuid = "0a514795-09f3-496d-8182-132a7b665d35"
version = "0.4.27"
authors = ["Guillaume Dalle", "Alexis Montoison"]
version = "0.4.26"

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

[extensions]
SparseMatrixColoringsCUDAExt = "CUDA"
SparseMatrixColoringsCUDAExt = ["CUDA", "cuSPARSE"]
SparseMatrixColoringsCliqueTreesExt = "CliqueTrees"
SparseMatrixColoringsColorsExt = "Colors"
SparseMatrixColoringsGPUArraysExt = "GPUArrays"
SparseMatrixColoringsJuMPExt = ["JuMP", "MathOptInterface"]

[compat]
ADTypes = "1.2.1"
CUDA = "5.8.2"
CUDA = "6.0.0"
CliqueTrees = "1"
Colors = "0.12.11, 0.13"
DocStringExtensions = "0.8,0.9"
GPUArrays = "11.5.0"
JuMP = "1.29.1"
LinearAlgebra = "1"
MathOptInterface = "1.45.0"
PrecompileTools = "1.2.1"
Random = "1"
SparseArrays = "1"
cuSPARSE = "6.0.0"
julia = "1.10"
18 changes: 1 addition & 17 deletions ext/SparseMatrixColoringsCUDAExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,7 @@ module SparseMatrixColoringsCUDAExt
import SparseMatrixColorings as SMC
using SparseArrays: SparseMatrixCSC, rowvals, nnz, nzrange
using CUDA: CuVector, CuMatrix
using CUDA.CUSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR

SMC.matrix_versions(A::AbstractCuSparseMatrix) = (A,)

## Compression (slow, through CPU)

function SMC.compress(
A::AbstractCuSparseMatrix, result::SMC.AbstractColoringResult{structure,:column}
) where {structure}
return CuMatrix(SMC.compress(SparseMatrixCSC(A), result))
end

function SMC.compress(
A::AbstractCuSparseMatrix, result::SMC.AbstractColoringResult{structure,:row}
) where {structure}
return CuMatrix(SMC.compress(SparseMatrixCSC(A), result))
end
using cuSPARSE: AbstractCuSparseMatrix, CuSparseMatrixCSC, CuSparseMatrixCSR

## CSC Result

Expand Down
29 changes: 29 additions & 0 deletions ext/SparseMatrixColoringsGPUArraysExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module SparseMatrixColoringsGPUArraysExt

using GPUArrays: AbstractGPUSparseMatrix, dense_array_type
using SparseArrays: SparseMatrixCSC
import SparseMatrixColorings as SMC

SMC.matrix_versions(A::AbstractGPUSparseMatrix) = (A,)

## Compression (slow, through CPU)

function SMC.compress(
A::AbstractGPUSparseMatrix, result::SMC.AbstractColoringResult{structure,:column}
) where {structure}
A_cpu = SparseMatrixCSC(A)
B_cpu = SMC.compress(A_cpu, result)
B = dense_array_type(A)(B_cpu)
return B
end

function SMC.compress(
A::AbstractGPUSparseMatrix, result::SMC.AbstractColoringResult{structure,:row}
) where {structure}
A_cpu = SparseMatrixCSC(A)
B_cpu = SMC.compress(A_cpu, result)
B = dense_array_type(A)(B_cpu)
return B
end

end
4 changes: 1 addition & 3 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,4 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SparseMatrixColorings = "0a514795-09f3-496d-8182-132a7b665d35"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
CUDA = "=5.9.5"
cuSPARSE = "b26da814-b3bc-49ef-b0ee-c816305aa060"
4 changes: 1 addition & 3 deletions test/cuda.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using CUDA.CUSPARSE: CuSparseMatrixCSC, CuSparseMatrixCSR
using cuSPARSE: CuSparseMatrixCSC, CuSparseMatrixCSR
using LinearAlgebra
using SparseArrays
using SparseMatrixColorings
import SparseMatrixColorings as SMC
using StableRNGs
using Test

include("utils.jl")

rng = StableRNG(63)

asymmetric_params = vcat(
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include("utils.jl")
@testset verbose = true "SparseMatrixColorings" begin
if get(ENV, "JULIA_SMC_TEST_GROUP", nothing) == "GPU"
@testset "CUDA" begin
using CUDA
using CUDA, cuSPARSE
include("cuda.jl")
end
else
Expand Down
Loading