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

ambiguous sparse constructor #1088

Closed
CarloLucibello opened this issue Aug 6, 2021 · 2 comments · Fixed by #1093
Closed

ambiguous sparse constructor #1088

CarloLucibello opened this issue Aug 6, 2021 · 2 comments · Fixed by #1093
Labels
bug Something isn't working cuda array Stuff about CuArray. good first issue Good for newcomers

Comments

@CarloLucibello
Copy link
Contributor

julia> using SparseArrays, CUDA

julia> sparse([1,2,3], [3,4,5], [1,1,1])
3×5 SparseMatrixCSC{Int64, Int64} with 3 stored entries:
     1    
       1  
         1

julia> sparse([1,2,3] |> cu, [3,4,5] |> cu, [1,1,1] |> cu)
ERROR: MethodError: sparse(::CuArray{Int64, 1}, ::CuArray{Int64, 1}, ::CuArray{Int64, 1}) is ambiguous. Candidates:
  sparse(I, J, V::AbstractVector{T} where T) in SparseArrays at /home/lucibello/julia/julia-1.6.2/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:952
  sparse(::CuArray, args...) in CUDA.CUSPARSE at /home/lucibello/.julia/packages/CUDA/lwSps/lib/cusparse/conversions.jl:3
Possible fix, define
  sparse(::CuArray, ::Any, ::AbstractVector{T} where T)
Stacktrace:
 [1] top-level scope
   @ REPL[53]:1
 [2] top-level scope
   @ ~/.julia/packages/CUDA/lwSps/src/initialization.jl:52
@CarloLucibello CarloLucibello added the bug Something isn't working label Aug 6, 2021
@CarloLucibello CarloLucibello changed the title ambiguous sparse construtor ambiguous sparse constructor Aug 6, 2021
@maleadt
Copy link
Member

maleadt commented Aug 6, 2021

FWIW, the method considered there is just one throwing an error, you need to use more specific constructors (or we'd need to add a format kwarg or so).

@maleadt maleadt added good first issue Good for newcomers cuda array Stuff about CuArray. labels Aug 6, 2021
@CarloLucibello
Copy link
Contributor Author

thanks. Maybe a format kwarg which defaults to the CSC format as Base.SparseArrays does would be ideal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cuda array Stuff about CuArray. good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants