https://github.com/murrellgroup/bitpacking.jl
Fast, device-agnostic bitpacking in Julia
https://github.com/murrellgroup/bitpacking.jl
array bitpacking
Last synced: 3 months ago
JSON representation
Fast, device-agnostic bitpacking in Julia
- Host: GitHub
- URL: https://github.com/murrellgroup/bitpacking.jl
- Owner: MurrellGroup
- License: mit
- Created: 2025-09-08T13:32:23.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-09-17T09:29:19.000Z (9 months ago)
- Last Synced: 2025-10-21T11:58:36.940Z (7 months ago)
- Topics: array, bitpacking
- Language: Julia
- Homepage: https://murrellgroup.github.io/BitPacking.jl/
- Size: 243 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BitPacking.jl
[](https://MurrellGroup.github.io/BitPacking.jl/stable/)
[](https://MurrellGroup.github.io/BitPacking.jl/dev/)
[](https://github.com/MurrellGroup/BitPacking.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/MurrellGroup/BitPacking.jl)
BitPacking.jl is a Julia package that implements bitpacking and unpacking arrays with element bit-widths from 1 to 8, imposing mild size limitations on the first dimension. Bitpacking methods are designed to be device-agnostic, meaning they run fast on GPUs.
## Usage
```julia
using BitPacking
x = rand(UInt8, 32) .& 0b1111 # 4-bit unpacked values
y = bitpacked(x, 4) # half the memory size
x == y == bitunpacked(y) # true
# broadcasting assignment works
y .= rand(UInt8, 32) .& 0b1111 # assign new values
```
## Limitations
- The first dimension of the input array must currently be divisible by the least common multiple of 8 and the bitwidth.
- Broadcasting assignment first materializes the unpacked result.
## Installation
```julia
using Pkg
Pkg.add("BitPacking")
```
## Acknowledgements
BitPacking.jl is partially inspired by [IntArrays.jl](https://github.com/bicycle1885/IntArrays.jl)