JuliaGPU/CUDA.jl

CUSPARSE: in-place copy from CuSparseCSC to SparseCSC

Open

#1.997 geöffnet am 12. Juli 2023

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Julia (274 Forks)batch import
cuda librariesgood first issue

Repository-Metriken

Stars
 (1.408 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 5h) (16 gemergte PRs in 30 T)

Beschreibung

Hi guys, i am trying to use copyto! from device -> host

 P=ilu02(A_gpu);   

the type 115788×115788 CuSparseMatrixCSC{ComplexF64, Int32} with 462440 stored entries

now I will create the host sparse matrix and initialize it :

m = 115788 # number of rows
n = 115788 # number of columns
T = ComplexF64 # element type
ii = Int32 # index type
a = sparse(Vector{ii}(), Vector{ii}(), Vector{T}(), m, n)

the type of a matrix :115788×115788 SparseMatrixCSC{ComplexF64, Int32} with 0 stored entries

copyto!(a,P)

ERROR: 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 are only permitted from the REPL for prototyping purposes.
If you did intend to index this array, annotate the caller with @allowscalar.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] assertscalar(op::String)
   @ GPUArraysCore C:\Users\ahmad\.julia\packages\GPUArraysCore\uOYfN\src\GPUArraysCore.jl:103
 [3] getindex(xs::CuArray{Int32, 1, CUDA.Mem.DeviceBuffer}, I::Int64)
   @ GPUArrays C:\Users\ahmad\.julia\packages\GPUArrays\t0LfC\src\host\indexing.jl:9
 [4] getindex(A::CuSparseMatrixCSC{ComplexF64, Int32}, i0::Int64, i1::Int64)
   @ CUDA.CUSPARSE C:\Users\ahmad\.julia\packages\CUDA\pCcGc\lib\cusparse\array.jl:310
 [5] _getindex
   @ .\abstractarray.jl:1344 [inlined]
 [6] getindex
   @ .\abstractarray.jl:1294 [inlined]
 [7] copyto_unaliased!(deststyle::IndexCartesian, dest::SparseMatrixCSC{ComplexF64, Int32}, srcstyle::IndexCartesian, src::CuSparseMatrixCSC{ComplexF64, Int32})
   @ Base .\abstractarray.jl:1105
 [8] copyto!(dest::SparseMatrixCSC{ComplexF64, Int32}, src::CuSparseMatrixCSC{ComplexF64, Int32})
   @ Base .\abstractarray.jl:1071
 [9] top-level scope
   @ Untitled-2:41

Contributor Guide