MANS is a high-performance compression framework designed to make Asymmetric Numeral Systems (ANS) efficient and portable for multi-byte integer data across CPUs, NVIDIA GPUs, and AMD GPUs.
At the core of MANS is ADM (Adaptive Data Mapping) β a lightweight, distribution-aware transformation that maps 16/32-bit integers into a compact 8-bit domain, significantly improving both compression ratio and throughput while maintaining full numerical fidelity. β‘
This framework is tailored for high-volume scientific and HPC workloads such as photon science, large-scale simulations, and sensor-array pipelines, where multi-byte integer data is ubiquitous and processed in small slices. π¬π
(C) 2025 by Institute of Computing Technology, Chinese Academy of Sciences.
Developers: Wenjing Huang (Lead Developer, Designer of ADM), Jinwu Yang (CPU and GPU Implementations/Optimizations of Parallel ANS Encoders), Shengquan Yin (HIP Version of ANS Encoder)
Contributors: Dingwen Tao (Supervisor), Guangming Tan
-
π High-Efficiency Compression
Achieves up to 1.24Γ higher compression ratio than standard ANS and 2.37Γ higher than 16-bit Huffman. -
β‘ Cross-Platform High-Performance
Optimized for:- NVIDIA GPUs (CUDA)
- AMD GPUs (HIP/ROCm)
- Multi-core CPUs with OpenMP + SIMD
-
π§© Adaptive Data Mapping (ADM)
Converts multi-byte integers into effective 8-bit symbols with <1% overhead. -
π Flexible CPU Modes
- -p mode: portable, GPU-consistent ANS implementation
- -r mode: maximum compression ratio using FSE-ANS
-
π¦ Lightweight & Easy Integration
Minimal dependencies, C++17 compatible, and CMake-based build system.
MANS consistently delivers strong compression ratios across real-world scientific datasets:
- 2.37Γ higher compression ratio vs. FSE-ANS
- 1.32Γ higher compression ratio vs. 16-bit Huffman
- Up to 2.09Γ improvement on quantization-based datasets
- More stable performance on small slices compared to 16-bit Huffman
- 1.24Γ higher compression ratio than FSE-ANS
- Slightly lower than -r mode due to parallel ANS design
- Maintains consistency with GPU behavior
MANS provides strong, consistent performance across diverse platforms:
- 1.92Γ faster compression vs. FSE-ANS
- 2.04Γ faster decompression vs. FSE-ANS
- 45.14Γ faster compression vs. nvCOMP Huffman
- Up to 288.45Γ faster decompression compared to CPU portable mode
- Up to 90.42Γ faster compression and 135.86Γ faster decompression vs. CPU
- 0.52Γ CUDA compression throughput; 0.47Γ CUDA decompression throughput
- CMake β₯ 3.15
- C++17 compiler
- OpenMP (for CPU parallelization)
- CUDA 12.6 (for NVIDIA GPUs)
- ROCm (for AMD GPUs)
- Git
- Recommended OS: Ubuntu 22.04+
git clone https://github.com/ewTomato/MANS.gitBuild CPU and NVIDIA support with the cross-backend tests enabled:
cd MANS
cmake -S . -B build \
-DTARGET_PLATFORM=cpu_nv \
-DBUILD_TESTING=ON \
-DBUILD_HDF5_PLUGIN=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build build -jAvailable TARGET_PLATFORM values:
cpuβ CPU-only buildnvβ NVIDIA-only buildcpu_nvβ CPU + NVIDIA buildamdβ AMD-only buildcpu_amdβ CPU + AMD buildcpu_dcuβ CPU + DCU build with CPU/DCU interoperability testsdcuβ standalone DCU build (HIP ADM and codec=1 P-mode ANS; no CPU/OpenMP dependency)allβ CPU + NVIDIA + AMD build
The NVIDIA cross-backend test target is built when both BUILD_TESTING=ON and CPU/NVIDIA support are enabled.
DCU builds use the DTK HIP compiler (hipcc or its dcc driver). The standalone TARGET_PLATFORM=dcu build contains HIP ADM and the CPU-compatible codec=1 P-mode ANS implementation and does not require the CPU backend, CPU PANS, or OpenMP. Use TARGET_PLATFORM=cpu_dcu when building the CPU/DCU interoperability test suite. Set the architecture supported by your DCU. DCU_HIPCUB_INCLUDE_DIR is optional and is only needed when hipCUB headers are not found by the compiler by default. DCU_HIP_FLAGS can pass additional DTK compiler flags.
cmake -S . -B build \
-DTARGET_PLATFORM=dcu \
-DDCU_HIP_COMPILER=/path/to/DTK/bin/hipcc \
-DDCU_HIP_ARCH=gfx936 \
-DBUILD_TESTING=ON \
-DBUILD_HDF5_PLUGIN=OFF \
-DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build --output-on-failureIf the DTK installation does not expose hipCUB headers automatically, add -DDCU_HIPCUB_INCLUDE_DIR=/path/to/hipcub/include to the configure command. Some DTK installations also need the host GCC C++ standard-library include paths passed via DCU_HIP_FLAGS; if configuration fails with fatal error: 'cmath' file not found, add the paths for the GCC version installed on your system. For example, on a system using GCC 11:
-DDCU_HIP_FLAGS="-isystem /usr/include/c++/11 -isystem /usr/include/x86_64-linux-gnu/c++/11 -isystem /usr/include/c++/11/backward -L/usr/lib/gcc/x86_64-linux-gnu/11"Adjust those paths to match the host compiler and include this option in the initial cmake configure command. The DCU command-line programs are written under build/bin/dcu as build/bin/dcu/dcu_mans_compress and build/bin/dcu/dcu_mans_decompress, alongside the CPU executables under build/bin/cpu; DCU test executables remain under build/tests.
With TARGET_PLATFORM=cpu_dcu and BUILD_TESTING=ON, the DCU suite includes the CPU/DCU P-mode cross-backend test, which checks CPU-compress/DCU-decompress and DCU-compress/CPU-decompress paths. Standalone TARGET_PLATFORM=dcu builds the DCU executables without that CPU-dependent test.
MANS exposes complete MANS streams through cpu_mans_compress, cpu_mans_decompress, nv_mans_compress, and nv_mans_decompress. A complete stream has the following layout:
[MansHeader][PANS/ANS payload]
The header records the codec, mode, raw byte count, and effective 1D/2D/3D geometry. ADM uses block-level decisions: each block independently selects ADM or RAW according to range < 3500.
-u2 selects unsigned 16-bit input and -u4 selects unsigned 32-bit input. Use --dims to describe the logical shape; the product of the dimensions must equal the number of input elements.
CPU P-mode compression:
./build/bin/cpu/cpu_mans_compress \
-u2 input.u2 output.mans \
--mode p --dims 17 17CPU decompression:
./build/bin/cpu/cpu_mans_decompress \
-u2 output.mans restored.u2NVIDIA compression:
./build/bin/nv/nv_mans_compress \
-u2 input.u2 output.cuda.mans \
--mode p --dims 17 17NVIDIA decompression:
./build/bin/nv/nv_mans_decompress \
-u2 output.cuda.mans restored.cuda.u2The complete streams are interoperable in P mode:
# CPU-compressed stream decoded by NVIDIA
./build/bin/nv/nv_mans_decompress \
-u2 output.mans restored-by-cuda.u2
# NVIDIA-compressed stream decoded by CPU
./build/bin/cpu/cpu_mans_decompress \
-u2 output.cuda.mans restored-by-cpu.u2NVIDIA currently supports P mode only. CPU R mode remains available for CPU-only compression and decompression, but R-mode streams are not accepted by the NVIDIA backend.
cpu_mans_autotune generates synthetic u16 datasets internally and sweeps all three mappings (dims=1/2/3) in one run.
- data-size list is configurable by
--data-size-mb-list - output CSV contains a
dimscolumn
- Run autotune and generate thread CSV:
./build/bin/cpu/cpu_mans_autotune \
--data-size-mb-list 0.00390625,0.0078125,1,4 \
--csv ./build/thread_sweep.csv --out ./build/best_threads.csvOptional: control synthetic block-type ratios (smooth/spike/constant/random):
./build/bin/cpu/cpu_mans_autotune \
--ratio-smooth 1.0 --ratio-spike 0.0 --ratio-constant 0.0 --ratio-random 0.0- Run bench without
--threads; it auto-loads CSV and selects nearest thread config by input size:
cd build
./bin/cpu/cpu_mans_bench -u2 /path/to/input_u16.bin --mode r --dims 1 134217728 --csv bench.csvAuto-load order:
MANS_THREAD_CSVenv var (if set)- otherwise
best_threads.csvin current working directory
Debug warning for ADM bypass:
MANS_WARN_IF_NO_ADM=1 ./bin/cpu/cpu_mans_bench -u2 /path/to/input_u16.bin --mode r --dims 1 134217728The standalone ADM and ANS targets are useful for component-level benchmarking. They do not replace the complete MANS API flow above and should not be used when testing CPU/NVIDIA stream interoperability.
AMD ADM/ANS tools remain separate component-level targets. The complete CPU/NVIDIA P-mode interoperability described above applies to the cpu_nv build; AMD support follows its own HIP pipeline.
Run the CPU/NVIDIA P-mode interoperability test after building with -DBUILD_TESTING=ON:
ctest --test-dir build --output-on-failureThe test covers:
- CPU compression -> NVIDIA decompression;
- NVIDIA compression -> CPU decompression;
- U16 and U32 data;
- 1D, 2D, and 3D shapes;
- partial 1D blocks and non-aligned 2D/3D tiles;
- block-level ADM and RAW decisions;
- ANS block boundaries and representative constant, narrow-range, wide-range, and random data.
For CUDA memory checking:
compute-sanitizer --tool memcheck \
build/tests/mans_cross_backend_testSee tools/H5Z-MANS/README.md for detailed instructions on building and using the HDF5 filter plugin for MANS.
MANS/
βββ amd/ # ADM, ANS, GPU kernels(AMD version)
βββ build/ # CMake build directory (generated by user)
βββ cpu/ # ADM, PANS(CPU version)
βββ nv/ # ADM, ANS, GPU kernels(NVIDIA version)
βββ testdata/
βββ tools/ # test scripts and tools(hdf5 filter)
βββ README.md
...
MANS is released under the MIT License.
Please see the LICENSE file for full details.
If you use MANS in your research or software, please cite our work:
@inproceedings{huang2025mans,
title={MANS: Efficient and Portable ANS Encoding for Multi-Byte Integer Data on CPUs and GPUs},
author={Huang, Wenjing and Yang, Jinwu and Yin, Shengquan and Li, Haoxu and Gu, Yida and Liu, Zedong and Jing, Xing and Wei, Zheng and Fu, Shiyuan and Hu, Hao and others},
booktitle={Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis},
pages={1299--1314},
year={2025},
DOI={10.1145/3712285.3759825}
}
More details and related materials will coming soon.

