-
Notifications
You must be signed in to change notification settings - Fork 218
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
Implement (limited) broadcast of sparse arrays #1367
Conversation
- Use getters instead of field access - Make vector length an integer - Move device code into CUSPARSE.jl
Codecov Report
@@ Coverage Diff @@
## master #1367 +/- ##
==========================================
- Coverage 78.84% 78.06% -0.79%
==========================================
Files 119 121 +2
Lines 8699 8929 +230
==========================================
+ Hits 6859 6970 +111
- Misses 1840 1959 +119
Continue to review full report at Codecov.
|
@@ -17,12 +18,12 @@ Base.convert(T::Type{<:AbstractCuSparseArray}, m::AbstractArray) = m isa T ? m : | |||
mutable struct CuSparseVector{Tv, Ti} <: AbstractCuSparseVector{Tv, Ti} | |||
iPtr::CuVector{Ti} | |||
nzVal::CuVector{Tv} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if this was nzval
like Base sparse has. That would make general code work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's unlikely any generic code is actually going to work, but sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked and generic code (SparseDiffTools.jl) almost does work, sans #101
Could this be used to implement |
Could you elaborate? What is |
|
|
using SparseArrays, CUDA
A = sprand(100,100,0.1)
fill!(A,true)
cuA = cu(A)
fill!(cuA,true) # fails |
That doesn't look to be the case julia> x = sprand(2,2,0.5)
2×2 SparseMatrixCSC{Float64, Int64} with 1 stored entry:
0.507603 ⋅
⋅ ⋅
julia> fill!(x, true)
2×2 SparseMatrixCSC{Float64, Int64} with 4 stored entries:
1.0 1.0
1.0 1.0 |
peculiar... |
That said, yes, such an operation could be implemented with the support I have here (although it isn't available right now, as broadcast assignment also fills zeros). But if there's an interface, I can implement it. |
looks like it should be |
Okay cool, I checked I think about everything is supported. But I just need to figure out how to check if something is a sparse matrix without knowing about CUDA. Is there some |
Demo:
Limitations:
cc @Roger-luo @ChrisRackauckas