|
FZGPUModules 2.0
GPU-accelerated modular compression pipelines
|
Historical v2.0.0 adapter guide. The setup below describes the older helper-based integration. The current v2.0.1 integration uses libpressio.FZGPUModulesChain and self-contained archives that a fresh decoder can read. Its builder and implementation notes are maintained in CN-LIBPRESSIO-1.
FZGPUModules experimentally exposes a libpressio plugin (fzgpumodules) that lets you build and run GPU compression pipelines from Python (or C++) through libpressio. The plugin translates libpressio's generic compressor interface into FZGPUModules pipeline calls, handles GPU memory management, and surfaces metrics after each compress.
Use a v2-compatible adapter and rebuild it against the installed SDK. Public-header probes omit registrations for unavailable ADM, legacy SZp, CDF97, SPECK2D, Cdf97OutlierCorrect, and SZx stages. The unpatched fork requires the v2 compatibility changes before following the setup below.
The plugin's configuration metadata exposes fzgpumodules:optional_stages for the CDF97, SPECK2D, wavelet-correction, and SZx wrappers.
The adapter currently requires a prior compress() on the same compressor instance before decompress(). Its raw compressed output does not independently restore a fresh decoder's pipeline and stage metadata. This is an existing adapter limitation, separate from the library's self-describing FZM file API.
The tested path uses an installed FZGPUModules SDK plus a separately built libpressio adapter in a dedicated Python virtual environment. Spack supplied the host std_compat dependency in our validation; it did not build the SDK or adapter.
Use FZGPUModules v2.0.0 (01f40d5) and the compatible adapter snapshot b330cbe7a125fcf79194068b823b51323335b7d7. The prepared adapter source archive includes the Python Chain helper and optional stage probes. As checked on 2026-10-14, the public v2.0.0 release only attaches the library source archive, and the fork's remote master does not contain the tested adapter revision. The verified local adapter archive is /home/exouser/release_candidates/fzgpumodules-2.0.0/libpressio-fzgmod-2.0.0-source.tar.gz. Public installation requires making that adapter snapshot available through the fork or a source archive; do not substitute an unpinned master checkout. Retain the source pins and archive provenance when rebuilding.
Prerequisites are a CUDA toolkit/driver, a supported C++17 compiler, CMake 3.24+, Python with development headers and venv support, SWIG, and an installed std_compat CMake package. The validated host uses Python 3.12.3, CUDA 12.9, GCC 13.3, SWIG 4.2.0, and std_compat 0.0.22. These are tested versions, not a claim that all older combinations are supported. See build requirements.
Set local paths to the stable library source and compatible adapter snapshot:
These Python pins were validated on CPython 3.12, Linux x86_64. For offline reproduction, use the matching retained wheels with --no-index --find-links. Do not use pip install libpressio as a substitute for building this adapter.
Build and install the SDK, or point the adapter at an existing compatible install:
native targets the visible GPU. For a GPU-less build host, set the target explicitly: 80 for A100 or 90 for H100. The prepared H100 demo SDK targets SM 90 and must be rebuilt for an A100 host.
Install the adapter's native libraries and Python modules into explicit destinations:
LIBPRESSIO_PYTHON_SITELIB is separate from CMAKE_INSTALL_PREFIX; setting only the native prefix does not select the venv's Python installation directory. The plugin-enabled Python install includes fzgm_helper.Chain automatically.
Run in a dedicated shell:
Select fzgpumodules:specialization with off or auto; the plugin has no fusion alias. The ready demo environment's env.sh also sets these paths and clears policy overrides. Its preflight checks the installed import/library origins, visible GPU, helper availability, and stable catalog before presentation.
The earlier Spack recipe is an alternative requiring validation against the same SDK and adapter revisions. spack develop ... libpressio@master alone does not pin the v2-compatible adapter. Verify the custom package's feature variants and selected sources before using it as a v2 installation recipe.
Our snapshot built with SWIG 4.2.0. The older blanket warning that every SWIG version from 4.1 onward fails is too broad. If an older source/recipe fails with SWIG_Python_AppendOutput argument errors, check its vendored NumPy interface against the selected SWIG version; the former 4.0.2 workaround is not required by this verified 4.2.0 setup.
For linear pipelines, the plugin's Python bindings install fzgm_helper.Chain, which avoids hand-writing "sN <- sM:port" connection strings and "fzgpumodules:sN:<option>" keys:
The builder supports linear pipelines. For non-linear graphs (multiple branches into one stage, direction-dependent stages, config-file mode) build early_config by hand as above.
encode()/decode() accept any object exposing __cuda_array_interface__ version 3 (CuPy arrays, contiguous PyTorch CUDA tensors, etc.), not just NumPy arrays. Passed a device-resident input, libpressio constructs the underlying pressio_data directly in the "cudamalloc" domain — no host round-trip.
encode()'s return is always device-resident for fzgpumodules, regardless of input. compress_device() (fzgpumodules.cc) unconditionally builds its output pressio_data in the "cudamalloc" domain, so comp.encode(data) hands back a PressioDataCuda — not a NumPy byte array — even when data is a plain host NumPy array. PressioDataCuda exposes __cuda_array_interface__ plus .shape/.dtype; there is no .nbytes, so get the compressed size via int(np.prod(compressed.shape)) * compressed.dtype.itemsize (dtype is uint8, so this is just compressed.shape[0]) rather than compressed.nbytes. Passing it straight into decode() needs no conversion — decode() reads it via the same cudamalloc domain either way. decode(), by contrast, honors the domain of the out buffer you pass in — a device-resident out (CuPy, etc.) keeps the result on the GPU; a NumPy out (or None) copies back to host, as in Quick Start above:
test/test_fzgm_python.py's GPU-resident-round-trip checks cover this without requiring CuPy (a minimal __cuda_array_interface__ wrapper via ctypes + libcudart stands in).
Constraints: only contiguous, unmasked, interface-version-3 arrays — strided or masked device arrays raise NotImplementedError. Compression still stages through the plugin's own cudamalloc domain either way; a different CUDA context's pointer, or a pointer libpressio's domain manager can't otherwise reach, would fail rather than silently copy.
PressioCompressor.from_config takes a dict with three sections:
Per-stage keys like fzgpumodules:s0:quant_radius do not exist until the stages list has been processed. Anything that creates those keys must go in early_config.
decode needs a pre-allocated output buffer (second argument) to know the output shape and dtype:
| Option | Type | Default | Description |
|---|---|---|---|
| pressio:abs | double | 1e-3 | Absolute error bound |
| pressio:rel | double | 1e-3 | Relative error bound (corresponds to noa to fzgpumodules) |
| fzgpumodules:error_bound_mode | str | "abs" | "abs", "rel", "noa", or "prel". On predictor stages "rel" warns and maps to "prel"; only QuantizerStage honours exact "rel". |
| fzgpumodules:stages | list[str] | ["lorenzo:float:uint16", "diff:uint16"] | Ordered stage tokens |
| fzgpumodules:connections | list[str] | ["s1 <- s0:codes"] | Stage wiring strings (__external__ sentinel: see below) |
| fzgpumodules:primary_source | str | "" | Stage id whose reconstruction decode returns; only needed with a __external__ connection (see SPERR recipe) |
| fzgpumodules:dims | list[int] | [0, 1, 1] | Spatial dims [nx, ny, nz]; nx=0 infers 1-D |
| fzgpumodules:memory_strategy | str | "minimal" | "minimal" or "preallocate" |
| fzgpumodules:memory_multiplier | float | 3.0 | GPU pool size multiplier |
| fzgpumodules:num_streams | int | 1 | Parallel CUDA streams |
| fzgpumodules:specialization | str | "off" | "off" or "auto" — Pipeline Specialization (see below) |
| fzgpumodules:config_file | str | "" | Path to TOML pipeline config file (see below) |
| fzgpumodules:expose_stage_outputs | bool | False | Expose terminal stage outputs as metrics after encode |
| Value | Meaning |
|---|---|
| ABS | Absolute error — abs(x_orig - x_recon) ≤ eb |
| REL | Exact point-wise relative bound, abs(error) / abs(x_orig) ≤ eb — honoured exactly only by QuantizerStage. On stages that quantize a fused prediction residual against one global tolerance (lorenzo:float:*/lorenzo:double:*, i.e. LorenzoQuantStage) it is a deprecated alias for PREL: the engine logs a warning and resolves it to PREL rather than failing, since it cannot honour an exact per-element bound there. |
| NOA | Value-range relative — abs(error) / value_range ≤ eb (norm-of-absolute), uses pressio:abs as the fraction |
| PREL | Pseudo-relative — abs_eb = eb * max(abs(data)), applied as a single absolute bound, uses pressio:abs as the fraction. This is the honest name for what REL silently did on fused prediction stages before the REL/PREL split; prefer it explicitly there to silence the deprecation warning. |
Note: pressio:abs doubles as the bound fraction for NOA and PREL (both are ABS-family bounds under the hood); pressio:rel is only read when error_bound_mode = "rel". See Fast and Effective Lossy Compression on GPUs and CPUs with Guaranteed Error Bounds for details on the error bound definitions and their implications for compression.
Stage IDs are assigned left-to-right from the stages list: s0, s1, s2, … Unconnected stage outputs become pipeline outputs and are included in the compressed buffer automatically.
__external__ is a reserved source name (not a stage id) for Pipeline::bindExternalInput() — it binds the untouched pipeline input to a specific stage port even when that stage also has other real connections (needed by cdf97_outlier_correct; see the SPERR recipe below). List it in connections at the position matching the port it should occupy, same as any other connection. When it creates more than one source stage in the pipeline, set fzgpumodules:primary_source (see Pipeline Options) to say which one's reconstruction decode should return.
Read metrics after each encode call:
To enable size and error metrics:
Full metrics reference:
| Key | Type | Description |
|---|---|---|
| fzgpumodules:peak_memory | int | Peak GPU memory in bytes |
| fzgpumodules:execution_time_us | int | Stream-synced device execution time (microseconds). Excludes host<->device staging and pipeline (re)build cost — see rebuilt below |
| fzgpumodules:rebuilt | bool | True if this encode() call (re)built the pipeline (first call, dirty options, or a changed input size in manual-pipeline mode) rather than reusing the cached one. execution_time_us excludes build time regardless — in a timing loop, discard measurements where this is true, or warm up first |
| fzgpumodules:sN:outlier_count | int | Outlier count for stage N (Lorenzo/Quantizer) |
| size:compression_ratio | float | Uncompressed / compressed size |
| size:compressed_size | int | Compressed size in bytes |
| error_stat:max_error | float | Maximum pointwise error |
The adapter's fzgpumodules:specialization option enables the retained CUDA Pipeline Specialization capability. off runs staged execution; auto installs admitted implementations where supported. Inspect installation diagnostics to confirm that a particular graph specialized. The former fzgpumodules:fusion key is rejected with a migration message, as is the former fzgpumodules:graph_mode key (CUDA Graph mode was removed from the library).
The validated Python workflow uses linear Quantizer → integer Lorenzo → AdaptiveBitpack with matching block sizes. This capability remains available in main; presentation scripts, dependency pins, environment preflight, and rehearsal material are preserved on development. They are not part of the stable package.
After encode(), get_metrics() exposes these additional diagnostics:
| Key suffix after fzgpumodules: | Meaning |
|---|---|
| specialization_forward_groups | Installed forward group count |
| specialization_inverse_groups | Installed inverse count; available after first decode() |
| specialization_forward_implementations | Forward implementation names |
| specialization_inverse_implementations | Inverse implementation names |
| specialization_fallback_reason | Empty on a forward installation; otherwise the library fallback reason |
These metrics require a v2-compatible adapter. Use the same compressor instance for encode and decode. This demo does not provide standalone decoder restoration or independently portable archive files.
Constraints:
Set fzgpumodules:expose_stage_outputs = True in early_config to retrieve intermediate pipeline data as numpy arrays after encode. All unconnected (terminal) output ports are exposed as metrics.
For multi-stage pipelines only unconnected outputs are exposed:
Load a pipeline from a TOML file instead of specifying stages and connections inline. The file controls stages, connections, dims, and error bounds.
No early_config is needed — the TOML file bootstraps per-stage key registration.
Example TOML:
See Config file reference for the full TOML format and stage type names.
Per-stage outlier count metrics (fzgpumodules:sN:outlier_count) are not available in config-file mode.
encode and decode raise libpressio.PressioException on failure:
Common causes: