Skip to content

Try to build CUDA wheels #1141

Try to build CUDA wheels

Try to build CUDA wheels #1141

Workflow file for this run

name: Build Python wheels
on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR
env:
SPHERICART_NO_LOCAL_DEPS: "1"
MACOSX_DEPLOYMENT_TARGET: "11.0"
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
strategy:
matrix:
# TODO: add windows builder
os: [ubuntu-20.04, macos-13]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install cibuildwheel
run: python -m pip install cibuildwheel build
- name: Build sphericart wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist . --outdir dist
python -m cibuildwheel dist/*.tar.gz --output-dir dist
env:
CIBW_BUILD_VERBOSITY: 3
# build wheels on CPython 3.12
CIBW_BUILD: cp312-*
# skip musl and 32-bit builds
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# on macOS, build both Intel & Apple Silicon versions
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# do not build wheels with -march=native
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF
- name: Build sphericart-torch wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-torch --outdir sphericart-torch/dist
python -m cibuildwheel sphericart-torch/dist/*.tar.gz --output-dir sphericart-torch/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
# we can not build wheels for macos-arm64, since the host is always
# x86_64, and we assume we can link against the host version of libtorch
CIBW_ARCHS_MACOS: x86_64
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# Use the CPU only version of torch when building/running the code
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu
# do not complain for missing libtorch.so in sphericart-torch wheel
CIBW_REPAIR_WHEEL_COMMAND_MACOS: |
delocate-wheel --ignore-missing-dependencies --require-archs {delocate_archs} -w {dest_dir} -v {wheel}
CIBW_REPAIR_WHEEL_COMMAND_LINUX: |
auditwheel repair --exclude libtorch.so --exclude libtorch_cpu.so --exclude libc10.so -w {dest_dir} {wheel}
- name: Build sphericart-jax wheels
run: |
# ensure we build the wheel from the sdist, not the checkout
python -m build --sdist sphericart-jax --outdir sphericart-jax/dist
python -m cibuildwheel sphericart-jax/dist/*.tar.gz --output-dir sphericart-jax/dist
env:
CIBW_BUILD_VERBOSITY: 3
CIBW_BUILD: cp310-*
CIBW_SKIP: "*-musllinux* *-win32 *-manylinux_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_ENVIRONMENT: SPHERICART_ARCH_NATIVE=OFF
- uses: actions/upload-artifact@v3
with:
name: wheels
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
path: dist/*.whl
- name: upload wheel to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
# only upload sphericart wheels, not sphericart-torch or sphericart-jax
files: dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-sdist:
runs-on: ubuntu-20.04
name: sdist
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: build sdist
run: |
python -m pip install build
python -m build --sdist . --outdir ./dist
python -m build --sdist sphericart-torch --outdir ./dist
python -m build --sdist sphericart-jax --outdir ./dist
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.tar.gz
- name: upload sdist to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: dist/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}