Skip to content
J. Tian edited this page Oct 17, 2022 · 1 revision

Currently high-level compressor API is provided. An API call exmaple is given in example/src/ in two forms: capi.cc and capi.cu. The former can be compiled and linked using a proper host compiler like gcc, and the latter nvcc only. The synopsis is shown below,

#include "cusz.h"
// ...
cusz_framework* framework = cusz_default_framework();

cusz_compressor* comp       = cusz_create(framework, FP32);
cusz_config*     config     = new cusz_config{.eb = 2.4e-4, .mode = Rel};
// x, y, z, w and the padding factor (slightly > 1.00)
cusz_len         uncomp_len = cusz_len{3600, 1800, 1, 1, 1.03}; 
cusz_len         decomp_len = uncomp_len;

// compression outputs
cusz_header header;
uint8_t*    exposed_compressed;
uint8_t*    compressed;
size_t      compressed_len;

// compress
cusz_compress(comp, config, d_uncompressed, uncomp_len, &exposed_compressed, &compressed_len, &header, (void*)&compress_timerecord, stream);

// ... copy to other buffer if needed

// decompress (using the same GPU internal buffer)
cusz_decompress(comp, &header, exposed_compressed, compressed_len, d_decompressed, decomp_len, (void*)&decompress_timerecord, stream);
Clone this wiki locally