Intel® oneAPI Data Analytics Library
Learn from community members on how to build compute-intensive applications that run efficiently on Intel® architecture.

zlib

ink
Beginner
1,109 Views

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
1,109 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.

0 Kudos
ink
Beginner
1,108 Views

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

0 Kudos
Zhang_Z_Intel
Employee
1,108 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.

 

0 Kudos
ink
Beginner
1,109 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)

0 Kudos
Vladislav_V_Intel
1,108 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.

0 Kudos
ink
Beginner
1,109 Views

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

0 Kudos
Reply