JuliaGPU/CUDA.jl

CUSPARSE: in-place copy from CuSparseCSC to SparseCSC

Open

#1,997 建立於 2023年7月12日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)Julia (274 fork)batch import
cuda librariesgood first issue

倉庫指標

Star
 (1,408 star)
PR 合併指標
 (平均合併 5天 5小時) (30 天內合併 16 個 PR)

描述

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

貢獻者指南