You need to sign in or sign up before continuing.
Commit 958dfa99 authored by Aarni Koskela's avatar Aarni Koskela Committed by Titus
Browse files

Reformat .github with Prettier

parent 17681f68
name: "\U0001F680 Feature request" name: "\U0001F680 Feature request"
description: Submit a proposal/request for a new feature description: Submit a proposal/request for a new feature
labels: [ "feature" ] labels: ["feature"]
body: body:
- type: textarea - type: textarea
id: feature-request id: feature-request
......
...@@ -8,7 +8,7 @@ on: ...@@ -8,7 +8,7 @@ on:
- v*-release - v*-release
jobs: jobs:
build: build:
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
with: with:
commit_sha: ${{ github.sha }} commit_sha: ${{ github.sha }}
......
...@@ -3,28 +3,27 @@ name: Python package ...@@ -3,28 +3,27 @@ name: Python package
on: on:
push: {} push: {}
pull_request: pull_request:
branches: [ main ] branches: [main]
paths: paths:
- '.github/workflows/python-package.yml' - ".github/workflows/python-package.yml"
- 'bitsandbytes/**' - "bitsandbytes/**"
- 'csrc/**' - "csrc/**"
- 'include/**' - "include/**"
- 'tests/**' - "tests/**"
- 'CMakeLists.txt' - "CMakeLists.txt"
- 'requirements*.txt' - "requirements*.txt"
- 'setup.py' - "setup.py"
- 'pyproject.toml' - "pyproject.toml"
- 'pytest.ini' - "pytest.ini"
release: release:
types: [ published ] types: [published]
workflow_dispatch: {} # Allow manual trigger workflow_dispatch: {} # Allow manual trigger
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
## ##
# This job matrix builds the non-CUDA versions of the libraries for all supported platforms. # This job matrix builds the non-CUDA versions of the libraries for all supported platforms.
## ##
...@@ -39,42 +38,42 @@ jobs: ...@@ -39,42 +38,42 @@ jobs:
runs-on: ${{ matrix.os }} # One day, we could run them on native agents. Azure supports this now but it's planned only for Q3 2023 for hosted agents runs-on: ${{ matrix.os }} # One day, we could run them on native agents. Azure supports this now but it's planned only for Q3 2023 for hosted agents
steps: steps:
# Check out code # Check out code
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# On Linux we use CMake within Docker # On Linux we use CMake within Docker
- name: Setup cmake - name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.14 uses: jwlawson/actions-setup-cmake@v1.14
with: with:
cmake-version: '3.26.x' cmake-version: "3.26.x"
- name: Setup MSVC - name: Setup MSVC
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
#uses: microsoft/setup-msbuild@v1.1 # to use msbuild #uses: microsoft/setup-msbuild@v1.1 # to use msbuild
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
# Compile C++ code # Compile C++ code
- name: Build C++ - name: Build C++
shell: bash shell: bash
run: | run: |
set -ex set -ex
build_os=${{ matrix.os }} build_os=${{ matrix.os }}
build_arch=${{ matrix.arch }} build_arch=${{ matrix.arch }}
if [ ${build_os:0:6} == ubuntu -a ${build_arch} == aarch64 ]; then if [ ${build_os:0:6} == ubuntu -a ${build_arch} == aarch64 ]; then
# Allow cross-compile on aarch64 # Allow cross-compile on aarch64
sudo apt-get update sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCOMPUTE_BACKEND=cpu . cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCOMPUTE_BACKEND=cpu .
elif [ ${build_os:0:5} == macos -a ${build_arch} == aarch64 ]; then elif [ ${build_os:0:5} == macos -a ${build_arch} == aarch64 ]; then
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu . cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu .
else else
cmake -DCOMPUTE_BACKEND=cpu . cmake -DCOMPUTE_BACKEND=cpu .
fi fi
cmake --build . --config Release cmake --build . --config Release
mkdir -p output/${{ matrix.os }}/${{ matrix.arch }} mkdir -p output/${{ matrix.os }}/${{ matrix.arch }}
( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ ) ( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ )
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
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)
## ##
...@@ -83,7 +82,8 @@ jobs: ...@@ -83,7 +82,8 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
arch: [x86_64, aarch64] arch: [x86_64, aarch64]
cuda_version: ["11.7.1", "11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2"] cuda_version:
["11.7.1", "11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2"]
exclude: exclude:
- os: windows-latest # This probably requires arm64 Windows agents - os: windows-latest # This probably requires arm64 Windows agents
arch: aarch64 arch: aarch64
...@@ -92,68 +92,68 @@ jobs: ...@@ -92,68 +92,68 @@ jobs:
runs-on: ${{ matrix.os }} # One day, we could run them on native agents. Azure supports this now but it's planned only for Q3 2023 for hosted agents runs-on: ${{ matrix.os }} # One day, we could run them on native agents. Azure supports this now but it's planned only for Q3 2023 for hosted agents
steps: steps:
# Check out code # Check out code
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# Linux: We use Docker to build cross platform Cuda (aarch64 is built in emulation) # Linux: We use Docker to build cross platform Cuda (aarch64 is built in emulation)
- name: Set up Docker multiarch - name: Set up Docker multiarch
if: startsWith(matrix.os, 'ubuntu') if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2
# On Linux we use CMake within Docker # On Linux we use CMake within Docker
- name: Setup cmake - name: Setup cmake
if: ${{ !startsWith(matrix.os, 'linux') }} if: ${{ !startsWith(matrix.os, 'linux') }}
uses: jwlawson/actions-setup-cmake@v1.14 uses: jwlawson/actions-setup-cmake@v1.14
with: with:
cmake-version: '3.26.x' cmake-version: "3.26.x"
# Windows: We install Cuda on the agent (slow) # Windows: We install Cuda on the agent (slow)
- uses: Jimver/cuda-toolkit@v0.2.14 - uses: Jimver/cuda-toolkit@v0.2.14
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
id: cuda-toolkit id: cuda-toolkit
with: with:
cuda: ${{ matrix.cuda_version }} cuda: ${{ matrix.cuda_version }}
method: 'network' method: "network"
sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]' sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]'
linux-local-args: '["--toolkit"]' linux-local-args: '["--toolkit"]'
use-github-cache: false use-github-cache: false
- name: Setup MSVC - name: Setup MSVC
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
#uses: microsoft/setup-msbuild@v1.1 # to use msbuild #uses: microsoft/setup-msbuild@v1.1 # to use msbuild
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
# Compile C++ code # Compile C++ code
- name: Build C++ - name: Build C++
shell: bash shell: bash
run: | run: |
set -ex set -ex
build_os=${{ matrix.os }} build_os=${{ matrix.os }}
build_arch=${{ matrix.arch }} build_arch=${{ matrix.arch }}
build_capability="50;52;60;61;70;75;80;86;89;90" build_capability="50;52;60;61;70;75;80;86;89;90"
[[ "${{ matrix.cuda_version }}" == 11.7.* ]] && build_capability=${build_capability%??????} [[ "${{ matrix.cuda_version }}" == 11.7.* ]] && build_capability=${build_capability%??????}
[[ "${{ matrix.cuda_version }}" == 11.8.* ]] && build_capability=${build_capability%???} [[ "${{ matrix.cuda_version }}" == 11.8.* ]] && build_capability=${build_capability%???}
[[ "${{ matrix.os }}" = windows-* ]] && python3 -m pip install ninja [[ "${{ matrix.os }}" = windows-* ]] && python3 -m pip install ninja
for NO_CUBLASLT in ON OFF; do for NO_CUBLASLT in ON OFF; do
if [ ${build_os:0:6} == ubuntu ]; then if [ ${build_os:0:6} == ubuntu ]; then
image=nvidia/cuda:${{ matrix.cuda_version }}-devel-ubuntu22.04 image=nvidia/cuda:${{ matrix.cuda_version }}-devel-ubuntu22.04
echo "Using image $image" echo "Using image $image"
docker run --platform linux/$build_arch -i -w /src -v $PWD:/src $image sh -c \ docker run --platform linux/$build_arch -i -w /src -v $PWD:/src $image sh -c \
"apt-get update \ "apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake \
&& cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" -DNO_CUBLASLT=${NO_CUBLASLT} . \ && cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" -DNO_CUBLASLT=${NO_CUBLASLT} . \
&& cmake --build ." && cmake --build ."
else else
cmake -G Ninja -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY="${build_capability}" -DNO_CUBLASLT=${NO_CUBLASLT} -DCMAKE_BUILD_TYPE=Release -S . cmake -G Ninja -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY="${build_capability}" -DNO_CUBLASLT=${NO_CUBLASLT} -DCMAKE_BUILD_TYPE=Release -S .
cmake --build . --config Release cmake --build . --config Release
fi fi
done done
mkdir -p output/${{ matrix.os }}/${{ matrix.arch }} mkdir -p output/${{ matrix.os }}/${{ matrix.arch }}
( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ ) ( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ )
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: shared_library_cuda_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.cuda_version }} name: shared_library_cuda_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.cuda_version }}
path: output/* path: output/*
retention-days: 7 retention-days: 7
build-wheels: build-wheels:
needs: needs:
- build-shared-libs - build-shared-libs
- build-shared-libs-cuda - build-shared-libs-cuda
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
...@@ -168,48 +168,48 @@ jobs: ...@@ -168,48 +168,48 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
# Check out code # Check out code
- uses: actions/checkout@v4 - uses: actions/checkout@v4
# Download shared libraries # Download shared libraries
- name: Download build artifact - name: Download build artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
merge-multiple: true merge-multiple: true
pattern: "shared_library*_${{ matrix.os }}_${{ matrix.arch }}*" pattern: "shared_library*_${{ matrix.os }}_${{ matrix.arch }}*"
path: output/ path: output/
- name: Copy correct platform shared library - name: Copy correct platform shared library
shell: bash shell: bash
run: | run: |
ls -lR output/ ls -lR output/
cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/ cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/
# Set up the Python version needed # Set up the Python version needed
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache: pip cache: pip
- name: Install build package - name: Install build package
shell: bash shell: bash
run: pip install build run: pip install build
- name: Install Python test dependencies - name: Install Python test dependencies
shell: bash shell: bash
run: pip install -r requirements-ci.txt run: pip install -r requirements-ci.txt
# TODO: How to run CUDA tests on GitHub actions? # TODO: How to run CUDA tests on GitHub actions?
#- name: Run unit tests #- name: Run unit tests
# if: ${{ matrix.arch == 'x86_64' }} # Tests are too slow to run in emulation. Wait for real aarch64 agents # if: ${{ matrix.arch == 'x86_64' }} # Tests are too slow to run in emulation. Wait for real aarch64 agents
# run: | # run: |
# PYTHONPATH=. pytest --log-cli-level=DEBUG tests # PYTHONPATH=. pytest --log-cli-level=DEBUG tests
- name: Build wheel - name: Build wheel
shell: bash shell: bash
run: python -m build . run: python -m build .
- name: Determine and Set Platform Tag, then Tag Wheel - name: Determine and Set Platform Tag, then Tag Wheel
shell: bash shell: bash
run: | run: |
PLATFORM_TAG=$(python scripts/set_platform_tag.py ${{ matrix.arch }}) PLATFORM_TAG=$(python scripts/set_platform_tag.py ${{ matrix.arch }})
echo "PLATFORM_TAG=$PLATFORM_TAG" echo "PLATFORM_TAG=$PLATFORM_TAG"
wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl
- name: Upload build artifact - name: Upload build artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }} name: bdist_wheel_${{ matrix.os }}_${{ matrix.arch }}
path: dist/bitsandbytes-*.whl path: dist/bitsandbytes-*.whl
retention-days: 7 retention-days: 7
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