Skip to content

JAX CPU interface

JAX CPU interface #438

Workflow file for this run

name: Build Python wheels
on:
push:
branches: [main]
tags: "*"
pull_request:
# Check all PR
jobs:
build-wheels:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
strategy:
matrix:
# TODO: add windows builder
os: [ubuntu-20.04, macos-11]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- 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.10
CIBW_BUILD: cp310-*
# 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}
- uses: actions/upload-artifact@v3
with:
name: wheels
path: dist/*.whl
- name: upload wheel to GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
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.10"
- name: build sdist
run: |
python -m pip install wheel
python setup.py sdist
cd sphericart-torch
python setup.py sdist
mv dist/*.tar.gz ../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 }}