-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[WIP]: Force Zarr coordinate reads to be on the host #10079
base: main
Are you sure you want to change the base?
Conversation
zarr-python 3.x supports reading data to host (CPU) memory or device (GPU) memory. Because coordinates are small and really do need to be on the host (IIUC because putting them in an Index) then there's no benefit to reading them to device. zarr-python includes a global config for whether to use host or device memory for reads, with `zarr.config.enable_gpu()`. But you can override that on a per-read basis by passing `prototype` to the getitem call. This does that for arrays that are coordinates.
+1 . Coordinates should stay on the host and "data" should be streamed to device. I would not think metada (including coordinates) to be read directly on GPUs ever and in general they are so small that there will not be any additional benefit in reading them to device. |
I added a new keyword I'll try adding a test here. |
Thanks for opening this, now I see what you mean. Let me push an alternative PR. We only need this because our decoding machinery does handle duck arrays yet. So at the cost of a device->host transfer of a small array, we can fix it in the decoding pipeline. |
5e6daba
to
d620357
Compare
(just a POC. I'm not sure if this is a good idea or not)
zarr-python 3.x supports reading data to host (CPU) memory or device (GPU) memory. Because coordinates are small and really do need to be on the host (IIUC because putting them in an Index) then there's no benefit to reading them to device.
zarr-python includes a global config for whether to use host or device memory for reads, with
zarr.config.enable_gpu()
. But you can override that on a per-read basis by passingprototype
to the getitem call.This does that for arrays that are coordinates.
Here's a snippet:
This still fails without #10078, but a little later on when we try to load the data. All the coordinate loading (including
decode_times
) seems to work fine. With this + #10078, the output is as expected:cc @dcherian