Add optional TensorStore backend for Xarray data loading - #871
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9670f80b57
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex may I have your review for this PR? |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@fomo-bot in making your comparison, feel free to check out both or either branches to make spikes/prototypes to more fairly compare the approaches. |
|
I’d adopt #871 as the incremental backend option, while carrying forward #800’s batch planning and prefetch design. Before committing to maintaining the Rust reader, I’d compare TensorStore inside that same pipeline. I made that prototype, and the result is promising. I compared the current heads (
These are medians of three 16-batch runs after warming the same reads: one GB10, local uncompressed one-degree Zarr, batch size 1, The prototype replaces #800’s native array reader with TensorStore reads into its existing pinned buffers. It retains #800’s planning, preprocessing, and CUDA prefetch. It is experimental code, not functionality currently provided by either PR. These measurements do not establish full-training speedups or performance on compressed quarter-degree data, remote storage, or multi-GPU systems. The tradeoffs are:
My interpretation of the prototype is that #800’s pipeline design contributes substantial value independently of Rust. On this workload, changing its reader to TensorStore preserved performance. That supports making its batching/prefetch machinery usable with either reader. For immediate local OM4 throughput, #800 is the stronger implementation today. The next deciding experiment should compare Rust and the TensorStore prototype on the same compressed quarter-degree dataset and actual multi-GPU training run, measuring epoch time, data-wait stalls, and host/device memory. If TensorStore remains comparable there, I would favor it as the native reader and retain #800’s pipeline optimizations. Debug info
|
|
Opened draft PR #874, stacked on #800. Debug info
|
|
Draft PR #874 has passed CI at Debug info
|
Summary
xarray-tensorstorebackend to the existing Xarray/CanonicalSourcedata pathzarr-pythonas the default and ship TensorStore as the optionalsamudra[tensorstore]extraThis gives Samudra a native-code Zarr option without changing the established Xarray data-loading boundary.
Enable it with:
Local benchmark
Cached local Zarr v2 reads through
_XarrayCanonicalReader, 25 measured iterations after an initial read:The backends returned exactly equal arrays. These numbers measure hot local reads, not network throughput or full training-step performance.
I also exercised the complete
DataConfig -> CanonicalSource -> read()path against the public two-degree OM4 OSN store. It returned a(2, 4, 90, 180)float32batch successfully via TensorStore.Limitations
The public
xarray-tensorstoreAPI cannot pass an explicit authenticated custom S3 endpoint through both its Zarr-Python metadata reader and TensorStore array reader. Those locations fail loudly with guidance to use an AWSs3://location, anonymous HTTP endpoint, or the existingzarr-pythonbackend.Validation
uv run pytest -m "not manual and not cuda"— 472 passed, 2 skipped, 10 xfaileduvx pre-commit run --all-files