-
Notifications
You must be signed in to change notification settings - Fork 81
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
Introduce AbstractGPUSparseArray #431
Comments
That's intentional, because we don't have multiple inheritance. If we want So I'm not sure what you're suggesting here with 'Support for AbstractCuSparseMatrix'. A CUDA-specific type is never going to be used in GPUArrays, which sits at a higher level of abstraction. We could define |
For example, here the ExponentialUtilities.jl package declares a function for AbstractGPUArray, which is called only if I insert a dense CuArray. I need a way to declare a function for a sparse AbstractCuSparseMatrix, but the only way I found until now is to import the CUDA.jl package, which I don't know if it is a good idea. What do you think? |
I try to explain better what I mean. I think that it is better to move these lines which are actually in the CUDA.jl package into this package. Such as the current dense case, which is defined here GPUArrays.jl/lib/GPUArraysCore/src/GPUArraysCore.jl Lines 18 to 26 in 0a42771
In this way, we can add also the AbstractCuSparseMatrix into the AnyGPUArray type. |
That's different from the AbstractGPUArray test you requested first (which is a subtype of DenseArray, so that wouldn't work). Maybe we shouldn't have done that, i.e., AbstractGPUArray<:AbstractArray instead, but I don't think we can safely change that now. But introducing a separate AbstractGPUSparseArray (which wouldn't be a subtype of AbstractGPUArray, but could be included in AnyGPUArray) seems like it could work. I'm not sure how useful it would be though, because almost none of the AnyGPUArray functionality would be SparseArray-compatible. And we don't have any other GPU back-end that supports sparse arrays(rocSPARSE exists, but AFAIK AMDGPU.jl doesn't use it). |
Hello,
dense CuArrays are recognized as AbstractGPUArray type. Indeed, if I do
it returns true. However, it returns false for a sparse AbstractCuSparseMatrix array, such as CuSparseMatrixCSR type. If I do
the first returns true, while the second not.
I think that the support for sparse types is essential for developing external packages which use
if
conditions without import the whole CUDA.jl package. Such as the ExponentialUtilities.jl package, which have a special condition only for AbstractGPUArray types, which however fails if I insert a sparse array.The text was updated successfully, but these errors were encountered: