1

At the moment I'm trying to build a COO using the CUSPARSE library. Looking at the documentation, and the function arguments, the way to create this is using the row and column indices followed by the values of each element and the matrix dimension.

using CUDA, SparseArrays

K_rows = [0, 1, 1, 2]
K_cols = [0, 0, 2, 1]
K_vals = [10.0, 20.0, 30.0, 40.0]
a = CUDA.CUSPARSE.CuSparseMatrixCOO{Float64,Int64}(
        CuArray(K_rows), CuArray(K_cols), CuArray(K_vals),
         (3,3)
)
display(a)

However, when running this code, the following error occurs:

ERROR: LoadError: BoundsError: attempt to access 4-element CuArray{Float64, 1, CUDA.DeviceMemory} at index [[4294967297, 8589934596, 1, 1]] 

Am I missing something trivial here? Julia version is at 1.11.1

2
  • Cannot run CUDA on my device, but a guess is that this may have to do with julia's 1-indexing. Have you tried to change dims from (3,3) to (4,4), or change the row and columns vectors to start at 1 (K_rows.+=1 etc.)? Commented Dec 19, 2024 at 13:54
  • 1
    I tried, neither one-based index nor increase space works Commented Dec 20, 2024 at 0:10

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.