Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CuSparse does not support broadcast #1317

Closed
ChrisRackauckas opened this issue Jan 11, 2022 · 2 comments
Closed

CuSparse does not support broadcast #1317

ChrisRackauckas opened this issue Jan 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@ChrisRackauckas
Copy link
Member

using CUDA
CUDA.allowscalar(false)
A = cu(sprand(100,100,0.1))
A .+ 2
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.
error(s::String) at error.jl:33
assertscalar(op::String) at indexing.jl:53
getindex(xs::CuArray{Int32, 1, CUDA.Mem.DeviceBuffer}, I::Int64) at indexing.jl:86
getindex(A::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, i0::Int64, i1::Int64) at array.jl:292
_getindex at abstractarray.jl:1262 [inlined]
getindex at abstractarray.jl:1218 [inlined]
_broadcast_getindex at broadcast.jl:636 [inlined]
_getindex at broadcast.jl:666 [inlined]
_broadcast_getindex at broadcast.jl:642 [inlined]
getindex at broadcast.jl:597 [inlined]
macro expansion at broadcast.jl:961 [inlined]
macro expansion at simdloop.jl:77 [inlined]
copyto! at broadcast.jl:960 [inlined]
copyto! at broadcast.jl:913 [inlined]
copy at broadcast.jl:885 [inlined]
materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2}, Nothing, typeof(+), Tuple{CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, Int64}}) at broadcast.jl:860
top-level scope at test.jl:130
eval at boot.jl:373 [inlined]
@ChrisRackauckas ChrisRackauckas added the bug Something isn't working label Jan 11, 2022
@ChrisRackauckas
Copy link
Member Author

Similarly fill! doesn't work:

using CUDA
CUDA.allowscalar(false)
A = cu(sprand(100,100,0.1))
fill!(A,true)
setindex! not defined for CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}
error(::String, ::Type) at error.jl:42
error_if_canonical_setindex(::IndexCartesian, ::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, ::Int64, ::Int64) at abstractarray.jl:1325
setindex! at abstractarray.jl:1314 [inlined]
_setindex! at abstractarray.jl:1345 [inlined]
setindex! at abstractarray.jl:1315 [inlined]
fill!(A::CUDA.CUSPARSE.CuSparseMatrixCSC{Float32, Int32}, x::Bool) at multidimensional.jl:1064
top-level scope at test.jl:120
eval at boot.jl:373 [inlined]

@maleadt
Copy link
Member

maleadt commented Jan 14, 2022

Dup of #829. I'll have a look at this later this month.

@maleadt maleadt closed this as completed Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants