Decompress / Compress Zarr on the GPU
Project description
czarr
czarr reads and writes Zarr v3 arrays on NVIDIA GPUs. Compression runs through nvCOMP, file I/O runs through cuFile (GPUDirect Storage where the system supports it), and reads return cupy.ndarray.
Documentation: https://czarr.readthedocs.io/
Installation
The NVIDIA wheels are CUDA-version-specific, so the CUDA build is an explicit choice:
pip install "czarr[cu12]" # CUDA 12
pip install "czarr[cu13]" # CUDA 13
pip install czarr without an extra installs no CUDA wheels and fails at import. Linux only.
Usage
Through zarr, after one setup call:
import czarr, zarr
czarr.configure_gpu()
arr = zarr.open_array("data.zarr") # any zstd/lz4/gzip/zlib/blosc store,
out = arr[:] # including CPU-written ones; decodes on GPU
Or through the explicit API, which parses metadata once and holds no global state:
from czarr.core import Array
arr = Array.open("data.zarr")
out = arr[0:4, :, 8:24]
Both return cupy.ndarray. Writing goes through zarr (czarr.create_cuda_array or zarr.create_array with czarr codecs). See the documentation for the how-to guides and API reference.
Codec selection
| Situation | Codec |
|---|---|
| Default | ANS (lowest scratch, scales past 4 GiB) |
| Small arrays | Bitcomp (fastest below 4 GiB; OOMs above on A40) |
| Interoperable bitstream | Zstd, LZ4, Gzip, Zlib (bit-identical with the CPU libraries) |
| Existing blosc stores | decode-only via czarr.Blosc; write new data as [Shuffle, Zstd] |
GPU decode pays off from roughly 1 MiB chunks upward; below 256 KiB, multi-threaded CPU Blosc is faster.
Chunk shapes for TCZYX microscopy
| Access pattern | Chunks |
|---|---|
Whole timepoints, arr[t] |
(1, 1, Z, Y, X) |
Z-planes, arr[t, c, z] |
(1, 1, 1, Y, X) |
| XY tiles | (1, 1, 1, tile_y, tile_x) |
Full timeseries, arr[:, c, z] |
(T, 1, 1, Y, X) |
Match the chunk to the access pattern so each read decodes only the chunks it touches. Sharded stores are handled: czarr replaces zarr's sharding_indexed codec with a variant that coalesces partial-shard reads.
Limitations
- The lowlevel read path covers zstd, blosc, and shuffle. Other codec chains fall back to the zarr pipeline, GPU-decoded where a czarr codec exists.
Bloscis decode-only.- Real GPUDirect Storage requires the
nvidia_fskernel module; without it cuFile stages through a pinned host bounce. cuFile cannot read tmpfs. cupyis a hard dependency; zarr's GPU buffer prototype is hard-coded tocupy.ndarray.
An experiment in AI-assisted development
As you can probably tell, most of this has been generated with AI tooling, this is just an experiment to see if this even works, and it has helped me resolve the issue of i/o bottlenecks in my own work.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file czarr-0.0.1a0.tar.gz.
File metadata
- Download URL: czarr-0.0.1a0.tar.gz
- Upload date:
- Size: 307.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3ef7b9a1f414bd87140e3b955516987e82905096009b43590debc1fe07af2b3
|
|
| MD5 |
7d1bf95491ea335d253ca1a0886de1aa
|
|
| BLAKE2b-256 |
fa3fa419a480b6472965ebc05bc02660eb293f6d6fb14cb5526aadd253571b9e
|
Provenance
The following attestation bundles were made for czarr-0.0.1a0.tar.gz:
Publisher:
release.yaml on srivarra/czarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
czarr-0.0.1a0.tar.gz -
Subject digest:
b3ef7b9a1f414bd87140e3b955516987e82905096009b43590debc1fe07af2b3 - Sigstore transparency entry: 2107986126
- Sigstore integration time:
-
Permalink:
srivarra/czarr@3460df8ab91718dbebc1c3b2c36441f3b9cbeeef -
Branch / Tag:
refs/tags/v0.0.1a1 - Owner: https://github.com/srivarra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3460df8ab91718dbebc1c3b2c36441f3b9cbeeef -
Trigger Event:
release
-
Statement type:
File details
Details for the file czarr-0.0.1a0-py3-none-any.whl.
File metadata
- Download URL: czarr-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 104.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f062bd15d75d76c255e3ec9b5dc3febd62028f06f8313e09f27a48a88be9328f
|
|
| MD5 |
7be77e1ffa1d72642853e10c3b7708c0
|
|
| BLAKE2b-256 |
66df3aa00230f2a88591f6a90ee7a5b2aa4b01019a7515eeb7b43f1b8928c8b8
|
Provenance
The following attestation bundles were made for czarr-0.0.1a0-py3-none-any.whl:
Publisher:
release.yaml on srivarra/czarr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
czarr-0.0.1a0-py3-none-any.whl -
Subject digest:
f062bd15d75d76c255e3ec9b5dc3febd62028f06f8313e09f27a48a88be9328f - Sigstore transparency entry: 2107986315
- Sigstore integration time:
-
Permalink:
srivarra/czarr@3460df8ab91718dbebc1c3b2c36441f3b9cbeeef -
Branch / Tag:
refs/tags/v0.0.1a1 - Owner: https://github.com/srivarra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@3460df8ab91718dbebc1c3b2c36441f3b9cbeeef -
Trigger Event:
release
-
Statement type: