pSZ/cuSZ
A GPU-based error-bounded lossy compressor for scientific data.
pSZ/cuSZ is a GPU implementation of the SZ algorithm. It was the first GPU-practical framework of error-bounded lossy compression for scientific data (circa 2020), built to improve SZ's throughput on heterogeneous HPC systems. It focuses on the CUDA backend, with other GPU-parallel backends in development. The project was formerly named cuSZ, which remains the short form.
© 2025 Argonne National Laboratory and Oakland University. BSD 3-Clause.
How it works
- The user picks an error mode: absolute (
abs), or relative to the data's value range (r2r), and an error bound. - Prediction errors are quantized in units of that bound. In-range quant-codes are stored; out-of-range ones are gathered as outliers.
- The in-range quant-codes go through a Huffman encoder.
- CPU-SZ adds a DEFLATE pass to exploit repeated patterns; on the GPU, cuSZ+'s RLE plays the same role.
There are real differences between CPU-SZ and pSZ/cuSZ; the papers below carry the detail.
Variants
each trades quality, ratio, and speed differently-
cuSZ · Tian et al., '20, '21
The basic framework: an N-D Lorenzo predictor, a histogram, and Huffman encoding. A balanced compression ratio and quality.
-
cuSZ+ (hi-ratio) · Tian et al., '21
A de-redundancy RLE pass ahead of Huffman, from compressibility research showing RLE wins on highly compressible data.
-
FZ-GPU · Zhang, Tian et al., '23
Prediction plus de-redundancy only, no histogram or Huffman: it prioritizes data-processing speed.
-
SZp-CUDA / GSZ · Huang et al., '23, '24
A single-kernel 1-D predictor plus de-redundancy pass, also prioritizing data-processing speed.
-
cuSZ-i · Liu, Tian, Wu et al., '24
A spline-interpolative 3-D predictor with QoZ-like methods, for substantially better reconstruction quality and compression ratio.
-
cuSZ-Hi · Wu and Pan et al., '25
A 2-D/3-D spline predictor feeding two encoder paths, one tuned for ratio and one for throughput.
Install and run
Build from source
git clone --recursive https://github.com/szcompressor/cuSZ.git cusz-latest
cd cusz-latest && mkdir build && cd build
cmake .. -DPSZ_BACKEND=cuda -DPSZ_BUILD_EXAMPLES=on -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CUDA_ARCHITECTURES="<sm>"
make -j
make install
Needs CUDA 11.4 onward, a C++17 host compiler (GCC 9 onward or any
Clang), and CMake 3.18 onward. Without CMAKE_CUDA_ARCHITECTURES (or the
CUDAARCHS environment variable), the build targets 75 only.
Compress, then reconstruct
cusz -t f32 -m r2r -e 1e-4 -i data.f32 -l 3600-1800 -z --report cr
cusz -i data.f32.cusza -x --compare data.f32 --skip write2disk
--skip write2disk checks compression quality without
writing the reconstruction to disk. -p picks the pipeline, e.g.
-p spl.. or -p preset:hicr. -V reports the machine it ran on.
Python binding
CUDAARCHS="<sm>" pip install -e py_ext --no-build-isolation
from psz import compress_init, decompress_init
with compress_init(data.shape) as c: # data: a float32 CuPy array
c.compress_process("lrz..", data, 1e-3 * c.compress_extrema(data).rng)
header, archive = c.compress_archive()
with decompress_init(header) as dc:
xdata = dc.decompress_process(archive)
psz is a nanobind binding that works on CuPy arrays;
example/src/demo_py.ipynb
walks through it.
Fuller instructions, including the recommended GCC and Clang combinations, live in the wiki: build and install, command-line use, API reference, and Python.
Papers
chronologically ordered-
PACT '20cuSZ: An efficient GPU-based error-bounded lossy compression framework for scientific data The basic framework: fine-grained N-D error-controlled construction plus coarse-grained lossless encoding. ACM arXiv
-
CLUSTER '21Optimizing error-bounded lossy compression for scientific data on GPUs Throughput via fine-grained N-D reconstruction, and ratio when the data is smooth. IEEE arXiv
-
SC '24cuSZ-i: High-ratio scientific lossy compression on GPUs with optimized multi-level interpolation Spline interpolation for high-ratio compression and high-quality reconstruction, plus synergetic lossless encoding. IEEE arXiv
-
SC '25Boosting scientific error-bounded lossy compression through optimized synergistic lossy-lossless orchestration Ratio gains from the LC framework's lossless codec composition, plus HiTP and HiCR modes atop cuSZ-i. ACM arXiv
Citing pSZ/cuSZ: BibTeX entries live in doc/psz-cusz.bib.
Datasets
from SDRBench| Dataset | Dim. | Description |
|---|---|---|
| EXAALT | 1D | molecular dynamics simulation |
| HACC | 1D | cosmology, particle simulation |
| CESM-ATM | 2D | climate simulation |
| EXAFEL | 2D | images from the LCLS instrument |
| Hurricane ISABEL | 3D | weather simulation |
| NYX | 3D | adaptive mesh hydrodynamics and N-body cosmology |
The fields are available from SDRBench.
People
Developers. Jiannan Tian (primary/PI), Robert Underwood (deployment), Jinyang Liu, Shixun Wu, Jinwen Pan (cuSZ-i/Hi), Cody Rivera (Huffman coding), Sheng Di and Franck Cappello (administrative PIs).
Contributors. Jon Calhoun, Wenyu Gai, Megan Hickman Fulp, Xin Liang, Kai Zhao.
With thanks to Dingwen Tao, who advised the project from 2020 to 2024, and to Dominique LaSalle (NVIDIA), mentor at the Argonne GPU Hackathon 2021.
Acknowledgements
Supported by the Exascale Computing Project (17-SC-20-SC), a collaboration of the DOE Office of Science and the NNSA; by the U.S. Department of Energy, Office of Science, under contract DE-AC02-06CH11357; and by the National Science Foundation under grants CSSI/OAC #2104023, #2247080, OAC #2247060, CSSI/OAC #2311875, and #2311876.