"git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "220b69ba0c7be3090c60a44e68a769ed4e5aa433"
Unverified Commit 5c0ba851 authored by Younes Belkada's avatar Younes Belkada Committed by GitHub
Browse files

Merge pull request #1011 from akx/tweak-cmake-build-1

Optimize Cmake build slightly
parents 3ba076d3 6ec25206
...@@ -9,6 +9,7 @@ concurrency: ...@@ -9,6 +9,7 @@ concurrency:
jobs: jobs:
build: build:
if: github.repository == 'TimDettmers/bitsandbytes'
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
with: with:
commit_sha: ${{ github.event.pull_request.head.sha }} commit_sha: ${{ github.event.pull_request.head.sha }}
......
...@@ -6,6 +6,10 @@ on: ...@@ -6,6 +6,10 @@ on:
pull_request: pull_request:
branches: [ "main" ] branches: [ "main" ]
concurrency:
group: cmake-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
build: build:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
...@@ -16,29 +20,11 @@ jobs: ...@@ -16,29 +20,11 @@ jobs:
matrix: matrix:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
python-version: ['3.10', '3.11']
cuda-version: ['11.8', '12.1'] cuda-version: ['11.8', '12.1']
build_type: [Release] build_type: [Release]
c_compiler: [gcc, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
exclude:
- os: ubuntu-latest
c_compiler: cl
- os: windows-latest
c_compiler: gcc
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up MSVC - name: Set up MSVC
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
...@@ -61,7 +47,7 @@ jobs: ...@@ -61,7 +47,7 @@ jobs:
environment-file: environment-bnb.yml environment-file: environment-bnb.yml
use-only-tar-bz2: false use-only-tar-bz2: false
auto-activate-base: true auto-activate-base: true
python-version: ${{ matrix.python-version }} python-version: "3.10"
mamba-version: "*" mamba-version: "*"
- name: Set reusable strings - name: Set reusable strings
...@@ -97,8 +83,13 @@ jobs: ...@@ -97,8 +83,13 @@ jobs:
echo CUDA_PATH=$CUDA_HOME >> "$GITHUB_ENV" echo CUDA_PATH=$CUDA_HOME >> "$GITHUB_ENV"
if [ "${{ matrix.os }}" = "windows-latest" ]; then if [ "${{ matrix.os }}" = "windows-latest" ]; then
echo CXX_COMPILER=cl >> "$GITHUB_ENV"
echo C_COMPILER=cl >> "$GITHUB_ENV"
# without -DCMAKE_CUDA_COMPILER=nvcc, cmake config always fail for cuda-11.8 # without -DCMAKE_CUDA_COMPILER=nvcc, cmake config always fail for cuda-11.8
echo DCMAKE_CUDA_COMPILER=-DCMAKE_CUDA_COMPILER=nvcc >> "$GITHUB_ENV" echo DCMAKE_CUDA_COMPILER=-DCMAKE_CUDA_COMPILER=nvcc >> "$GITHUB_ENV"
else
echo CXX_COMPILER=g++ >> "$GITHUB_ENV"
echo C_COMPILER=gcc >> "$GITHUB_ENV"
fi fi
nvcc --version nvcc --version
...@@ -109,26 +100,27 @@ jobs: ...@@ -109,26 +100,27 @@ jobs:
- name: Prep build - name: Prep build
run: python -m pip install cmake==3.27.9 ninja setuptools wheel run: python -m pip install cmake==3.27.9 ninja setuptools wheel
- name: Configure CMake # TODO: the following steps (CUDA, NOBLASLT, CPU) could be moved to the matrix, so they're built in parallel
- name: Configure CUDA
run: > run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }} cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja ${{ env.DCMAKE_CUDA_COMPILER }} -G Ninja ${{ env.DCMAKE_CUDA_COMPILER }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_CXX_COMPILER=${{ env.CXX_COMPILER }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_C_COMPILER=${{ env.C_COMPILER }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCOMPUTE_CAPABILITY="50;52;60;61;62;70;72;75;80;86;87;89;90" -DCOMPUTE_CAPABILITY="50;52;60;61;62;70;72;75;80;86;87;89;90"
-S ${{ github.workspace }} -S ${{ github.workspace }}
- name: Build - name: Build CUDA
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Configure NOBLASLT - name: Configure NOBLASLT
run: > run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }} cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja ${{ env.DCMAKE_CUDA_COMPILER }} -G Ninja ${{ env.DCMAKE_CUDA_COMPILER }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_CXX_COMPILER=${{ env.CXX_COMPILER }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_C_COMPILER=${{ env.C_COMPILER }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCOMPUTE_CAPABILITY="50;52;60;61;62;70;72;75;80;86;87;89;90" -DCOMPUTE_CAPABILITY="50;52;60;61;62;70;72;75;80;86;87;89;90"
-DNO_CUBLASLT=ON -DNO_CUBLASLT=ON
...@@ -141,8 +133,8 @@ jobs: ...@@ -141,8 +133,8 @@ jobs:
run: > run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }} cmake -B ${{ steps.strings.outputs.build-output-dir }}
-G Ninja ${{ env.DCMAKE_CUDA_COMPILER }} -G Ninja ${{ env.DCMAKE_CUDA_COMPILER }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} -DCMAKE_CXX_COMPILER=${{ env.CXX_COMPILER }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} -DCMAKE_C_COMPILER=${{ env.C_COMPILER }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DNO_CUBLASLT=ON -DNO_CUBLASLT=ON
-DBUILD_CUDA=OFF -DBUILD_CUDA=OFF
...@@ -151,12 +143,6 @@ jobs: ...@@ -151,12 +143,6 @@ jobs:
- name: Build CPU - name: Build CPU
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
- name: Build dist - name: Build dist
shell: bash -el {0} shell: bash -el {0}
run: | run: |
...@@ -168,6 +154,6 @@ jobs: ...@@ -168,6 +154,6 @@ jobs:
- name: Upload Build Artifacts - name: Upload Build Artifacts
uses: actions/upload-artifact@v4.3.0 uses: actions/upload-artifact@v4.3.0
with: with:
name: bitsandbytes-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.cuda-version }} name: bitsandbytes-${{ matrix.os }}-${{ matrix.cuda-version }}
path: | path: |
${{ github.workspace }}/dist/ ${{ github.workspace }}/dist/
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