Skip to main content

CompIntPy

A Python library for compressing integers with variable-length Elias compression algorithms (universal codes). The library was designed for compressing indices of weight matrices in decentralised machine learning. Hence, it supports multithreading for faster encoding of indices to speed up the distribution of the data to neighbouring nodes.

Supported Algorithms

The library implements the Elias gamma, delta, and omega algorithms. An example for EliasGamma is given below (Replace Gamma with your respective choices):

arr = np.array([0, -1, 2, -5, 8], dtype=np.int64)
eg = EliasGamma(offset=1, map_negative_numbers=True)
comp = eg.compress(arr)
uncomp = eg.decompress(output, arr.size, output_dtype=np.int64)

Installation

For Linux the project is available via pip:

pip install compintpy

Or, install it from the GitHub repository:

git clone --recursive https://github.com/JeffWigger/compintpy.git
cd compintpy
pip install .

Documentation

All three algorithms are available as Python objects: comppy.elias.EliasGamma, comppy.elias.EliasDelta, and comppy.elias.EliasOmega. They are all subclasses of the follwing class:

class comppy.elias.Elias(offset: int = 0, map_negative_numbers: bool = False)
    """ Abstract base class of all Elias compression implementations.""""
    abstract compress(array: ndarray) → ndarray
        """ Abstract method defining the compression method used by all Elias implementations.
            Parameters:
                array (np.ndarray) – Array to be compressed. The array must be of types Union[np.int64, np.uint64, np.int32, np.uint32].
        """
    abstract decompress(array: ndarray, output_length: int, output_dtype: int64 | uint64 | int32 | uint32) → ndarray
        """Abstract method defining the decompression method used by all Elias implementations.
            Parameters:
                array (np.ndarray) – Numpy array containing data compressed with an Elias algorithm. The dtype must be np.uint8.
                output_length (int) – Length of the decompressed output.
                output_dtype (Union[np.int64, np.uint64, np.int32, np.uint32]) – Dtype of the output array.
        """"

Multi-threading

The compress function is parallelized with OpenMP. You can set the number of threads by setting the OMP_NUM_THREADS environment variable, e.g.,

export OMP_NUM_THREADS=10

Bindings

This library binds the high-performance C++ code from our sister Project ComIntC.

Metadata

Release files for compintpy 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compintpy 0.0.5
File Size Uploaded
compintpy-0.0.5.tar.gz 260.0 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for compintpy 0.0.5
File
compintpy-0.0.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
compintpy-0.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
compintpy-0.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
compintpy-0.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details

Total release size: 1.1 MB

Release files / compintpy-0.0.5.tar.gz

Download URL compintpy-0.0.5.tar.gz
Size 260.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9663bc6eafeefd1aac8efeaa747cf88c64ed452b4f60c430f7447c73931bcc92
BLAKE2b-256 checksum
How to use checksums
14dc7841a33a076c3c837fe10a917af6d4ed77ec3a9a17c746f3aedd7c7df4e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / compintpy-0.0.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL compintpy-0.0.5-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 218.3 kB
Tags CPython 3.14 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
f929f413114a924fc0fcd4be097fa30a953336cc0982c63152fe21b9cde46557
BLAKE2b-256 checksum
How to use checksums
9330ef3ccebcfd7ad856ed77ff7e8ac28f261dbd06752d4b7438dbe9f3b44919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / compintpy-0.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL compintpy-0.0.5-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 218.1 kB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
44de55e325d34900ceda25ff6ff46f363c560c6ba765a1b0e9f386e3e7790802
BLAKE2b-256 checksum
How to use checksums
6b57f80e05d85dc72ad779711c20aa306b2d2daaf38946b11fa936012c8e7605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / compintpy-0.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL compintpy-0.0.5-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 218.1 kB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
4df8d1ba5e2ad30b0cac8082186126ef4515a4e267a98e56a95e7ab1c69dff5a
BLAKE2b-256 checksum
How to use checksums
74d8df40198fc4c26a5718a8e18899c2655026eb2e23e3fc26836787b5067f62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / compintpy-0.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL compintpy-0.0.5-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 219.1 kB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ec91d8432e532826e2df83fc5a27da633c86a0f29708282bda380d8b8957fb0f
BLAKE2b-256 checksum
How to use checksums
3e37d983ca74f4d59bc53f5ef5b5b30689339509963eee846b023398962a6d51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

0.0.5 This release

5 release files

0.0.4

6 release files

0.0.3

6 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page