Skip to content

Fix build with use_gpu=true #745

Fix build with use_gpu=true

Fix build with use_gpu=true #745

Workflow file for this run

name: build
on:
schedule:
# Every Monday at 06:00 UTC
- cron: '0 6 * * 1'
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'
jobs:
build_openmp:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14" ]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: prefix-dev/setup-pixi@v0.10.0
with:
cache: false
pixi-version: v0.46.0
- name: Add .pixi/envs/default to the $PATH
run: echo "$(pwd)/.pixi/envs/default/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: pixi add --platform linux-64 scipy numpy pip pytest meson meson-python openblas python==${{ matrix.python-version }}
- name: Test
run: |
pixi r python -m pip install -v . --no-build-isolation -Csetup-args=-Duse_openmp=true
pixi r pytest
rm -rf build/
build_mkl:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ 3.9, "3.10", "3.11", "3.12", "3.13", "3.14"]
link_mkl: [true]
use_blas64: [true, false]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
LINK_MKL: ${{ matrix.link_mkl }}
USE_BLAS64: ${{ matrix.use_blas64 }}
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Set Additional Envs
shell: bash
run: |
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
- uses: prefix-dev/setup-pixi@v0.10.0
with:
cache: false
pixi-version: v0.46.0
- name: Add .pixi/envs/default to the $PATH
run: echo "$(pwd)/.pixi/envs/default/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: |
if [[ "$LINK_MKL" == "true" ]]; then
BLAS_PKGS="blas-devel=*=*mkl"
else
BLAS_PKGS="blas-devel=*=*openblas"
fi
pixi add --platform linux-64 $BLAS_PKGS pip scipy numpy pytest mkl mkl-devel pkg-config meson meson-python
- name: Build
run: |
pixi r python -c "import numpy as np;print(np.show_config())"
MESON_ARGS="-Csetup-args=-Dlink_mkl=true"
if [[ "$USE_BLAS64" == "true" ]]; then
MESON_ARGS="$MESON_ARGS -Csetup-args=-Duse_blas64=true"
fi
pixi r python -m pip install --verbose --no-build-isolation $MESON_ARGS .
- name: Test
run: |
pixi r pytest
rm -rf build/
build_native_arch:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
native_arch: [true, false]
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: prefix-dev/setup-pixi@v0.10.0
with:
cache: false
pixi-version: v0.46.0
- name: Add .pixi/envs/default to the $PATH
run: echo "$(pwd)/.pixi/envs/default/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: pixi add --platform linux-64 scipy numpy pip pytest meson meson-python openblas python==3.12
- name: Build (native_arch=${{ matrix.native_arch }})
run: |
pixi r python -m pip install -v . --no-build-isolation \
-Csetup-args=-Dnative_arch=${{ matrix.native_arch }}
- name: Test
run: |
pixi r pytest
rm -rf build/
build_accelerate:
runs-on: macos-latest
defaults:
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
steps:
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: prefix-dev/setup-pixi@v0.10.0
with:
cache: false
pixi-version: v0.46.0
- name: Add .pixi/envs/default to the $PATH
run: echo "$(pwd)/.pixi/envs/default/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: pixi add --platform osx-arm64 scipy numpy pip pytest meson meson-python python==${{ matrix.python-version }}
- name: Build and test
run: |
pixi r python -m pip install -v . --no-build-isolation
pixi r pytest
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Standard x86 builds
- os: ubuntu-latest
arch: x86_64
# NATIVE ARM builds (No QEMU needed!)
# Note: Uses ubuntu-24.04-arm specifically
- os: ubuntu-24.04-arm
arch: aarch64
- os: macos-latest
arch: auto
- os: windows-latest
arch: auto
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Set up MSVC for Windows
if: runner.os == 'Windows'
uses: egor-tensin/vs-shell@v2
- name: Install conda on Windows
if: runner.os == 'Windows'
uses: conda-incubator/setup-miniconda@v4
with:
miniconda-version: "latest"
channels: https://software.repos.intel.com/python/conda/, conda-forge
- name: Install MKL from conda on Windows
if: runner.os == 'Windows'
run: conda install -y -c https://software.repos.intel.com/python/conda/ -c conda-forge mkl mkl-devel intel-openmp pkgconfig
- name: Build wheels
uses: pypa/cibuildwheel@v4.1.0
env:
# Explicitly set the architecture based on the matrix
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
- name: Report wheel sizes
run: |
ls -lh ./wheelhouse/*.whl
ls -lh ./wheelhouse/*.whl >> $GITHUB_STEP_SUMMARY
# Warn if any wheel exceeds 100MB (PyPI default limit)
for whl in ./wheelhouse/*.whl; do
size=$(stat -f%z "$whl" 2>/dev/null || stat -c%s "$whl")
if [ "$size" -gt 104857600 ]; then
echo "::warning file=$(basename $whl)::Wheel $(basename $whl) is $(( size / 1048576 ))MB — exceeds PyPI 100MB limit"
fi
done
shell: bash
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
submodules: true
- name: Build sdist
run: pipx run build --sdist -Csetup-args=-Dsdist_mode=true
- uses: actions/upload-artifact@v7
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
# We can also upload always, with skip-existing: true, below
# We upload on every push event (only master, above) that is a new tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# Only run this step on GH release
# if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v8
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: false # Fail loudly for duplicates.
# To test:
# with:
# repository-url: https://test.pypi.org/legacy/