Skip to content

Commit

Permalink
Try a more typical cibuildwheel setup (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf authored Dec 22, 2024
1 parent 3992b73 commit 89d6d68
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 215 deletions.
69 changes: 28 additions & 41 deletions .github/workflows/build-jax-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,65 +7,52 @@ on:
pull_request:
# Check all PR

#env:
# SPHERICART_NO_LOCAL_DEPS: "1"
concurrency:
group: jax-wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-jax-wheels:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]
arch: ["x86_64"]
python-version: ["3.10", "3.11", "3.12"]
env:
CIBW_BUILD: cp312
name: "sphericart-jax-wheel ${{matrix.os}} ${{matrix.arch}} python=${{matrix.python-version}}"

python-version: ["39", "310", "311", "312", "313"]

name: "Py${{matrix.python-version}} ${{matrix.os}} ${{matrix.arch}}"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Github Actions Envs Setup
run: |
PYTHONVERSION="${{ matrix.python-version }}"

PYTHON_VER_NO_DOT=${PYTHONVERSION//./}
echo PYTHON_VER_NO_DOT=${PYTHON_VER_NO_DOT} >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

# Build the custom Manylinux Docker image
- name: Build Manylinux Docker Image
- name: Build custom manylinux Docker Image with CUDA
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
--build-arg PYTHON_VER="${{ matrix.python-version }}" \
--build-arg PYTHON_VER_NO_DOT="${{ env.PYTHON_VER_NO_DOT }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
run: python -m pip install cibuildwheel

- name: Build jax wheels
run: python -m cibuildwheel ./sphericart-jax
env:
SPHERICART_ARCH_NATIVE: OFF
CUDA_HOME: /usr/local/cuda
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: "cp${{ env.PYTHON_VER_NO_DOT }}-*"
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation --check-build-dependencies"
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp${{ matrix.python-version }}-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: "sphericart_manylinux2014_x86_64"
CIBW_MANYLINUX_AARCH64_IMAGE: "sphericart_manylinux2014_aarch64"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair \
-w {dest_dir} {wheel}
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
- uses: actions/upload-artifact@v4
with:
name: "sphericart-jax-py-${{ env.PYTHON_VER_NO_DOT }}-${{ matrix.arch }}"
name: "sphericart-jax-py-${{ matrix.python-version }}-${{ matrix.os }}-${{ matrix.arch }}"
path: ./wheelhouse/*.whl
91 changes: 39 additions & 52 deletions .github/workflows/build-torch-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,69 @@ on:
pull_request:
# Check all PR

#env:
# SPHERICART_NO_LOCAL_DEPS: "1"
concurrency:
group: torch-wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-torch-wheels:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
arch: ["x86_64"]
python-version: ["3.12"]
pytorch-version: ["2.4.1", "2.5.1"]
env:
CIBW_BUILD: cp312
name: "torch-cuda-wheel ${{matrix.os}} ${{matrix.arch}} python=${{matrix.python-version}} torch=${{matrix.pytorch-version}}"

pytorch-version: ["2.4", "2.5"]
name: "Torch ${{matrix.pytorch-version}} ${{matrix.os}} ${{matrix.arch}}"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Github Actions Envs Setup
run: |
PYTHONVERSION="${{ matrix.python-version }}"

PYTHON_VER_NO_DOT=${PYTHONVERSION//./}
echo PYTHON_VER_NO_DOT=${PYTHON_VER_NO_DOT} >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

# Build the custom Manylinux Docker image
- name: Build Manylinux Docker Image
- name: Build custom manylinux Docker Image with CUDA
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
--build-arg PYTHON_VER="${{ matrix.python-version }}" \
--build-arg PYTHON_VER_NO_DOT="${{ env.PYTHON_VER_NO_DOT }}" \
--build-arg PYTORCH_VERSION="${{ matrix.pytorch-version }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
run: python -m pip install cibuildwheel

- name: Build torch wheels
run: python -m cibuildwheel ./sphericart-torch
env:
SPHERICART_ARCH_NATIVE: OFF
TORCH_CUDA_ARCH_LIST: "8.0 8.6 8.9 9.0"
SPHERICART_TORCH_BUILD_WITH_TORCH_VERSION: ${{ matrix.pytorch-version }}
CUDA_HOME: /usr/local/cuda
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: "cp${{ env.PYTHON_VER_NO_DOT }}-*"
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation --check-build-dependencies"
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: "sphericart_manylinux2014_x86_64"
CIBW_MANYLINUX_AARCH64_IMAGE: "sphericart_manylinux2014_aarch64"
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair \
--exclude libc10.so \
--exclude libtorch.so \
--exclude libtorch_cpu.so \
--exclude libtorch_cuda.so \
--exclude libc10_cuda.so \
-w {dest_dir} {wheel}
--exclude libc10.so \
--exclude libtorch.so \
--exclude libtorch_cpu.so \
--exclude libtorch_cuda.so \
--exclude libc10_cuda.so \
-w {dest_dir} {wheel}
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
TORCH_CUDA_ARCH_LIST="8.0 8.6 8.9 9.0"
SPHERICART_TORCH_BUILD_WITH_TORCH_VERSION=${{ matrix.pytorch-version }}.*
- uses: actions/upload-artifact@v4
with:
name: torch-single-version-wheel-${{ matrix.pytorch-version }}-${{ matrix.arch }}
name: torch-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-torch-${{ matrix.pytorch-version }}
path: ./wheelhouse/*.whl

merge-torch-wheels:
needs: build-torch-wheels
runs-on: ubuntu-22.04
name: merge sphericart-torch ${{ matrix.name }}
runs-on: ${{ matrix.os }}
name: merge wheels for ${{ matrix.name }}
strategy:
matrix:
include:
Expand All @@ -95,7 +82,7 @@ jobs:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: torch-single-version-wheel-*-${{ matrix.arch }}
pattern: torch-single-version-wheel-${{ matrix.os }}-${{ matrix.arch }}-*
merge-multiple: false
path: dist

Expand Down Expand Up @@ -137,5 +124,5 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: sphericart-torch-wheel-${{ matrix.arch }}
name: sphericart-torch-wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
71 changes: 28 additions & 43 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,51 @@ on:
pull_request:
# Check all PR

concurrency:
group: wheels-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-wheels:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-24.04]
arch: ["x86_64"]
python-version: ["3.12"]
cuda-version: ["12.1"]
env:
CIBW_SKIP: cp36-* cp37-* cp38-* cp39-* cp310-* cp311-*
name: "sphericart-wheel ${{matrix.os}} ${{matrix.arch}} python=${{matrix.python-version}}"


name: "${{matrix.os}} ${{matrix.arch}}"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Github Actions Envs Setup
run: |
CUVERSION="${{ matrix.cuda-version }}"
PYTHONVERSION="${{ matrix.python-version }}"
echo CUVERSION=${CUVERSION} >> $GITHUB_ENV
PYTHON_VER_NO_DOT=${PYTHONVERSION//./}
echo PYTHON_VER_NO_DOT=${PYTHON_VER_NO_DOT} >> $GITHUB_ENV

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all

# Build the custom Manylinux Docker image
- name: Build Manylinux Docker Image
- name: Build custom manylinux Docker Image with CUDA
run: |
docker build --no-cache \
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
--build-arg PYTHON_VER="${{ matrix.python-version }}" \
--build-arg PYTHON_VER_NO_DOT="${{ env.PYTHON_VER_NO_DOT }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
-t sphericart_manylinux2014_"${{ matrix.arch }}" \
scripts/manylinux2014_"${{ matrix.arch }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.22.0
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel .
env:
SPHERICART_ARCH_NATIVE: OFF
CUDA_HOME: /usr/local/cuda
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: "cp${{ env.PYTHON_VER_NO_DOT }}-*"
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation --check-build-dependencies"
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 1
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*-musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_MANYLINUX_X86_64_IMAGE: "sphericart_manylinux2014_x86_64"
CIBW_MANYLINUX_AARCH64_IMAGE: "sphericart_manylinux2014_aarch64"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair \
-w {dest_dir} {wheel}
CIBW_MANYLINUX_X86_64_IMAGE: sphericart_manylinux2014_x86_64
CIBW_ENVIRONMENT: >
SPHERICART_ARCH_NATIVE=OFF
SPHERICART_NO_LOCAL_DEPS=1
- uses: actions/upload-artifact@v4
with:
name: sphericart-wheel-${{ matrix.arch }}
name: sphericart-wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ./wheelhouse/*.whl
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
pull_request:
# Check all PR

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
build-and-publish:
runs-on: ubuntu-20.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
# Check all PR

concurrency:
group: tests-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
tests:
runs-on: ${{ matrix.os }}
Expand Down
44 changes: 0 additions & 44 deletions scripts/manylinux2014_aarch64/Dockerfile

This file was deleted.

Loading

0 comments on commit 89d6d68

Please sign in to comment.