Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ink
Beginner
84 Views

zlib

I'm confused, is there supposed to be zlib in DAAL or not? I was expecting to find the Intel fork of zlib there.

0 Kudos
6 Replies
Zhang_Z_Intel
Employee
84 Views

DAAL does support zlib, among other popular data compression methods. DAAL has a general data compression/decompression API that you can specialize using a particular algorithm that you choose. For example, this is how you would use zlib with DAAL:

    /* Create compressor */
    Compressor<zlib> compressor;
    compressor.parameter.gzHeader = true;
    compressor.parameter.level = level9;
    /* Create stream for compression */
    CompressionStream comprStream(&compressor);
    /* Write raw data to compression stream and compress if needed */
    comprStream << rawData;
    /* Get size of compressed data */
    compressedData.setSize(comprStream.getCompressedSize());
    /* Allocate memory to store compressed data */
    compressedData.setPtr(new byte[compressedData.getSize()]);
    /* Store compressed data */
    comprStream.copyCompressedArray(compressedData);
    /* Create compressor */
    Decompressor<zlib> decompressor;
    decompressor.parameter.gzHeader = true;
    /* Create stream for decompression */
    DecompressionStream deComprStream(&decompressor);
    /* Write compressed data to decompression stream and decompress it */
    deComprStream << compressedData;
    /* Get size of decompressed data */
    deCompressedData.setSize(deComprStream.getDecompressedSize());
    /* Allocate memory to store decompressed data */
    deCompressedData.setPtr(new byte[deCompressedData.getSize()]);
    /* Store decompressed data */
    deComprStream.copyDecompressedArray(deCompressedData);
    /* Compute and print checksums for raw data and decompressed data */
    printCRC32();
    releaseMemory();

You can find more examples in the "examples" directory of your DAAL installation. You can find more details of data compression/decompression API from the User and Reference Guide of Intel DAAL, in the "documentation" directory of your installation.

ink
Beginner
84 Views

Thanks, I was thinking more along the lines of linking against DAAL instead of zlib. So this cannot be done, right?

Zhang_Z_Intel
Employee
84 Views

ink wrote:

Thanks, I was thinking more along the lines of linking against DAAL instead of zlib. So this cannot be done, right?

You actually do link against DAAL instead of zlib. The essential algorithm of zlib is already built into DAAL and exposed with DAAL API. You don't need a separate zlib library .

Maybe, I misunderstood your question. Can you please elaborate your use case?

Thanks.

 

ink
Beginner
84 Views

What I'm asking is if one can use DAAL to link a code which requires zlib. That is instead of

gcc source.c -o source -lz 

do something like

icc source.c -o source -L/opt/intel/compilers_and_libraries_2016.0.056/linux/daal/lib/intel64_lin -ldaal_core -ldaal_thread

(which I can't)

84 Views

Intel® DAAL incorporates ZLIB in-memory compression and decompression functionality optimized for Intel CPUs but doesn’t provides public ZLIB API’s, only DAAL C++ & Java API. Thus, the application that uses ZLIB API cannot be just re-linked against Intel® DAAL instead of Zlib library.

ink
Beginner
84 Views

Thanks, that's exactly what I was asking to confirm.