Skip to content

GPU support? #198

@fujiisoup

Description

@fujiisoup
Member

Cupy provides GPU enabled sparse matrix implementation that has similar APIs to scipy.sparse.

I believe that only a slight modification makes sparse compatible to cupyx.scipy.sparse.
Is it in the scope of sparse's development?

The most significant problem I believe is how to prepare a testing framework. Travis does not provide gpu instance.
It looks that Cupy's development team has their own server for testing.

Activity

hameerabbasi

hameerabbasi commented on Oct 14, 2018

@hameerabbasi
Collaborator

The problem I have with this approach is that I do not have a CUDA GPU I can use for testing currently. Therefore, maintaining and testing any cupy-specific parts will be close to impossible for me.

I can accept PRs if and only if they do not contain any cupy specific code. The reason isn't the unwillingness to have it; it's the inability to maintain it.

fujiisoup

fujiisoup commented on Oct 14, 2018

@fujiisoup
MemberAuthor

Thanks, @hameerabbasi.

How about to enable the use of general scipy.sparse-like arrays (and also np.ndarray-like array) in sparse?
I think it would have done connection to #86, when we may want sparse stay that had similar api to scipy's sparse.

For API, I am thinking if we could do with the context manager, like

with use_array_modules(cupy, cupyx.scipy.sparse):
    sparse.COO(coords, data)

which uses cupy.ndarray and cupyx.scipy.sparse instead of numpy and scipy.sparse, respectively.

hameerabbasi

hameerabbasi commented on Oct 15, 2018

@hameerabbasi
Collaborator

I'm currently using Numba for some of the calculations on the NumPy. If Numba doesn't properly support these NumPy-ish arrays, then we run into issues.

I guess we could add this context and only test against NumPy specifically. We would also need to check if the contexts are all the same during a calculation.

I guess my point is it would quickly turn complicated, with very little chance left for me to support it. That said, I'm willing to give it a try if we can have a solid CI setup at the very least.

fujiisoup

fujiisoup commented on Oct 15, 2018

@fujiisoup
MemberAuthor

If Numba doesn't properly support these NumPy-ish arrays, then we run into issues.

Numba does not support Cupy...
OK. It looks the GPU support is a little further away than I expected.
Thanks for the information.

jakirkham

jakirkham commented on May 30, 2019

@jakirkham

IIUC Sparse makes use of NumPy arrays to hold the coordinates and data as well as uses it for computation, correct? If so, I wonder to what extent protocols like NEP 18 can get us where we want to go here.

jakirkham

jakirkham commented on May 30, 2019

@jakirkham

Numba does not support Cupy...

As a follow-up on this point, you might find this doc interesting. 🙂

crumleyc

crumleyc commented on Mar 3, 2020

@crumleyc

I am currently in a situation where I have a sparse 1D vector and I have been using sparse.COO. Now I have moved to a GPU server and have been implementing cupy. It seems on y'all's site that cupy integration is in the future, but not yet. I have looked into cupyx.scipy.sparse.coo_matrix but it doesn't support 1D vectors. Ideas? The other matrix and vector are cupy, so I'd like to find some answer that results in a cupy compatible array because then I can still use the gpu for this one operation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @hameerabbasi@jakirkham@fujiisoup@crumleyc

        Issue actions

          GPU support? · Issue #198 · pydata/sparse