Skip to content

Broadcast of sparse vectors #2209

@ChrisRackauckas

Description

@ChrisRackauckas

Describe the bug

Some cases of appropriate sparse matrix broadcasts error on CUDA sparse matrices

To reproduce

The Minimal Working Example (MWE) for this bug:

using CUDA
A = zeros(Float32, N, N)
A[:,1] .= ones(N)
W_d = CuArray(W)
W_sparse = sparse(W)
A = CUDA.CUSPARSE.CuSparseMatrixCSC(sparse(A))
false .* A[1,:]

julia> false .* A[1,:]
ERROR: broadcast with sparse arrays is currently only implemented for CSR and CSC matrices
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] copy(bc::Base.Broadcast.Broadcasted{CUDA.CUSPARSE.CuSparseVecStyle, Tuple{…}, typeof(*), Tuple{…}})
   @ CUDA.CUSPARSE C:\Users\accou\.julia\packages\CUDA\YIj5X\lib\cusparse\broadcast.jl:473
 [3] materialize(bc::Base.Broadcast.Broadcasted{CUDA.CUSPARSE.CuSparseVecStyle, Nothing, typeof(*), Tuple{…}})
   @ Base.Broadcast .\broadcast.jl:903
 [4] top-level scope
   @ REPL[14]:1
Some type information was truncated. Use `show(err)` to see complete types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions