Skip to content

Conversation

amontoison
Copy link
Collaborator

@amontoison amontoison commented Jun 23, 2025

close #254
Very similar to #253.

I requested access to CI with AMD GPUs last week. I should have it but didn't find time to try it yet.
I can do that when I will back in the US.

@amontoison amontoison requested a review from gdalle June 23, 2025 07:00
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

❌ Patch coverage is 0% with 57 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.65%. Comparing base (108c7c1) to head (82fa780).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
ext/SparseMatrixColoringsAMDGPUExt.jl 0.00% 57 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (108c7c1) and HEAD (82fa780). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (108c7c1) HEAD (82fa780)
3 2
Additional details and impacted files
@@             Coverage Diff              @@
##              main     #255       +/-   ##
============================================
- Coverage   100.00%   21.65%   -78.35%     
============================================
  Files           17       16        -1     
  Lines         1939     1972       +33     
============================================
- Hits          1939      427     -1512     
- Misses           0     1545     +1545     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@amontoison
Copy link
Collaborator Author

Hum I should copy-paste the "conversion" functions that I added in CUDA.jl. I have the following errors with AMD GPUs:

(n = 100, p = 0.05): Error During Test at /home/amontoison/Argonne/SparseMatrixColorings.jl/test/rocm.jl:51
  Got exception outside of a @test
  Scalar indexing is disallowed.
  Invocation of getindex resulted in scalar indexing of a GPU array.
  This is typically caused by calling an iterating implementation of a method.
  Such implementations *do not* execute on the GPU, but very slowly on the CPU,
  and therefore should be avoided.
  
  If you want to allow scalar iteration, use `allowscalar` or `@allowscalar`
  to enable scalar iteration globally or for the operations in question.
  Stacktrace:
    [1] error(s::String)
      @ Base ./error.jl:35
    [2] errorscalar(op::String)
      @ GPUArraysCore ~/.julia/x86_64/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:151
    [3] _assertscalar(op::String, behavior::GPUArraysCore.ScalarIndexing)
      @ GPUArraysCore ~/.julia/x86_64/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:124
    [4] assertscalar(op::String)
      @ GPUArraysCore ~/.julia/x86_64/packages/GPUArraysCore/aNaXo/src/GPUArraysCore.jl:112
    [5] getindex
      @ ~/.julia/x86_64/packages/GPUArrays/uiVyU/src/host/indexing.jl:50 [inlined]
    [6] getindex(A::ROCSparseMatrixCSR{Float64, Int32}, i0::Int64, i1::Int64)
      @ AMDGPU.rocSPARSE ~/.julia/x86_64/packages/AMDGPU/wH6SV/src/sparse/array.jl:352
    [7] _getindex
      @ ./abstractarray.jl:1358 [inlined]
    [8] getindex
      @ ./abstractarray.jl:1312 [inlined]
    [9] iterate
      @ ./abstractarray.jl:1209 [inlined]
   [10] iterate
      @ ./abstractarray.jl:1207 [inlined]
   [11] SparseMatrixCSC{Float64, Int64}(M::ROCSparseMatrixCSR{Float64, Int32})
      @ SparseArrays ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/SparseArrays/src/sparsematrix.jl:891
   [12] SparseMatrixCSC
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/SparseArrays/src/sparsematrix.jl:885 [inlined]
   [13] convert
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/SparseArrays/src/sparsematrix.jl:980 [inlined]
   [14] sparse
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/SparseArrays/src/sparsematrix.jl:1016 [inlined]
   [15] matrix_versions(A::ROCSparseMatrixCSR{Float64, Int32})
      @ SparseMatrixColorings ~/.julia/x86_64/packages/SparseMatrixColorings/FZwji/src/matrices.jl:15
   [16] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1814 [inlined]
   [17] test_coloring_decompression(A0::ROCSparseMatrixCSR{Float64, Int32}, problem::ColoringProblem{:symmetric, :column}, algo::GreedyColoringAlgorithm{:direct, NaturalOrder}; B0::Nothing, color0::Nothing, test_fast::Bool, gpu::Bool)
      @ Main ~/Argonne/SparseMatrixColorings.jl/test/utils.jl:28
   [18] macro expansion
      @ ~/Argonne/SparseMatrixColorings.jl/test/rocm.jl:53 [inlined]
   [19] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [20] macro expansion
      @ ~/Argonne/SparseMatrixColorings.jl/test/rocm.jl:51 [inlined]
   [21] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [22] macro expansion
      @ ~/Argonne/SparseMatrixColorings.jl/test/rocm.jl:50 [inlined]
   [23] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [24] top-level scope
      @ ~/Argonne/SparseMatrixColorings.jl/test/rocm.jl:48
   [25] include(fname::String)
      @ Main ./sysimg.jl:38
   [26] macro expansion
      @ ~/Argonne/SparseMatrixColorings.jl/test/runtests.jl:24 [inlined]
   [27] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [28] macro expansion
      @ ~/Argonne/SparseMatrixColorings.jl/test/runtests.jl:22 [inlined]
   [29] macro expansion
      @ ~/Applications/julia/x86_64/julia-1.11.5/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [30] top-level scope
      @ ~/Argonne/SparseMatrixColorings.jl/test/runtests.jl:14
   [31] include(fname::String)
      @ Main ./sysimg.jl:38
   [32] top-level scope
      @ none:6
   [33] eval
      @ ./boot.jl:430 [inlined]
   [34] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:296
   [35] _start()
      @ Base ./client.jl:531

@gdalle
Copy link
Owner

gdalle commented Jun 30, 2025

This seems to be just in the compress function which is not performance-critical. Maybe as a first step you can do SparseMatrixCSC(Matrix(A_gpu))?

@amontoison
Copy link
Collaborator Author

I am still traveling this week but next week I can fix the issue in AMDGPU.jl.

@amontoison
Copy link
Collaborator Author

amontoison commented Aug 18, 2025

@gdalle I finally worked on it tonight.
I needed to add a dispatch SparseArrays.sparse(A::ROCSparseMatrixCSC) = A in AMDGPU.jl.
Require a new release of AMDGPU.jl with the following PR:
JuliaGPU/AMDGPU.jl#816

julia> include("test/runtests.jl")
Test Summary:         | Pass  Total   Time
SparseMatrixColorings |  422    422  10.5s
  CUDA                |           0   0.0s
  ROCm                |  422    422  10.5s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support rocSPARSE matrices
2 participants