slabitz
GPU decoder and encoder for bitshuffle-zstd and bitshuffle-LZ4 HDF5 chunks (filter 32008) from X-ray detectors, written in Slang/CUDA and callable from Python and C.
- Zstd decode: Microsoft's DirectStorage GPU zstd shaders (HLSL), transformed and compiled with Slang to CUDA.
- LZ4 decode: Slang port of the nvCOMP decoder used by
bslz4_to_sparse, with a fused decode + bit-unshuffle kernel. - Encode: GPU bitshuffle transpose and plane-aware LZ4/zstd encoders
(producing filter-32008 chunks compatible with
hdf5pluginandpac-zstd). - Host & Python: Small C host library (
src/,build/libslabitz.so) over the CUDA driver API (dlopen("libcuda.so.1"), no CUDA runtime dependency), wrapped by theslabitzPython package (ctypes,__cuda_array_interface__v3, and__dlpack__).
Status and Limits
- Supported GPUs: NVIDIA Kepler (
sm_35) through Ada/Hopper (sm_89/sm_90), verified on L40S (sm_89), GTX 1050 Ti (sm_61), and TITAN Black (sm_35, driver 340). - Packaging: Build a standalone, Python-version-independent wheel
(
py2.py3-none-manylinux_2_17_x86_64/ppc64le, bundlinglibslabitz.soand all 30 portable fatbins) withpixi run wheel(orpython3 tools/build_wheel.py) and install withpip install dist/slabitz-*.whl. - Security limit: Valid frames are memcheck-clean, and host frame walks are
bounds-checked, but compressed-block contents are still trusted by the GPU
decode kernels (
T11b). Do not decode untrusted compressed data.
Python Quickstart
import numpy as np
import slabitz
frame = np.zeros((512, 512), dtype=np.uint16)
frame[200:220, 200:220] = 42
with slabitz.Decoder(device=0) as dec:
# Encode on the GPU (ZSTD or LZ4)
chunk = dec.encode(frame, codec=slabitz.ZSTD)
# Inspect filter-32008 header and decode back on the GPU
codec = slabitz.codec_of_chunk(chunk)
out, err = dec.decode([chunk], codec, frame.dtype, frame.shape)
dec.wait()
assert (err.get() == 0).all()
assert np.array_equal(out.get()[0], frame)
Runnable MVP demos and benchmarks live in examples/:
examples/quickstart.py: basic GPU encode + decode round-trip for ZSTD and LZ4.examples/hdf5_roundtrip.py: GPU encode -> write raw chunks withh5py/hdf5plugin.Bitshuffle-> CPU & GPU readback.examples/bench_simple.py: simple encode/decode throughput comparison against CPUhdf5plugin.
See docs/ (mkdocs.yml) for the user guide, API reference, and benchmark
tables.
Build and Test
Anywhere: pixi
The checkout is git-only. Pixi, its package cache, build temp files and the
environment live in a separate workspace (typically a gitignored workspace/
symlink next to the checkout):
WS=/path/to/workspace
mkdir -p $WS && git clone <this repo> $WS/slabitz
$WS/slabitz/tools/setup_workspace.sh --workspace $WS [--examples DIR]
. $WS/env.sh && cd $WS/slabitz
CUDA_ARCH=sm_61 pixi run test # fetch slangc, build kernels + lib, run tests
Set CUDA_ARCH to your GPU (sm_50 Maxwell, sm_61 Pascal, sm_89 Ada/L40S).
The pixi environment (pixi.toml, pixi.lock) provides Python 3.12, numpy,
zstandard, h5py, hdf5plugin, bitshuffle, gcc 13, pytest, lz4, and CUDA 12.6.
The host only needs the NVIDIA driver (libcuda.so.1).
At ESRF (shared root)
Development runs in $SLABITZ_DEV_ROOT:
cd $SLABITZ_DEV_ROOT/wt/<task> && . $SLABITZ_DEV_ROOT/env.sh
sbz build && sbz test # kernels linked from shared cache, library built locally
gpu-run sbz test # run on an idle Slurm L40S
Portable kernels (sm_35..sm_90 + PTX)
pixi run -e kepler build-sm35 # sm_35 cubins (NVRTC 11.8)
pixi run build-fatbins # one .fatbin per kernel in build/kernels/
SLABITZ_KERNEL_DIR=$PWD/build/kernels python3 examples/quickstart.py
Without pixi
Needs x86_64 Linux (glibc >= 2.28), CUDA 12.x nvcc, C compiler, make,
curl, Python 3 with numpy, zstandard, h5py, hdf5plugin, bitshuffle:
tools/fetch_slangc.sh
CUDA_ARCH=sm_89 python3 tools/build_all.py
make
Runtime/test environment variables:
SLABITZ_KERNEL_DIR: override kernel directory (default:<libdir>/kernelsorbuild/).SLABITZ_LIB: override path tolibslabitz.so.SLABITZ_DEBUG_SYNC=1: synchronize after each kernel stage.PAC_LIB: path topac-zstd/build/libpac.sofor encoder parity/ratio tests.SLABITZ_SKIP_EXTERNAL=1: skippac-zstd's externalcheck_rfc/build-compatvalidators intests/run_zstd_encode.pywhen not built.
Public C API (include/slabitz.h)
include/slabitz.h provides a non-blocking, caller-owned-memory C API over the
CUDA driver backend:
sbz_ctx_create/sbz_ctx_destroy/sbz_ctx_errorsbz_bshuf_decode_device/sbz_bshuf_decode/sbz_zstd_decodesbz_bshuf_encode_bound/sbz_bshuf_encode_devicesbz_ctx_wait/sbz_ctx_query/sbz_ctx_alloc_count
Layout
| Path | Contents |
|---|---|
slabitz/ |
Python package (Decoder, decode, decode_device, encode, encode_device, encode_bound) |
include/ |
Public C API (include/slabitz.h) |
src/ |
C host library: host frame walk, CUDA driver backend, decode & encode stage chains |
kernels/ |
30 Slang kernel entry points, kernels/lib/ shared stages, and CPU references |
examples/ |
Runnable Python demos and simple CPU-vs-GPU benchmark |
docs/ |
User docs (docs/*.md), history.md, active tasks (docs/dev/), archived tasks (docs/archive/) |
tests/ |
Stage, chain, fuzz, Python API, and encoder/decoder regression tests |
tools/ |
Build scripts, sbz.sh, slangc fetch, DS header transform, synthetic data generator |
bench/ |
L40S regression gate (gate.py) and pipeline benchmarks |
data/ |
Committed pac fixtures (data/pac/) and compatibility corpus (data/compat/) |
third_party/ |
Vendored DirectStorage headers and zstd educational decoder |
Authors & License
- Project direction: @jonwright.
- GPU decoder: Ported and developed with Claude (Anthropic) and DeepSeek V4 (served at ESRF).
- GPU encoder: Bitshuffle transpose and plane-aware LZ4/zstd encoders were developed by Neon and Hydrogen running in Antigravity on a home computer with an NVIDIA GeForce GTX 1050 Ti.
- Code review & hardening audits: DeepSeek V4.1 Flash identified the encoder safety, testing, and regression items fixed prior to merge.
Bug reports may be looked at.
MIT License, Copyright (c) 2026 European Synchrotron Radiation Facility (ESRF)
and Jon Wright; see LICENSE and THIRD_PARTY_NOTICES.md.
Metadata
Release files for slabitz 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slabitz-0.0.1-py2.py3-none-manylinux_2_17_x86_64.whl | Python 3, Python 2 | none | Linux glibc 2.17+ x86-64 | Details for slabitz-0.0.1-py2.py3-none-manylinux_2_17_x86_64.whl |
| slabitz-0.0.1-py2.py3-none-manylinux_2_17_ppc64le.whl | Python 3, Python 2 | none | Linux glibc 2.17+ PowerPC 64-le | Details for slabitz-0.0.1-py2.py3-none-manylinux_2_17_ppc64le.whl |
Total release size: 5.3 MB
Release files / slabitz-0.0.1-py2.py3-none-manylinux_2_17_x86_64.whl
| Download URL | slabitz-0.0.1-py2.py3-none-manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8148aaa4296e3c06093537e017448993830f18632c9790a6bab14f901fbdfd47
|
|
BLAKE2b-256 checksum How to use checksums |
5a6a24b7e13b46b9ecfcfbd4e1094cd7aacfa16f7536e7bd207ac97d38b4f545
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / slabitz-0.0.1-py2.py3-none-manylinux_2_17_ppc64le.whl
| Download URL | slabitz-0.0.1-py2.py3-none-manylinux_2_17_ppc64le.whl |
|---|---|
| Size | 2.6 MB |
| Tags | Linux glibc 2.17+ PowerPC 64-le Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7a2103af079f4674e9c4b26bd0494403337f116335d363ab18207d0bb58f7de5
|
|
BLAKE2b-256 checksum How to use checksums |
48192c39310891217f9be917a2405bba438f4c040619c430d373473d0fca8b5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for slabitz 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for slabitz-0.0.1-py2.py3-none-manylinux_2_17_x86_64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.