Skip to content

Commit 78a8478

Browse files
CI: misc cleanup/improvement (#1976)
* CI: simplify build workflows/scripts * cuda build: more slim install of gcc 11 toolchain * build/packaging: further simplify * linux cuda: build in parallel * More simplification
1 parent aee0ebb commit 78a8478

6 files changed

Lines changed: 35 additions & 80 deletions

File tree

.github/scripts/build-cpu.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ set -xeuo pipefail
44
: "${RUNNER_OS:?RUNNER_OS must be set (Linux/Windows/macOS)}"
55
: "${RUNNER_ARCH:?RUNNER_ARCH must be set (X64/ARM64)}"
66

7-
if [[ "${RUNNER_OS}" == "Windows" ]]; then
8-
pip install cmake==3.30.9
9-
else
10-
pip install cmake==3.28.3
11-
fi
12-
137
if [ "${RUNNER_OS}" == "macOS" ] && [ "${RUNNER_ARCH}" == "ARM64" ]; then
148
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu .
159
else

.github/scripts/build-cuda.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,18 @@ else
2626
[[ "${CUDA_VERSION}" == 13.*.* ]] && build_capability="75;80;86;89;90;100;120"
2727
fi
2828

29-
[[ "${RUNNER_OS}" == "Windows" ]] && python3 -m pip install ninja
30-
3129
if [ "${RUNNER_OS}" == "Linux" ]; then
3230
# We'll use Rocky Linux 8 in order to maintain manylinux 2.24 compatibility.
3331
image="nvidia/cuda:${CUDA_VERSION}-devel-rockylinux8"
3432
echo "Using image $image"
3533

3634
docker run -i -w /src -v "$PWD:/src" "$image" bash -c \
3735
"dnf -y --refresh update --security \
38-
&& dnf -y install cmake gcc-toolset-11 --setopt=install_weak_deps=False --setopt=tsflags=nodocs \
36+
&& dnf -y install cmake gcc-toolset-11-toolchain --setopt=install_weak_deps=False --setopt=tsflags=nodocs \
3937
&& source scl_source enable gcc-toolset-11 \
4038
&& cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" . \
41-
&& cmake --build . --config Release"
39+
&& cmake --build . --config Release --parallel"
4240
else
43-
pip install cmake==3.28.3
4441
cmake -G Ninja -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY="${build_capability}" -DCMAKE_BUILD_TYPE=Release -S .
4542
cmake --build . --config Release
4643
fi

.github/scripts/build-rocm.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ if [ "${RUNNER_OS}" == "Linux" ]; then
1717
echo "Using image $image"
1818
docker run --rm -i \
1919
-w /src -v "$PWD:/src" "$image" sh -c \
20-
"apt-get update \
21-
&& pip install cmake==3.31.6 \
20+
"pip install cmake==3.31.6 \
2221
&& cmake -DCOMPUTE_BACKEND=hip -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_HIP_FLAGS=\"--offload-compress\" -DBNB_ROCM_ARCH=\"${bnb_rocm_arch}\" . \
23-
&& cmake --build ."
22+
&& cmake --build . --parallel"
2423
else
2524
bnb_rocm_arch="gfx1100;gfx1101;gfx1102;gfx1150;gfx1151;gfx1200;gfx1201"
2625

.github/scripts/build-xpu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ "${RUNNER_OS}" == "Linux" ]; then
1414
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
1515
cmake bison intel-fw-gpu intel-ocloc \
1616
&& cmake -DCOMPUTE_BACKEND=xpu . \
17-
&& cmake --build . --config Release"
17+
&& cmake --build . --config Release --parallel"
1818
fi
1919

2020
output_dir="output/${RUNNER_OS}/X64"

.github/workflows/python-package.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
steps:
3737
- uses: actions/checkout@v4
3838
- name: Setup MSVC
39-
if: startsWith(matrix.os, 'windows')
39+
if: runner.os == 'Windows'
4040
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
4141
with:
4242
arch: ${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }}
@@ -48,6 +48,7 @@ jobs:
4848
name: shared_library_${{ runner.os }}_${{ runner.arch }}
4949
path: output/*
5050
retention-days: 7
51+
if-no-files-found: error
5152

5253
##
5354
# This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64)
@@ -64,7 +65,7 @@ jobs:
6465
- uses: actions/checkout@v4
6566
# Windows: We install Cuda on the agent (slow)
6667
- uses: Jimver/cuda-toolkit@3d45d157f327c09c04b50ee6ccdea2d9d017ec76 # v0.2.35
67-
if: startsWith(matrix.os, 'windows')
68+
if: runner.os == 'Windows'
6869
id: cuda-toolkit
6970
with:
7071
cuda: ${{ matrix.cuda_version }}
@@ -75,7 +76,7 @@ jobs:
7576
use-local-cache: false
7677
log-file-suffix: ${{ runner.os }}-${{ runner.arch }}-${{matrix.cuda_version}}.txt
7778
- name: Setup MSVC
78-
if: startsWith(matrix.os, 'windows')
79+
if: runner.os == 'Windows'
7980
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
8081
with:
8182
toolset: "14.44"
@@ -89,6 +90,7 @@ jobs:
8990
name: shared_library_cuda_${{ runner.os }}_${{ runner.arch }}_${{ matrix.cuda_version }}
9091
path: output/*
9192
retention-days: 7
93+
if-no-files-found: error
9294

9395
build-xpu:
9496
strategy:
@@ -110,6 +112,7 @@ jobs:
110112
name: shared_library_xpu_${{ runner.os }}_${{ runner.arch }}
111113
path: output/*
112114
retention-days: 7
115+
if-no-files-found: error
113116

114117
build-rocm:
115118
strategy:
@@ -123,7 +126,7 @@ jobs:
123126
steps:
124127
- uses: actions/checkout@v4
125128
- name: Clean up disk space
126-
if: startsWith(matrix.os, 'ubuntu')
129+
if: runner.os == 'Linux'
127130
run: |
128131
echo "Disk space before cleanup:"
129132
df -h
@@ -140,7 +143,7 @@ jobs:
140143
echo "Disk space after cleanup:"
141144
df -h
142145
- name: Setup MSVC
143-
if: startsWith(matrix.os, 'windows')
146+
if: runner.os == 'Windows'
144147
uses: ilammy/msvc-dev-cmd@v1.13.0
145148
with:
146149
toolset: "14.44"
@@ -154,6 +157,7 @@ jobs:
154157
name: shared_library_rocm_${{ runner.os }}_${{ runner.arch }}_${{ matrix.rocm_version }}
155158
path: output/*
156159
retention-days: 7
160+
if-no-files-found: error
157161

158162
build-wheels:
159163
env:
@@ -187,11 +191,10 @@ jobs:
187191
- name: Set up Python
188192
uses: actions/setup-python@v5
189193
with:
190-
# Python for Windows ARM64 is only available from 3.12+
191-
python-version: ${{ matrix.os == 'windows-11-arm' && '3.12' || '3.10' }}
194+
python-version: "3.12"
192195
cache: pip
193196
- run: pip install build wheel
194-
- run: python -m build .
197+
- run: python -m build -w .
195198
- name: Determine and Set Platform Tag, then Tag Wheel
196199
shell: bash
197200
run: |
@@ -204,6 +207,8 @@ jobs:
204207
name: bdist_wheel_${{ runner.os }}_${{ runner.arch }}
205208
path: dist/bitsandbytes-*.whl
206209
retention-days: 7
210+
if-no-files-found: error
211+
compression-level: 0
207212

208213
upload-pre-release-wheels:
209214
name: Create release and upload artifacts

.github/workflows/test-runner.yml

Lines changed: 17 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -53,82 +53,41 @@ jobs:
5353
id: config
5454
shell: bash
5555
run: |
56-
# Map platform to OS identifiers, architecture, and test runner
56+
# Map platform to test runner
5757
case "${{ inputs.platform }}" in
5858
linux-x64)
59-
BUILD_OS="ubuntu-22.04"
60-
ARCH="x64"
6159
if [[ "${{ inputs.backend }}" == "cuda" ]]; then
6260
case "${{ inputs.gpu_type }}" in
63-
T4)
64-
TEST_RUNNER="bandb-aws-g4dn-4xlarge-plus-use1-public-80"
65-
;;
66-
A10)
67-
TEST_RUNNER="bandb-aws-g5-4xlarge-plus-use1-public-80"
68-
;;
69-
L40S)
70-
TEST_RUNNER="bandb-aws-g6e-4xlarge-plus-use1-public-80"
71-
;;
72-
*)
73-
echo "::error::Must specify gpu_type (T4, A10, L40S) for linux-x64 cuda backend"
74-
exit 1
75-
;;
61+
T4) TEST_RUNNER="bandb-aws-g4dn-4xlarge-plus-use1-public-80" ;;
62+
A10) TEST_RUNNER="bandb-aws-g5-4xlarge-plus-use1-public-80" ;;
63+
L40S) TEST_RUNNER="bandb-aws-g6e-4xlarge-plus-use1-public-80" ;;
64+
*) echo "::error::Must specify gpu_type (T4, A10, L40S) for linux-x64 cuda backend"; exit 1 ;;
7665
esac
7766
else
7867
case "${{ inputs.cpu_type }}" in
79-
icelake)
80-
TEST_RUNNER="banb-aws-general-8-plus-use1-public-80"
81-
;;
82-
cascadelake)
83-
TEST_RUNNER="bandb-aws-g4dn-4xlarge-plus-use1-public-80"
84-
;;
85-
"")
86-
TEST_RUNNER="ubuntu-22.04"
87-
;;
88-
*)
89-
echo "::error::Invalid cpu_type: ${{ inputs.cpu_type }}"
90-
exit 1
91-
;;
68+
icelake) TEST_RUNNER="banb-aws-general-8-plus-use1-public-80" ;;
69+
cascadelake) TEST_RUNNER="bandb-aws-g4dn-4xlarge-plus-use1-public-80" ;;
70+
"") TEST_RUNNER="ubuntu-22.04" ;;
71+
*) echo "::error::Invalid cpu_type: ${{ inputs.cpu_type }}"; exit 1 ;;
9272
esac
9373
fi
9474
;;
95-
linux-aarch64)
96-
BUILD_OS="ubuntu-22.04-arm"
97-
ARCH="aarch64"
98-
TEST_RUNNER="ubuntu-22.04-arm"
99-
;;
100-
macos)
101-
BUILD_OS="macos-15"
102-
ARCH="arm64"
103-
TEST_RUNNER="macos-15"
104-
;;
75+
linux-aarch64) TEST_RUNNER="ubuntu-22.04-arm" ;;
76+
macos) TEST_RUNNER="macos-15" ;;
10577
windows)
106-
BUILD_OS="windows-2025"
107-
ARCH="x64"
108-
if [[ "${{ inputs.backend }}" == "cuda" ]]; then
109-
TEST_RUNNER="CUDA-Windows-x64"
110-
else
111-
TEST_RUNNER="windows-2025"
112-
fi
113-
;;
114-
windows-arm64)
115-
BUILD_OS="windows-11-arm"
116-
ARCH="arm64"
117-
TEST_RUNNER="windows-11-arm"
78+
[[ "${{ inputs.backend }}" == "cuda" ]] && TEST_RUNNER="CUDA-Windows-x64" || TEST_RUNNER="windows-2025"
11879
;;
80+
windows-arm64) TEST_RUNNER="windows-11-arm" ;;
11981
*)
12082
echo "::error::Unsupported platform: ${{ inputs.platform }}"
12183
exit 1
12284
;;
12385
esac
12486
12587
# Create unique artifact name per configuration
126-
ARTIFACT="lib_${{ inputs.backend }}_${BUILD_OS}_${ARCH}"
127-
if [[ "${{ inputs.backend }}" == "cuda" ]]; then
128-
ARTIFACT="${ARTIFACT}_${{ inputs.cuda_version }}_${{ inputs.gpu_type }}"
129-
else
130-
ARTIFACT="${ARTIFACT}_${{ inputs.cpu_type }}"
131-
fi
88+
ARTIFACT="lib_${{ inputs.backend }}_${RUNNER_OS}_${RUNNER_ARCH}"
89+
[[ "${{ inputs.backend }}" == "cuda" ]] && ARTIFACT="${ARTIFACT}_${{ inputs.cuda_version }}_${{ inputs.gpu_type }}"
90+
[[ "${{ inputs.backend }}" == "cpu" ]] && ARTIFACT="${ARTIFACT}_${{ inputs.cpu_type }}"
13291
ARTIFACT="${ARTIFACT}_torch${{ inputs.torch_version }}_${{ github.run_id }}_${{ github.run_attempt }}"
13392
13493
echo "test_runner=${TEST_RUNNER}" >> $GITHUB_OUTPUT
@@ -174,6 +133,7 @@ jobs:
174133
name: ${{ steps.config.outputs.artifact_name }}
175134
path: output/${{ runner.os }}/${{ runner.arch }}/*
176135
retention-days: 7
136+
if-no-files-found: error
177137

178138
test:
179139
needs: build

0 commit comments

Comments
 (0)