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

Switch to our many/musl images #134

Merged
merged 5 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 39 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
cibuildwheel:
name: Build wheels on ${{ matrix.os }} ${{ matrix.arch }} ${{ matrix.interpreter }}
name: Build ${{ matrix.platform }} ${{ matrix.arch }} ${{ matrix.interpreter }}
runs-on: ${{ matrix.os }}

defaults:
Expand All @@ -18,39 +18,62 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04]
interpreter: [cp37-manylinux, cp38-manylinux, cp39-manylinux, cp310-manylinux, cp311-manylinux]
arch: [aarch64, ppc64le]
include:
- os: macos-11 # All x86_64 macOS targets
arch: auto
interpreter: "*"
- os: ubuntu-20.04 # All i686 and x86_64 Linux targets
arch: auto
interpreter: "*"
os: [ubuntu-20.04, macos-11]
arch: [aarch64, ppc64le, x86_64]
interpreter: [cp37, cp38, cp39, cp310, cp311, pp37, pp38, pp39]
platform: [manylinux, musllinux, macosx]
exclude:
# Build Linux on Linux
- os: macos-11
platform: manylinux
- os: macos-11
platform: musllinux
# Build macOS on macOS
- os: ubuntu-20.04
platform: macosx
# PyPy doesn't support musllinux
- interpreter: pp37
platform: musllinux
- interpreter: pp38
platform: musllinux
- interpreter: pp39
platform: musllinux
# PyPy doesn't support PPC64le
- arch: ppc64le
interpreter: pp37
- arch: ppc64le
interpreter: pp38
- arch: ppc64le
interpreter: pp39
# There is no Rust toolchain for PPC64le with MUSL
- arch: ppc64le
platform: musllinux
# x86_64 is the only supported architecture for macOS
- os: macos-11
arch: aarch64
- os: macos-11
arch: ppc64le

steps:
- uses: actions/checkout@v3

- name: Set up QEMU
if: ${{ matrix.arch != 'auto' }}
if: ${{ matrix.os != 'macos-11' }}
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Set CIBW_BUILD
if: ${{ matrix.arch != 'auto' }}
run: echo "CIBW_BUILD=${{ matrix.interpreter }}_${{ matrix.arch }}" >> $GITHUB_ENV
run: echo "CIBW_BUILD=${{ matrix.interpreter }}-${{ matrix.platform }}_${{ matrix.arch }}" >> $GITHUB_ENV

- name: Set CIBW_ARCHS
run : echo "CIBW_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV
run: echo "CIBW_ARCHS=${{ matrix.arch }}" >> $GITHUB_ENV

- name: Build wheels
uses: pypa/[email protected]
with:
package-dir: ./light-curve
env:
CIBW_SKIP: "*-musllinux_i686" # rustup doesn't install i686-musl
CIBW_BUILD_VERBOSITY: "3"

- name: Upload wheels as artifacts
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- `light-curve-feature` 0.5.0 -> 0.5.2 https://github.com/light-curve/light-curve-python/pull/123
- CI: binary wheels are now built using our custom [manylinux/musllinux images](https://github.com/light-curve/base-docker-images), which include FFTW library optimised to use platform-specific SIMD instructions. It should give up to 50% performance gain for `Periodogram` at all Linux platforms but `x86_64` where we use MKL https://github.com/light-curve/light-curve-python/pull/134
- We don't provide binary wheels for Linux i686 anymore, please contact us if you need them https://github.com/light-curve/light-curve-python/pull/134
- wheel build dependency: `maturin` 0.13.x -> 0.14.x https://github.com/light-curve/light-curve-python/issues/130 https://github.com/light-curve/light-curve-python/pull/135

### Deprecated
Expand Down
15 changes: 8 additions & 7 deletions light-curve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ python3 -mpip install light-curve
We also provide `light-curve-python` package which is just an "alias" to the main `light-curve` package.

Minimum supported Python version is 3.7.
We provide binary wheels via [PyPi](https://pypi.org/project/light-curve/) for number of platforms and architectures, both for CPython and PyPy.

### Support matrix

| Arch \ OS | Linux glibc | Linux musl | macOS | Windows |
| ----------- | ----------- | ---------- | ----- | ---------- |
| **x86-64** | wheel (MKL) | wheel (MKL) | wheel | not tested https://github.com/light-curve/light-curve-python/issues/12 |
| **i686** | wheel | not tested | — | not tested |
| **aarch64** | wheel | src | src https://github.com/light-curve/light-curve-python/issues/5 | not tested |
| **ppc64le** | wheel | not tested | — | — |
| Arch \ OS | Linux glibc | Linux musl | macOS | Windows |
| ----------- |-------------|--------------------------------|----------------------------------------------------------------|------------------------------------------------------------------------|
| **x86-64** | wheel (MKL) | wheel (MKL) | wheel | not tested https://github.com/light-curve/light-curve-python/issues/12 |
| **i686** | src | src | — | not tested |
| **aarch64** | wheel | src | src https://github.com/light-curve/light-curve-python/issues/5 | not tested |
| **ppc64le** | wheel | not tested (no Rust toolchain) | — | — |

- "wheel": binary wheel is available on pypi.org, local building is not required for the platform, the only pre-requirement is a recent `pip` version. For Linux x86-64 we provide binary wheels built with Intel MKL for better periodogram perfromance, which is not a default build option.
- "src": the package is confirmed to be built and pass unit tests locally, but testing and package building is not supported by CI yet. It is required to have the [GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+ and the [Rust toolchain](https://rust-lang.org) v1.57+ to install it via `pip install`.
- "src": the package is confirmed to be built and pass unit tests locally, but testing and package building is not supported by CI. It is required to have the [GNU scientific library (GSL)](https://www.gnu.org/software/gsl/) v2.1+ and the [Rust toolchain](https://rust-lang.org) v1.57+ to install it via `pip install`.
- "not tested": building from the source code is not tested, please report us building status via issue/PR/email.

We build aarch64 macOS 12.0+ wheels locally running this command in `light-curve` directory:
Expand Down
68 changes: 30 additions & 38 deletions light-curve/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,51 +107,43 @@ test-requires = [
"scipy",
]

[tool.cibuildwheel.environment]
PATH = "$PATH:$HOME/.cargo/bin"
GSL_VERSION = "2.7" # used in manylinux only
CARGO_NET_GIT_FETCH_WITH_CLI = "true" # Solves the issue with OOM in QEMU during crate.io index fetching
[tool.cibuildwheel]
# We use our own images which include Rust, GSL and platform-optimised FFTW
# Manylinux CPython
manylinux-aarch64-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_aarch64"
# not supported
#manylinux-i686-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_i686"
manylinux-ppc64le-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_ppc64le"
# not supported
# manylinux-s390x-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_s390x"
manylinux-x86_64-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_x86_64"
# Manylinux PyPy
manylinux-pypy_aarch64-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_aarch64"
# not supported
#manylinux-pypy_i686-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_i686"
manylinux-pypy_x86_64-image = "ghcr.io/light-curve/base-docker-images/manylinux2014_x86_64"
# Musllinux
musllinux-aarch64-image = "ghcr.io/light-curve/base-docker-images/musllinux_1_1_aarch64"
# not supported
#musllinux-i686-image = "ghcr.io/light-curve/base-docker-images/musllinux_1_1_i686"
# no Rust toolchain, not supported
# musllinux-ppc64le-image = "ghcr.io/light-curve/base-docker-images/musllinux_1_1_ppc64le"
# not supported
# musllinux-s390x-image = "ghcr.io/light-curve/base-docker-images/musllinux_1_1_s390x"
musllinux-x86_64-image = "ghcr.io/light-curve/base-docker-images/musllinux_1_1_x86_64"

[tool.cibuildwheel.macos]
before-all = [
# Install Rust
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
# Install GSL
"brew install gsl",
]
# We'd like to link system FFTW, because is is usually better optimised
environment = { "PATH" = "$PATH:$HOME/.cargo/bin", "MATURIN_PEP517_ARGS" = "--locked --no-default-features --features fftw-system,gsl" }

# glibc Linux aka manylinux, CentOS
[[tool.cibuildwheel.overrides]]
select = "*-manylinux*"
before-all = [
# Install Rust
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
# Rust build deps require openssl
"yum install -y openssl-devel",
# manylinux2014 image has GSL v.1 -> compile GSL static libraries ourselves
"curl -O https://mirror.ibcp.fr/pub/gnu/gsl/gsl-${GSL_VERSION}.tar.gz",
"tar -xzvf gsl-${GSL_VERSION}.tar.gz",
"cd gsl-${GSL_VERSION}",
"./configure --with-pic --enable-shared=no",
"make -j$(nproc)",
"make install",
"cd -",
"rm -rf gsl-${GSL_VERSION} gsl-${GSL_VERSION}.tar.gz",
]

# MUSL Linux, Alpine
[[tool.cibuildwheel.overrides]]
select = "*-musllinux*"
[tool.cibuildwheel.macos]
before-all = [
# Install Rust
"curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y",
# Rust build deps require openssl
"apk add openssl-dev",
# Install GSL
"apk add gsl-dev",
# Install FFTW and GSL
"brew install fftw gsl",
]

# Build with Intel MKL on Linux x86_64
[[tool.cibuildwheel.overrides]]
select = "*linux_x86_64"
environment = { "PATH" = "$PATH:$HOME/.cargo/bin", "GSL_VERSION" = "2.7", "MATURIN_PEP517_ARGS" = "--locked --no-default-features --features mkl,gsl" }
environment = { "PATH" = "$PATH:$HOME/.cargo/bin", "MATURIN_PEP517_ARGS" = "--locked --no-default-features --features fftw-mkl,gsl" }