@@ -37,37 +37,15 @@ jobs:
37
37
arch : aarch64
38
38
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
39
39
steps :
40
- # Check out code
41
40
- uses : actions/checkout@v4
42
- # On Linux we use CMake within Docker
43
- - name : Setup cmake
44
- uses : jwlawson/actions-setup-cmake@v1.14
45
- with :
46
- cmake-version : " 3.26.x"
47
41
- name : Setup MSVC
48
42
if : startsWith(matrix.os, 'windows')
49
- # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
50
43
uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
51
- # Compile C++ code
52
44
- name : Build C++
53
- shell : bash
54
- run : |
55
- set -ex
56
- build_os=${{ matrix.os }}
57
- build_arch=${{ matrix.arch }}
58
- if [ ${build_os:0:6} == ubuntu -a ${build_arch} == aarch64 ]; then
59
- # Allow cross-compile on aarch64
60
- sudo apt-get update
61
- sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
62
- cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCOMPUTE_BACKEND=cpu .
63
- elif [ ${build_os:0:5} == macos -a ${build_arch} == aarch64 ]; then
64
- cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu .
65
- else
66
- cmake -DCOMPUTE_BACKEND=cpu .
67
- fi
68
- cmake --build . --config Release
69
- mkdir -p output/${{ matrix.os }}/${{ matrix.arch }}
70
- ( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ )
45
+ run : bash .github/scripts/build-cpu.sh
46
+ env :
47
+ build_os : ${{ matrix.os }}
48
+ build_arch : ${{ matrix.arch }}
71
49
- name : Upload build artifact
72
50
uses : actions/upload-artifact@v4
73
51
with :
@@ -91,18 +69,11 @@ jobs:
91
69
arch : aarch64
92
70
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
93
71
steps :
94
- # Check out code
95
72
- uses : actions/checkout@v4
96
73
# Linux: We use Docker to build cross platform Cuda (aarch64 is built in emulation)
97
74
- name : Set up Docker multiarch
98
75
if : startsWith(matrix.os, 'ubuntu')
99
76
uses : docker/setup-qemu-action@v2
100
- # On Linux we use CMake within Docker
101
- - name : Setup cmake
102
- if : ${{ !startsWith(matrix.os, 'linux') }}
103
- uses : jwlawson/actions-setup-cmake@v1.14
104
- with :
105
- cmake-version : " 3.26.x"
106
77
# Windows: We install Cuda on the agent (slow)
107
78
- uses : Jimver/cuda-toolkit@v0.2.14
108
79
if : startsWith(matrix.os, 'windows')
@@ -115,35 +86,13 @@ jobs:
115
86
use-github-cache : false
116
87
- name : Setup MSVC
117
88
if : startsWith(matrix.os, 'windows')
118
- # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
119
89
uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
120
- # Compile C++ code
121
90
- name : Build C++
122
- shell : bash
123
- run : |
124
- set -ex
125
- build_os=${{ matrix.os }}
126
- build_arch=${{ matrix.arch }}
127
- build_capability="50;52;60;61;70;75;80;86;89;90"
128
- [[ "${{ matrix.cuda_version }}" == 11.7.* ]] && build_capability=${build_capability%??????}
129
- [[ "${{ matrix.cuda_version }}" == 11.8.* ]] && build_capability=${build_capability%???}
130
- [[ "${{ matrix.os }}" = windows-* ]] && python3 -m pip install ninja
131
- for NO_CUBLASLT in ON OFF; do
132
- if [ ${build_os:0:6} == ubuntu ]; then
133
- image=nvidia/cuda:${{ matrix.cuda_version }}-devel-ubuntu22.04
134
- echo "Using image $image"
135
- docker run --platform linux/$build_arch -i -w /src -v $PWD:/src $image sh -c \
136
- "apt-get update \
137
- && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends cmake \
138
- && cmake -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY=\"${build_capability}\" -DNO_CUBLASLT=${NO_CUBLASLT} . \
139
- && cmake --build ."
140
- else
141
- cmake -G Ninja -DCOMPUTE_BACKEND=cuda -DCOMPUTE_CAPABILITY="${build_capability}" -DNO_CUBLASLT=${NO_CUBLASLT} -DCMAKE_BUILD_TYPE=Release -S .
142
- cmake --build . --config Release
143
- fi
144
- done
145
- mkdir -p output/${{ matrix.os }}/${{ matrix.arch }}
146
- ( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ )
91
+ run : bash .github/scripts/build-cuda.sh
92
+ env :
93
+ build_os : ${{ matrix.os }}
94
+ build_arch : ${{ matrix.arch }}
95
+ cuda_version : ${{ matrix.cuda_version }}
147
96
- name : Upload build artifact
148
97
uses : actions/upload-artifact@v4
149
98
with :
@@ -167,9 +116,7 @@ jobs:
167
116
arch : aarch64
168
117
runs-on : ${{ matrix.os }}
169
118
steps :
170
- # Check out code
171
119
- uses : actions/checkout@v4
172
- # Download shared libraries
173
120
- name : Download build artifact
174
121
uses : actions/download-artifact@v4
175
122
with :
@@ -181,30 +128,17 @@ jobs:
181
128
run : |
182
129
ls -lR output/
183
130
cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/
184
- # Set up the Python version needed
185
131
- name : Set up Python ${{ matrix.python-version }}
186
132
uses : actions/setup-python@v5
187
133
with :
188
134
python-version : ${{ matrix.python-version }}
189
135
cache : pip
190
- - name : Install build package
191
- shell : bash
192
- run : pip install build
193
- - name : Install Python test dependencies
194
- shell : bash
195
- run : pip install -r requirements-ci.txt
196
- # TODO: How to run CUDA tests on GitHub actions?
197
- # - name: Run unit tests
198
- # if: ${{ matrix.arch == 'x86_64' }} # Tests are too slow to run in emulation. Wait for real aarch64 agents
199
- # run: |
200
- # PYTHONPATH=. pytest --log-cli-level=DEBUG tests
201
- - name : Build wheel
202
- shell : bash
203
- run : python -m build .
136
+ - run : pip install build wheel
137
+ - run : python -m build .
204
138
- name : Determine and Set Platform Tag, then Tag Wheel
205
139
shell : bash
206
140
run : |
207
- PLATFORM_TAG=$(python scripts/set_platform_tag.py ${{ matrix.arch }})
141
+ PLATFORM_TAG=$(python .github/ scripts/set_platform_tag.py " ${{ matrix.arch }}" )
208
142
echo "PLATFORM_TAG=$PLATFORM_TAG"
209
143
wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl
210
144
- name : Upload build artifact
0 commit comments