Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental igzip #182

Merged
merged 30 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
d84eeb8
Initial prototype [skip ci]
milesgranger Sep 20, 2024
c2e158a
Add updated benchmarks for igzip impl
milesgranger Sep 22, 2024
6c54636
Pending impl of write En/Decoder for igzip and updating tests [skip ci]
milesgranger Sep 22, 2024
fae7b1f
Add De/Compressors, igzip testing
milesgranger Sep 23, 2024
e24d1b8
Use updated libcramjam and CI
milesgranger Sep 23, 2024
91c1e61
debugging - just windows failing?
milesgranger Sep 23, 2024
263723a
fixup: refactor
milesgranger Sep 23, 2024
c7b7120
Try again after some adjustments - everything sad except OSX builds
milesgranger Sep 23, 2024
893b182
debugging
milesgranger Sep 23, 2024
d182ecf
remove line break slashes
milesgranger Sep 23, 2024
f5816d6
try again - maybe just need to copy blosc2 setup with using system libs
milesgranger Sep 23, 2024
9aba45d
Try using isal system prebuilt lib like blosc2
milesgranger Sep 23, 2024
0c9ea58
Fix feature gates for igzip
milesgranger Sep 23, 2024
0603de8
try to fix windows
milesgranger Sep 24, 2024
b08208b
another try
milesgranger Sep 24, 2024
b67c6fe
Try update isal
milesgranger Sep 24, 2024
ec0782d
That worked, try to auto disable isal on 32bit
milesgranger Sep 24, 2024
c47b868
Conditionally include igzip if 64bit sys
milesgranger Sep 24, 2024
3d6a445
Another run after updating libcramjam
milesgranger Sep 24, 2024
5a87fb8
Another run after updating libcramjam
milesgranger Sep 24, 2024
adda7bb
fix build maybe
milesgranger Sep 24, 2024
2de5c38
Add back all builds
milesgranger Sep 24, 2024
549eb1e
fixup
milesgranger Sep 24, 2024
15887fa
Debug failing builds now...bleh
milesgranger Sep 24, 2024
26d52ef
Conditionally build isal in ci
milesgranger Sep 24, 2024
ef57287
Fixup: mk empty dir when on 32-bit
milesgranger Sep 24, 2024
ba5f6eb
Wrap up
milesgranger Sep 24, 2024
6182802
Fixup
milesgranger Sep 24, 2024
2af19fe
Try installing pre-built cross v0.2.5
milesgranger Sep 24, 2024
0a54f75
Revert back to specific install of cross
milesgranger Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
55 changes: 39 additions & 16 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,18 @@ jobs:
with:
target: ${{ matrix.conf.target-triple }}

- name: Install nasm (Windows / Linux)
if: runner.os != 'macOS'
uses: ilammy/setup-nasm@v1

- name: Set MSVC developer prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Setup (Mac)
if: runner.os == 'macOS'
run: |
brew install ninja
brew install ninja automake autoconf coreutils libtool nasm
echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV

- name: Setup (Windows)
Expand All @@ -105,22 +113,39 @@ jobs:
TARGET_TRIPLE: ${{ matrix.conf.target-triple }}
WORKSPACE: ${{ github.workspace }}
BLOSC2_INSTALL_PREFIX: ${{ github.workspace }}/blosc2
ISAL_INSTALL_PREFIX: ${{ github.workspace }}/isal
run: |
sudo apt update
sudo apt install ninja-build -y

echo "BLOSC2_INSTALL_PREFIX=$BLOSC2_INSTALL_PREFIX" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BLOSC2_INSTALL_PREFIX/lib:$BLOSC2_INSTALL_PREFIX/lib64" >> $GITHUB_ENV
echo "ISAL_INSTALL_PREFIX=$ISAL_INSTALL_PREFIX" >> $GITHUB_ENV

echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$BLOSC2_INSTALL_PREFIX/lib:$BLOSC2_INSTALL_PREFIX/lib64:$ISAL_INSTALL_PREFIX/lib:$ISAL_INSTALL_PREFIX/lib64" >> $GITHUB_ENV

# maturin action fails building blosc2 for armv7 and aarch64
# so we'll just use 'cross' to build and pass it in for the action for all archs
# nothing special for the revision pin, just deterministic install
cargo install cross --git https://github.com/cross-rs/cross --rev 6d097fb

# Build blosc2
cross build --release --target $TARGET_TRIPLE --package blosc2-sys --target-dir build
blosc2_sys_dir=$(ls build/$TARGET_TRIPLE/release/build/ | grep blosc2-sys)
mv $WORKSPACE/build/$TARGET_TRIPLE/release/build/$blosc2_sys_dir/out $BLOSC2_INSTALL_PREFIX
tree -L 2 $BLOSC2_INSTALL_PREFIX

# Build isal only on 64-bit systems
# At the time of this writing, it technically builds for all unix 32-bit systems
# but ISA-L has explicitly stated they're dropping support.
if [[ "$TARGET_TRIPLE" == armv7* || "$TARGET_TRIPLE" == i686* ]]; then
echo "Not building ISA-L on 32 bit target"
mkdir -p $ISAL_INSTALL_PREFIX
else
cross build --release --target $TARGET_TRIPLE --package isal-sys --target-dir build
isal_sys_dir=$(ls build/$TARGET_TRIPLE/release/build/ | grep isal-sys)
mv $WORKSPACE/build/$TARGET_TRIPLE/release/build/$isal_sys_dir/out $ISAL_INSTALL_PREFIX
tree -L 2 $ISAL_INSTALL_PREFIX
fi

- name: Rust Tests
if: matrix.conf.target == 'x86_64' && !startsWith(matrix.python-version, 'pypy') && matrix.python-version == '3.12'
run: cargo test
Expand All @@ -131,24 +156,22 @@ jobs:
with:
target: ${{ matrix.conf.target }}
manylinux: ${{ matrix.conf.manylinux }}
docker-options: -e BLOSC2_INSTALL_PREFIX=${{ github.workspace }}/blosc2 -e LD_LIBRARY_PATH=${{ github.workspace }}/blosc2/lib:${{ github.workspace }}/blosc2/lib64
args: -i ${{ matrix.python-version }} --release --out dist --features use-system-blosc2-static
before-script-linux: ls -l $BLOSC2_INSTALL_PREFIX
docker-options: |
-e BLOSC2_INSTALL_PREFIX=${{ github.workspace }}/blosc2
-e ISAL_INSTALL_PREFIX=${{ github.workspace }}/isal
-e LD_LIBRARY_PATH=${{ github.workspace }}/blosc2/lib:${{ github.workspace }}/blosc2/lib64:${{ github.workspace }}/isal/lib:${{ github.workspace }}/isal/lib64
args: -i ${{ matrix.python-version }} --release --out dist --features use-system-blosc2-static --features use-system-isal-static
before-script-linux: |
ls -l $BLOSC2_INSTALL_PREFIX
ls -l $ISAL_INSTALL_PREFIX

- name: Build wheel (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
python -m pip install maturin delvewheel

maturin build \
-i python \
--release \
--out wheels \
--target ${{ matrix.conf.target-triple }}

name=$(ls -1 wheels/ | head -n 1)
delvewheel repair -v wheels/$name -w dist
maturin build -i python --release --out wheels --target ${{ matrix.conf.target-triple }}
$file = Get-ChildItem -Path "wheels" | Select-Object -First 1
delvewheel repair -v "wheels\$($file.Name)" -w "dist"

- name: Build wheel (MacOS)
if: runner.os == 'macOS'
Expand Down
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ name = "cramjam"
crate-type = ["cdylib"]

[features]
default = ["extension-module", "snappy", "lz4", "bzip2", "brotli", "xz", "zstd", "gzip", "deflate", "blosc2"]
default = ["extension-module", "snappy", "lz4", "bzip2", "brotli", "xz", "zstd", "gzip", "deflate", "blosc2", "igzip"]
extension-module = ["pyo3/extension-module"]
generate-import-lib = ["pyo3/generate-import-lib"] # needed for Windows PyPy builds

Expand All @@ -28,6 +28,12 @@ xz = ["xz-static"]
xz-static = ["libcramjam/xz-static"]
xz-shared = ["libcramjam/xz-shared"]

igzip = ["igzip-static"]
igzip-static = ["libcramjam/igzip-static"]
igzip-shared = ["libcramjam/igzip-shared"]
use-system-isal-static = ["libcramjam/use-system-isal", "libcramjam/igzip-static"]
use-system-isal-shared = ["libcramjam/use-system-isal", "libcramjam/igzip-shared"]

gzip = ["gzip-static"]
gzip-static = ["libcramjam/gzip-static"]
gzip-shared = ["libcramjam/gzip-shared"]
Expand All @@ -47,7 +53,7 @@ wasm32-compat = ["libcramjam/wasm32-compat"]

[dependencies]
pyo3 = { version = "^0.22", default-features = false, features = ["macros"] }
libcramjam = { version = "0.4.6", default-features = false }
libcramjam = { version = "0.5.1", default-features = false }

[build-dependencies]
pyo3-build-config = "^0.22"
Expand Down
50 changes: 50 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[target.x86_64-unknown-linux-musl]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.x86_64-unknown-linux-gnu]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.s390x-unknown-linux-gnu]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.aarch64-unknown-linux-musl]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.aarch64-unknown-linux-gnu]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.powerpc64le-unknown-linux-gnu]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.armv7-unknown-linux-musleabihf]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.armv7-unknown-linux-gnueabihf]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.i686-unknown-linux-musl]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
[target.i686-unknown-linux-gnu]
pre-build = [
"apt update",
"apt install -y nasm libtool autotools-dev autoconf"
]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Available algorithms:
- [X] ZSTD           `cramjam.zstd`
- [X] XZ / LZMA  `cramjam.xz`
- [X] Blosc2        `cramjam.experimental.blosc2`
- [X] IGzip         `cramjam.experimental.igzip` (only on 64-bit targets)

All available for use as:

Expand Down
Loading
Loading