Compression Modes

The compression mode of ZFP algorithm must be specified by 4 parameters included in zfp_compressed_stream structure (see structure description). This approach allows implementation to meet various constraints on the precision and size of the output. The description of these parameters is given below:

  • zfp_compressed_stream.maxbits - The maximum number of compressed bits used to represent a block. This parameter sets the hard upper bound on compressed block size, and governs the rate in fixed-rate mode. It may also be used as an upper storage limit to prevent implementation from buffer overruns in combination with the accuracy constraints given by zfp_compressed_stream.maxprec and zfp_compressed_stream.minexp.

  • zfp_compressed_stream.minbits - The minimum number of compressed bits used to represent a block. It is recommended to set this parameter to one bit, unless each block is to be stored using a fixed number of bits to facilitate random access (in this case it must be set to the same value as zfp_compressed_stream.maxbits).

  • zfp_compressed_stream.maxprec - The maximum number of bit planes encoded. This parameter governs the number of most significant uncompressed bits encoded per transform coefficient. This parameter specifies the precision in fixed-precision mode, as well as provides a mechanism for controlling the relative error.

  • zfp_compressed_stream.minexp - The smallest absolute bit plane number encoded. The place value of each transform coefficient bit depends on the common floating-point exponent, e, that scales the integer coefficients. If the most significant coefficient bit has place value 2e, then the number of bit planes encoded is (one plus) the difference between e and zfp_compressed_stream.minexp.

The oneDTL library interface must allow user to choose 1 of 4 compression modes:

enum oneapi::dtl::data_compression::zfp_mode

Compression mode.

Values:

enumerator expert

Expert mode. All comression parameters are user defined.

enumerator fixed_accuracy

Fixed accuracy mode. With defined by user error.

enumerator fixed_precision

Fixed precision mode. With defined by user number of bit planes.

enumerator fixed_rate

Fixed rate mode. With defined compresed block size.

For now, only the fixed-rate mode is implemented. fixed-precision mode has only a public interface but has no implementation.

Fixed-rate Compression Mode

In fixed-rate mode, each d-dimensional compressed block of 4d values must be stored using a fixed number of bits given by parameters zfp_compressed_stream.maxbits and zfp_compressed_stream.minbits. oneDTL library provides a structure for specifying this mode:

template<typename DataT, std::uint32_t Dimension>
struct oneapi::dtl::data_compression::zfp_fixed_rate

Structure for fix rate compression mode initialization.

tparam DataT

field data type (supported types: float)

tparam Dimension

dimension of field (supported value: 3)

Public Functions

zfp_fixed_rate(double rate)

Constructs a new object to zfp fix rate compresson mode.

Parameters

rate – mean number compressed bits per value

Public Members

zfp_mode mode

Current fixed rate compression mode.

std::uint32_t bits

Number of maximum and minimum bits per block.

Accordingly, the compression parameters will be as follows:

minbits = maxbits = ((1 << (2 * d)) * rate) + 0.5
maxprec = ZFP_MAX_PREC
minexp = ZFP_MIN_EXP

Fixed-precision Compression Mode

In fixed-precision mode, the number of bits used to encode a block may vary, but the number of bit planes (i.e., the precision) encoded for the transform coefficients must be fixed. Fixed-precision mode is recommended when relative rather than absolute errors matter. oneDTL structure for specifying this mode:

struct oneapi::dtl::data_compression::zfp_fixed_precision

Structure for fix precision compression mode initialization.

Public Functions

inline zfp_fixed_precision(const unsigned int bits)

Constructs a new object to zfp fixed presision compresson mode.

Parameters

bits – the maximum number of bit planes encoded

Public Members

zfp_mode mode

Current fixed precision compressed mode.

std::uint32_t maxprec

The maximum number of bit planes encoded.

And compression parameters looks like:

minbits = ZFP_MIN_BITS
maxbits = ZFP_MAX_BITS
maxprec = zfp_fixed_precision.maxprec
minexp = ZFP_MIN_EXP

Default Compression Parameter Settings

The default recommended compression parameter settings that impose no constraints:

ZFP_MAX_BITS = 16658
ZFP_MIN_BITS = 1
ZFP_MAX_PREC = 64
ZFP_MIN_EXP = -1074