JuliaGPU/CUDA.jl

CUSPARSE: in-place copy from CuSparseCSC to SparseCSC

Open

#1 997 ouverte le 12 juil. 2023

Voir sur GitHub
 (1 commentaire) (0 réactions) (0 assignés)Julia (274 forks)batch import
cuda librariesgood first issue

Métriques du dépôt

Stars
 (1 408 stars)
Métriques de merge PR
 (Merge moyen 5j 5h) (16 PRs mergées en 30 j)

Description

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

Guide contributeur