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 Native API only — the standard low-level
batched API (nvcompBatchedBitcompCompressAsync) performs lossless
compression only.
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. Default.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 Native API supports a single scalar delta for all
data or per-batch delta values when different chunks need different
accuracy.
Native API#
The Native API exposes Bitcomp capabilities that the standard low-level API does not. Use it when you need:
Lossy floating-point compression (
bitcompCompressLossy_fp16/fp32/fp64and their batched variants).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).
Buffers compressed with the Native API can be decompressed by the
standard nvcompBatchedBitcompDecompressAsync function.
For a worked example of error-bounded lossy compression with the Native
API, see examples/bitcomp_native_lossy.cu. It creates a plan,
compresses FP32 data with a chosen delta, decompresses, and verifies
that the maximum reconstruction error stays within delta/2.
For the complete API, see the Bitcomp sections of the C API, C++ API, and Native API references.