Zlib

Legacy data compression library - Consider using zlib-ng instead

Overview

Zlib is a general-purpose, lossless data-compression library. However, it is now considered legacy on Discoverer and clusters.

Warning

We strongly recommend using Zlib-ng with its compatibility mode (zlib-ng-compat) instead of zlib. Zlib-ng-compat provides:

  • Drop-in replacement for zlib
  • Significant performance improvements through SIMD optimizations
  • Automatic CPU feature detection and optimization
  • Full API compatibility with zlib

To switch to zlib-ng-compat, simply load its module instead of zlib:

$ module load zlib-ng-compat/<version>

Also, refer to the Zlib-ng documentation for more details.

Available versions

To view available zlib versions:

$ module load zlib

Build recipes and configuration details are maintained in our GitLab repository:

Compiler support

Each zlib version is built against multiple compiler sets, though we recommend using Zlib-ng instead.

Still supported builds (but soon to be retired):

$ module avail zlib/*/*llvm    # LLVM build
$ module avail zlib/*/*gcc     # GCC build

Retired builds (but still available in the public software repository):

$ module avail zlib/*/*intel   # Intel oneAPI build
$ module avail zlib/*/*nvidia  # NVIDIA HPC SDK build
$ module avail zlib/*/*aocc    # AMD AOCC build

Migration to zlib-ng

For dynamically linked programs:

$ module load zlib-ng-compat/<version>
$ ./your_program   # will automatically use libz.so from zlib-ng-compat installation

For programs requiring recompilation against the zlib-ng-compat library:

$ module load zlib-ng-compat/<version>
$ <compiler or linker> <flags> <source_files or object files> -lz

Note

The zlib-ng-compat provides the same API and ABI as zlib, making it a safe replacement with significant performance benefits through CPU-specific optimizations based on SIMD instructions.

Getting Help

For additional assistance: