question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I’m intending on working on cupy support in xarray along with @quasiben. Thanks for the warm welcome in the xarray dev meeting yesterday!

I’d like to use this issue to track cupy support and discuss certain design decisions. I appreciate there are also issues such as #4208, #3484 and #3232 which are related to cupy support, but maybe this could represent an umbrella issue for cupy specifically.

The main goal here is to improve support for array types other than numpy and dask in general. However, it is likely there will need to be some cupy specific compatibility code in xarray. (@andersy005 raised issues with calling __array__ on cupy in #3232 for example).

I would love to hear from folks wanting to use cupy with xarray to help build up some use cases for us to develop against. We have some ideas but more are welcome.

My first steps here will be to add some tests which use cupy. These will skip in the main CI but we will also look at running xarray tests on some GPU CI too as we develop. A few limited experiments that I’ve run seem to work, so I’ll start with tests which reproduce those.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jacobtomlinsoncommented, Jul 17, 2020

I’ve written this comment a few times to try and not come across as confrontational. I’m not intending to be at all, so please don’t take it that way 😅. Tone is hard in comments! I’m just trying to figure out how to proceed quickly.

I’ve noticed a diverging theme that seems to be coming up in various conversations (see #3234 and #3245) around API design for alternative array implementations.

It seems to boil down to whether an array implementation has 1st party or 3rd party support within xarray.

For numpy and Dask they appear to be 1st party. They influence the main API of xarray and xarray contains baked in logic to create and work with them.

The work on pint so far points towards it being 3rd party. While I’m sure some compatibility code has gone into xarray much of the logic lives out in an accessor library. Given that pint is extending the numpy API this makes sense.

I initially started this work assuming that cupy would be added as 1st party type, given that it attempts to replicate the numpy API without addition. However I’m not sure this is the right stance.

There are a few questions such as “should .plot coerce cupy arrays to numpy?” (with the conversation in #3234 pointing towards no) which are making me think that perhaps it should be more 3rd party.

I think it would help with API design and speed here if a decision were to be made about cupy (and sparse) being 1st or 3rd party.

Perhaps some core maintainers could weigh in here?

1reaction
jthielencommented, Jul 12, 2020

@jacobtomlinson Any idea how this would play with the work that’s been going on for units here; I’m specifically wondering if xarray ( pint ( cupy )) would/could work.

As far as I’d see it, the pieces to get this working are

and then finally testing xarray( pint( cupy )) works automatically from there. https://github.com/hgrecco/pint/issues/964 was deferred due to CI/testing concerns, so it will be great to see what @jacobtomlinson can come up with here for xarray, since hopefully at some point it would be transferable over to pint as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation — CuPy 11.4.0 documentation
Uninstalling CuPy#. Use pip ; Upgrading CuPy#. Just use pip install with -U ; Reinstalling CuPy#. To reinstall CuPy, please uninstall CuPy and...
Read more >
Installation Guide — CuPy 1.0.3 documentation
CuPy is supported on Python 2.7.6+, 3.4.3+, 3.5.1+, 3.6.0+. CuPy uses C++ compiler such as g++. You need to install it before installing...
Read more >
CuPy: NumPy & SciPy for GPU
The easiest way to install CuPy is to use pip. CuPy provides wheels (precompiled binary packages) for Linux and Windows. Read the Installation...
Read more >
Basics of CuPy — CuPy 11.4.0 documentation
CuPy implements many functions on cupy.ndarray objects. See the reference for the supported subset of NumPy API. Knowledge of NumPy will help you...
Read more >
cupy.add — CuPy 11.4.0 documentation
cupy.add# ... Adds two arrays elementwise. ... Created using Sphinx 5.0.2. v: stable. Versions: latest · stable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found