Open akshaysubr opened 1 month ago
thanks for working on this @akshaysubr. what would we need to change on the CI side to run gpu tests?
@d-v-b For CI, a GPU runner would be needed and the pipeline should install the optional [gpu]
dependencies (just cupy).
I would have thought that this line
Would have picked up this new optional dependency
But that didn't happen in this CI run: https://github.com/zarr-developers/zarr-python/actions/runs/9555282123/job/26338638922?pr=1967#step:5:1
But I wonder if we should move all of this to its own file:
gpu_buffer.py
?
I could imagine something like this:
src/zarr/buffer
|- gpu.py
| |- Buffer
|- cpu.py
| |- Buffer
leading to usage like
from zarr.buffer import cpu, gpu
...
cpu.Buffer()
...
gpu.Buffer()
@d-v-b Thanks for the suggestion to refactor into two separate files. I made those changes and added some more that I think benefit the overall usage of these buffer classes. Essentially now, zarr.buffer.Buffer
is an abstract class and zarr.buffer.cpu.Buffer
and zarr.buffer.gpu.Buffer
are concrete implementations which makes things cleaner. It also requires implementations to be specific about which type of Buffer
they intend on using which I think is a good thing.
Adding an initial implementation to support GPU arrays. Currently limited to only arrays that support the
__cuda_array_interface__
(cupy, numba, pytorch). Can extend this to supporting dlpack as well later for JAX and Tensorflow support.TODO: