Bitcomp Compression#
Bitcomp is a proprietary NVIDIA compressor designed for efficient GPU compression of scientific computing floating-point data. It offers different compression modes, as well as error-bounded lossy compression. It is best suited for smooth or sparse data.
Algorithm Modes#
The low-level API selects the mode through the algorithm field of
nvcompBatchedBitcompCompressOpts_t:
Value |
Mode |
When to Use |
|---|---|---|
|
Default |
General numeric data. Usually gives the best compression ratio. This is the default. |
|
Sparse |
Data that clusters around 0. Usually faster than the default algorithm and compresses sparse data well. |
Choosing a mode: start with the default (0) for dense numeric
data. Switch to the sparse algorithm (1) when a significant fraction
of your values cluster around zero — it is both faster and well-suited
to that distribution. Because the right choice depends on your data,
benchmark both modes on a representative sample.
Lossy Compression#
Bitcomp can trade exactness for a higher compression ratio on
floating-point data (FP16, FP32, FP64). Lossy compression is
available through the C, C++ and Python APIs using the mode and
delta fields.
How it works#
Lossy compression is based on quantization. As a result:
The maximum error between a decompressed value and the original is
<= delta/2.deltais rounded down to the nearest power of two (no mantissa), so the error bound is exact.NaN,+Inf,-Inf, and values that would overflow quantization (large inputs with a very smalldelta) are handled correctly.
You choose how the quantized integers are stored via the compression mode:
BITCOMP_LOSSY_FP_TO_SIGNED— quantize to signed integers.BITCOMP_LOSSY_FP_TO_UNSIGNED— quantize to unsigned integers. Only use if you are certain all of your data is positive.
Choosing delta#
delta sets the accuracy/ratio trade-off: a larger delta yields a
higher compression ratio but a larger maximum error. Pick the largest
delta your application can tolerate, where the acceptable error is
delta/2. The scalar delta applies to every chunk in a
compression batch. It must remain finite, positive, and normal after
conversion to the selected input type; values that are zero, subnormal,
infinite, or NaN are rejected. delta is ignored in lossless
mode.
Native API#
The Native API provides specialized single-buffer capabilities such as:
Partial decompression — decompress only a byte range of a chunk via
bitcompPartialUncompress.Host-side (de)compression (the
bitcompHost*functions).Massively parallel single-chunk (de)compression (
bitcompCompress*andbitcompUncompressfunctions).
For a worked example of the plan-based single-buffer interface, see
examples/bitcomp_native_lossy.cu.
For the complete API, see the Bitcomp sections of the C API, C++ API, and Native API references.