[WIP]: Force Zarr coordinate reads to be on the host #10079
Draft
+95
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(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