Unverified Commit c72aae78 authored by Matthew Douglas's avatar Matthew Douglas Committed by GitHub
Browse files

Update workflow for packaging (#1766)

* Update workflow for packaging

* Run the workflow when files change in `.github/scripts/**`
* Shorter names for build jobs
* Change Windows CUDA install back to "network" using subpackages

* Update

* Modify sub-packages for CUDA version handling

Updated sub-packages to conditionally include 'crt' for CUDA 13.

* Update CUDA sub-packages in workflow configuration

* Change CUDA install method to 'local' for version 13 on Windows

* Modify CUDA sub-packages for version 13 support

* Change CUDA install method to 'network' in workflow

* CUDA build script: only install security updates in container

* CUDA build script: only install security updates in container

* Pin macos build runner to macos-15 and windows to windows-2025

* ROCm build: remove unneeded build step
parent 09ea8618
...@@ -32,8 +32,8 @@ if [ "${build_os:0:6}" == ubuntu ]; then ...@@ -32,8 +32,8 @@ if [ "${build_os:0:6}" == ubuntu ]; then
echo "Using image $image" echo "Using image $image"
docker run -i -w /src -v "$PWD:/src" "$image" bash -c \ docker run -i -w /src -v "$PWD:/src" "$image" bash -c \
"dnf update -y \ "dnf -y --refresh update --security \
&& dnf install cmake gcc-toolset-11 -y \ && dnf -y install cmake gcc-toolset-11 --setopt=install_weak_deps=False --setopt=tsflags=nodocs \
&& source scl_source enable gcc-toolset-11 \ && source scl_source enable gcc-toolset-11 \
&& cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" . \ && cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" . \
&& cmake --build . --config Release" && cmake --build . --config Release"
......
...@@ -6,12 +6,13 @@ on: ...@@ -6,12 +6,13 @@ on:
branches: [main] branches: [main]
paths: paths:
- ".github/workflows/python-package.yml" - ".github/workflows/python-package.yml"
- ".github/scripts/**"
- "bitsandbytes/**" - "bitsandbytes/**"
- "csrc/**" - "csrc/**"
- "include/**" - "include/**"
- "tests/**" - "tests/**"
- "CMakeLists.txt" - "CMakeLists.txt"
- "requirements*.txt" - "MANIFEST.in"
- "setup.py" - "setup.py"
- "pyproject.toml" - "pyproject.toml"
release: release:
...@@ -25,9 +26,9 @@ concurrency: ...@@ -25,9 +26,9 @@ concurrency:
jobs: jobs:
## ##
# This job matrix builds the non-CUDA versions of the libraries for all supported platforms. # This job matrix builds the CPU versions of the libraries for all supported platforms.
## ##
build-shared-libs: build-cpu:
strategy: strategy:
matrix: matrix:
include: include:
...@@ -35,9 +36,9 @@ jobs: ...@@ -35,9 +36,9 @@ jobs:
arch: x86_64 arch: x86_64
- os: ubuntu-22.04-arm - os: ubuntu-22.04-arm
arch: aarch64 arch: aarch64
- os: windows-latest - os: windows-2025
arch: x86_64 arch: x86_64
- os: macos-latest - os: macos-15
arch: arm64 arch: arm64
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
...@@ -56,20 +57,21 @@ jobs: ...@@ -56,20 +57,21 @@ jobs:
name: shared_library_${{ matrix.os }}_${{ matrix.arch }} name: shared_library_${{ matrix.os }}_${{ matrix.arch }}
path: output/* path: output/*
retention-days: 7 retention-days: 7
## ##
# This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64) # This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64)
## ##
build-shared-libs-cuda: build-cuda:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest] os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
arch: x86_64 arch: x86_64
- os: ubuntu-22.04-arm - os: ubuntu-22.04-arm
arch: aarch64 arch: aarch64
- os: windows-latest - os: windows-2025
arch: x86_64 arch: x86_64
cuda_version: cuda_version:
["11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2", "12.4.1", "12.5.1", "12.6.3", "12.8.1", "12.9.1", "13.0.1"] ["11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2", "12.4.1", "12.5.1", "12.6.3", "12.8.1", "12.9.1", "13.0.1"]
...@@ -77,14 +79,15 @@ jobs: ...@@ -77,14 +79,15 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# Windows: We install Cuda on the agent (slow) # Windows: We install Cuda on the agent (slow)
#- uses: Jimver/cuda-toolkit@433d453c1fa37d10a3254452fa8e284441c9192d # v0.2.27
- uses: N-Storm/cuda-toolkit@d68ba29a800229200a2c3f572f9e816d7f67cdb4 # v0.2.24m - uses: N-Storm/cuda-toolkit@d68ba29a800229200a2c3f572f9e816d7f67cdb4 # v0.2.24m
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
id: cuda-toolkit id: cuda-toolkit
with: with:
# Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action. # Temporary: Use CUDA 13.0.0 for Windows until 13.0.1 is supported with this action.
cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }} cuda: ${{ matrix.cuda_version == '13.0.1' && '13.0.0' || matrix.cuda_version }}
method: "local" method: "network"
# The "crt" "nvvm" and "nvptxcompiler" components are added for CUDA 13.
sub-packages: ${{ format('["nvcc"{0},"cudart","cusparse","cublas","thrust","cublas_dev","cusparse_dev"]', startsWith(matrix.cuda_version, '13.') && ',"crt","nvvm","nvptxcompiler"' || '') }}
use-github-cache: false use-github-cache: false
use-local-cache: false use-local-cache: false
log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt log-file-suffix: ${{matrix.os}}-${{matrix.cuda_version}}.txt
...@@ -104,7 +107,7 @@ jobs: ...@@ -104,7 +107,7 @@ jobs:
path: output/* path: output/*
retention-days: 7 retention-days: 7
build-shared-libs-xpu: build-xpu:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
...@@ -122,7 +125,7 @@ jobs: ...@@ -122,7 +125,7 @@ jobs:
path: output/* path: output/*
retention-days: 7 retention-days: 7
build-shared-libs-rocm: build-rocm:
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04] os: [ubuntu-22.04]
...@@ -132,8 +135,6 @@ jobs: ...@@ -132,8 +135,6 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Docker multiarch
uses: docker/setup-qemu-action@v3
- name: Clean up disk space - name: Clean up disk space
run: | run: |
sudo rm -rf \ sudo rm -rf \
...@@ -168,24 +169,24 @@ jobs: ...@@ -168,24 +169,24 @@ jobs:
build-wheels: build-wheels:
needs: needs:
- build-shared-libs - build-cpu
- build-shared-libs-cuda - build-cuda
- build-shared-libs-rocm - build-rocm
- build-shared-libs-xpu - build-xpu
strategy: strategy:
matrix: matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-latest, macos-latest] os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025, macos-15]
include: include:
- os: ubuntu-22.04 - os: ubuntu-22.04
arch: x86_64 arch: x86_64
- os: ubuntu-22.04-arm - os: ubuntu-22.04-arm
arch: aarch64 arch: aarch64
- os: windows-latest - os: windows-2025
arch: x86_64 arch: x86_64
- os: macos-latest - os: macos-15
arch: arm64 arch: arm64
# The specific Python version is irrelevant in this context as we are only packaging non-C extension # The specific Python version is irrelevant in this context as we are only packaging non-C extension
# code. This ensures compatibility across Python versions, including Python 3.9, as compatibility is # code. This ensures compatibility across Python versions, as compatibility is
# dictated by the packaged code itself, not the Python version used for packaging. # dictated by the packaged code itself, not the Python version used for packaging.
python-version: ["3.10"] python-version: ["3.10"]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment