{"id":50138762,"url":"https://github.com/pc2/pernix","last_synced_at":"2026-05-24T00:02:43.694Z","repository":{"id":334079500,"uuid":"1139708184","full_name":"pc2/pernix","owner":"pc2","description":"SIMD-optimized compression and decompression of floating-point numbers","archived":false,"fork":false,"pushed_at":"2026-05-19T19:49:51.000Z","size":337,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-19T20:45:18.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pc2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-22T10:05:36.000Z","updated_at":"2026-05-03T20:50:16.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pc2/pernix","commit_stats":null,"previous_names":["pc2/pernix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pc2/pernix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc2%2Fpernix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc2%2Fpernix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc2%2Fpernix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc2%2Fpernix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pc2","download_url":"https://codeload.github.com/pc2/pernix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pc2%2Fpernix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33416315,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"ssl_error","status_checked_at":"2026-05-23T22:14:43.778Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-24T00:02:40.774Z","updated_at":"2026-05-24T00:02:43.679Z","avatar_url":"https://github.com/pc2.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PERNIX: Floating-Point Number De/Compression on CPUs\nPERNIX is a high-throughput floating-point compression library for CPU-based scientific workloads. It quantizes floating-point values to a configurable bit width and packs them into fixed-size blocks, reducing memory and communication bandwidth while keeping decompression fast.\n\nThe library provides:\n\n* C++ template API (`pernix::compress_block`, `pernix::decompress_block`)\n* C ABI wrappers (`compress_block`, `decompress_block`, and `_f64` variants)\n* Fortran bindings in `bindings/fortran`\n* SIMD-optimized backends (AVX2, AVX-512 VBMI, BMI2) with fallback implementations\n\nCompression of floating-point numbers $x_i$ to $N$-bit quantized numbers with scale $\\varepsilon$ (M. Guidon, F. Schiffmann, J. Hutter and J. VandeVondele, The Journal of Chemical Physics, 2008, 128, 214104):\n\n$$b_{\\max} = \\max\\left(\\lvert x_i \\rvert\\right) \\quad \\quad  \\varepsilon = \\frac{b_{\\max}}{2^{N-1}-1}$$\n\n$$x_{i,N} = \\mathrm{ANINT}\\left(x_i\\cdot\\varepsilon^{-1}\\right)$$\n\nPERNIX is block-based and uses 64-byte (512-bit) compressed blocks by default. For a bit width `N`, each block stores `(64 * 8) / N` values.\n\n## Compiling\n1. clone repository `git clone https://github.com/pc2/pernix`\n2. build with CMake:\n    * `cmake -E make_directory \"build\"`\n    * `cmake -E chdir \"build\" cmake -DCMAKE_BUILD_TYPE=Release -DPERNIX_ENABLE_TESTS=off ../`\n    * `cmake --build \"build\" --config Release`\n3. `libpernix.so` will be in `build/src`\n\nTo enable Fortran bindings, configure with `-DPERNIX_ENABLE_FORTRAN_BINDINGS=ON`.\n\n## Usage Examples\n\n### C++ API example (single block)\n\n```cpp\n#include \u003calgorithm\u003e\n#include \u003carray\u003e\n#include \u003ccmath\u003e\n#include \u003ccstdint\u003e\n#include \u003cpernix/pernix.h\u003e\n\nint main() {\n    constexpr uint8_t BIT_WIDTH = 16;\n    constexpr uint32_t BLOCK_SIZE = 64;\n    constexpr size_t ELEMENTS = (BLOCK_SIZE * 8) / BIT_WIDTH; // 32 values for 16-bit\n\n    std::array\u003cfloat, ELEMENTS\u003e input{};\n    for (size_t i = 0; i \u003c ELEMENTS; ++i) {\n        input[i] = std::sin(static_cast\u003cfloat\u003e(i));\n    }\n\n    float bmax = 0.0f;\n    for (float x : input) {\n        bmax = std::max(bmax, std::abs(x));\n    }\n    const float scale = bmax / ((1u \u003c\u003c (BIT_WIDTH - 1)) - 1u);\n\n    std::array\u003cuint8_t, BLOCK_SIZE\u003e compressed{};\n    std::array\u003cfloat, ELEMENTS\u003e restored{};\n\n    if (pernix::compress_block\u003cBIT_WIDTH, BLOCK_SIZE\u003e(input.data(), scale, compressed.data()) != 0) {\n        return 1;\n    }\n    if (pernix::decompress_block\u003cBIT_WIDTH, true, BLOCK_SIZE\u003e(compressed.data(), scale, restored.data()) != 0) {\n        return 1;\n    }\n    return 0;\n}\n```\n\n### C ABI example (single block)\n\n```c\n#include \u003cmath.h\u003e\n#include \u003cstdint.h\u003e\n#include \u003cpernix/pernix.h\u003e\n\nint main(void) {\n    const uint8_t bit_width = 16;\n    float input[32];\n    uint8_t compressed[64];\n    float restored[32];\n    float scale = 1.0f;\n\n    for (int i = 0; i \u003c 32; ++i) {\n        input[i] = sinf((float)i);\n    }\n\n    if (compress_block(bit_width, input, scale, compressed) != 0) {\n        return 1;\n    }\n    if (decompress_block(bit_width, compressed, scale, restored) != 0) {\n        return 1;\n    }\n    return 0;\n}\n```\n\n### Fortran example (using bindings)\n\n```fortran\nprogram pernix_example\n    use iso_c_binding, only : c_int8_t, c_float, c_loc\n    use pernix_compression\n    use pernix_decompression\n    implicit none\n\n    integer(c_int8_t), parameter :: bit_width = 16_c_int8_t\n    real(c_float), parameter :: scale = 1.5_c_float\n    real(c_float), target :: input_data(32), output_data(32)\n    integer(c_int8_t), target :: compressed_data(64)\n    integer :: i\n\n    do i = 1, size(input_data)\n        input_data(i) = real(i, c_float)\n    end do\n\n    call compress_block(bit_width, c_loc(input_data), scale, c_loc(compressed_data))\n    call decompress_block(bit_width, c_loc(compressed_data), scale, c_loc(output_data))\nend program pernix_example\n```\n\nFor a complete Fortran binding setup, see `bindings/README.md` and `bindings/fortran/main.f90`.\n\n## Benchmarking\nA benchmark framework for PERNIX can be found at https://github.com/pc2/pernix-benchmark.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpc2%2Fpernix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpc2%2Fpernix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpc2%2Fpernix/lists"}