@@ -3,28 +3,27 @@ name: Python package
3
3
on :
4
4
push : {}
5
5
pull_request :
6
- branches : [ main ]
6
+ branches : [main]
7
7
paths :
8
- - ' .github/workflows/python-package.yml'
9
- - ' bitsandbytes/**'
10
- - ' csrc/**'
11
- - ' include/**'
12
- - ' tests/**'
13
- - ' CMakeLists.txt'
14
- - ' requirements*.txt'
15
- - ' setup.py'
16
- - ' pyproject.toml'
17
- - ' pytest.ini'
8
+ - " .github/workflows/python-package.yml"
9
+ - " bitsandbytes/**"
10
+ - " csrc/**"
11
+ - " include/**"
12
+ - " tests/**"
13
+ - " CMakeLists.txt"
14
+ - " requirements*.txt"
15
+ - " setup.py"
16
+ - " pyproject.toml"
17
+ - " pytest.ini"
18
18
release :
19
- types : [ published ]
20
- workflow_dispatch : {} # Allow manual trigger
19
+ types : [published]
20
+ workflow_dispatch : {} # Allow manual trigger
21
21
22
22
concurrency :
23
23
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
24
24
cancel-in-progress : true
25
25
26
26
jobs :
27
-
28
27
# #
29
28
# This job matrix builds the non-CUDA versions of the libraries for all supported platforms.
30
29
# #
@@ -39,42 +38,42 @@ jobs:
39
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
40
39
steps :
41
40
# Check out code
42
- - uses : actions/checkout@v4
43
- # On Linux we use CMake within Docker
44
- - name : Setup cmake
45
- uses : jwlawson/actions-setup-cmake@v1.14
46
- with :
47
- cmake-version : ' 3.26.x'
48
- - name : Setup MSVC
49
- if : startsWith(matrix.os, 'windows')
50
- # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
51
- uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
52
- # Compile C++ code
53
- - name : Build C++
54
- shell : bash
55
- run : |
56
- set -ex
57
- build_os=${{ matrix.os }}
58
- build_arch=${{ matrix.arch }}
59
- if [ ${build_os:0:6} == ubuntu -a ${build_arch} == aarch64 ]; then
60
- # Allow cross-compile on aarch64
61
- sudo apt-get update
62
- sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu g++-aarch64-linux-gnu
63
- cmake -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCOMPUTE_BACKEND=cpu .
64
- elif [ ${build_os:0:5} == macos -a ${build_arch} == aarch64 ]; then
65
- cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCOMPUTE_BACKEND=cpu .
66
- else
67
- cmake -DCOMPUTE_BACKEND=cpu .
68
- fi
69
- cmake --build . --config Release
70
- mkdir -p output/${{ matrix.os }}/${{ matrix.arch }}
71
- ( shopt -s nullglob && cp bitsandbytes/*.{so,dylib,dll} output/${{ matrix.os }}/${{ matrix.arch }}/ )
72
- - name : Upload build artifact
73
- uses : actions/upload-artifact@v4
74
- with :
75
- name : shared_library_${{ matrix.os }}_${{ matrix.arch }}
76
- path : output/*
77
- retention-days : 7
41
+ - 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
+ - name : Setup MSVC
48
+ if : startsWith(matrix.os, 'windows')
49
+ # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
50
+ uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
51
+ # Compile C++ code
52
+ - 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 }}/ )
71
+ - name : Upload build artifact
72
+ uses : actions/upload-artifact@v4
73
+ with :
74
+ name : shared_library_${{ matrix.os }}_${{ matrix.arch }}
75
+ path : output/*
76
+ retention-days : 7
78
77
# #
79
78
# This job matrix builds the CUDA versions of the libraries for platforms that support CUDA (Linux x64/aarch64 + Windows x64)
80
79
# #
83
82
matrix :
84
83
os : [ubuntu-latest, windows-latest]
85
84
arch : [x86_64, aarch64]
86
- cuda_version : ["11.7.1", "11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2"]
85
+ cuda_version :
86
+ ["11.7.1", "11.8.0", "12.0.1", "12.1.1", "12.2.2", "12.3.2"]
87
87
exclude :
88
88
- os : windows-latest # This probably requires arm64 Windows agents
89
89
arch : aarch64
@@ -92,68 +92,68 @@ jobs:
92
92
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
93
steps :
94
94
# Check out code
95
- - uses : actions/checkout@v4
96
- # Linux: We use Docker to build cross platform Cuda (aarch64 is built in emulation)
97
- - name : Set up Docker multiarch
98
- if : startsWith(matrix.os, 'ubuntu')
99
- 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
- # Windows: We install Cuda on the agent (slow)
107
- - uses : Jimver/cuda-toolkit@v0.2.14
108
- if : startsWith(matrix.os, 'windows')
109
- id : cuda-toolkit
110
- with :
111
- cuda : ${{ matrix.cuda_version }}
112
- method : ' network'
113
- sub-packages : ' ["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]'
114
- linux-local-args : ' ["--toolkit"]'
115
- use-github-cache : false
116
- - name : Setup MSVC
117
- if : startsWith(matrix.os, 'windows')
118
- # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
119
- uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
120
- # Compile C++ code
121
- - 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 }}/ )
147
- - name : Upload build artifact
148
- uses : actions/upload-artifact@v4
149
- with :
150
- name : shared_library_cuda_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.cuda_version }}
151
- path : output/*
152
- retention-days : 7
95
+ - uses : actions/checkout@v4
96
+ # Linux: We use Docker to build cross platform Cuda (aarch64 is built in emulation)
97
+ - name : Set up Docker multiarch
98
+ if : startsWith(matrix.os, 'ubuntu')
99
+ 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
+ # Windows: We install Cuda on the agent (slow)
107
+ - uses : Jimver/cuda-toolkit@v0.2.14
108
+ if : startsWith(matrix.os, 'windows')
109
+ id : cuda-toolkit
110
+ with :
111
+ cuda : ${{ matrix.cuda_version }}
112
+ method : " network"
113
+ sub-packages : ' ["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]'
114
+ linux-local-args : ' ["--toolkit"]'
115
+ use-github-cache : false
116
+ - name : Setup MSVC
117
+ if : startsWith(matrix.os, 'windows')
118
+ # uses: microsoft/setup-msbuild@v1.1 # to use msbuild
119
+ uses : ilammy/msvc-dev-cmd@v1.13.0 # to use cl
120
+ # Compile C++ code
121
+ - 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 }}/ )
147
+ - name : Upload build artifact
148
+ uses : actions/upload-artifact@v4
149
+ with :
150
+ name : shared_library_cuda_${{ matrix.os }}_${{ matrix.arch }}_${{ matrix.cuda_version }}
151
+ path : output/*
152
+ retention-days : 7
153
153
build-wheels :
154
154
needs :
155
- - build-shared-libs
156
- - build-shared-libs-cuda
155
+ - build-shared-libs
156
+ - build-shared-libs-cuda
157
157
strategy :
158
158
matrix :
159
159
os : [ubuntu-latest, macos-latest, windows-latest]
@@ -168,48 +168,48 @@ jobs:
168
168
runs-on : ${{ matrix.os }}
169
169
steps :
170
170
# Check out code
171
- - uses : actions/checkout@v4
172
- # Download shared libraries
173
- - name : Download build artifact
174
- uses : actions/download-artifact@v4
175
- with :
176
- merge-multiple : true
177
- pattern : " shared_library*_${{ matrix.os }}_${{ matrix.arch }}*"
178
- path : output/
179
- - name : Copy correct platform shared library
180
- shell : bash
181
- run : |
182
- ls -lR output/
183
- cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/
184
- # Set up the Python version needed
185
- - name : Set up Python ${{ matrix.python-version }}
186
- uses : actions/setup-python@v5
187
- with :
188
- python-version : ${{ matrix.python-version }}
189
- 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 .
204
- - name : Determine and Set Platform Tag, then Tag Wheel
205
- shell : bash
206
- run : |
207
- PLATFORM_TAG=$(python scripts/set_platform_tag.py ${{ matrix.arch }})
208
- echo "PLATFORM_TAG=$PLATFORM_TAG"
209
- wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl
210
- - name : Upload build artifact
211
- uses : actions/upload-artifact@v4
212
- with :
213
- name : bdist_wheel_${{ matrix.os }}_${{ matrix.arch }}
214
- path : dist/bitsandbytes-*.whl
215
- retention-days : 7
171
+ - uses : actions/checkout@v4
172
+ # Download shared libraries
173
+ - name : Download build artifact
174
+ uses : actions/download-artifact@v4
175
+ with :
176
+ merge-multiple : true
177
+ pattern : " shared_library*_${{ matrix.os }}_${{ matrix.arch }}*"
178
+ path : output/
179
+ - name : Copy correct platform shared library
180
+ shell : bash
181
+ run : |
182
+ ls -lR output/
183
+ cp output/${{ matrix.os }}/${{ matrix.arch }}/* bitsandbytes/
184
+ # Set up the Python version needed
185
+ - name : Set up Python ${{ matrix.python-version }}
186
+ uses : actions/setup-python@v5
187
+ with :
188
+ python-version : ${{ matrix.python-version }}
189
+ 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 .
204
+ - name : Determine and Set Platform Tag, then Tag Wheel
205
+ shell : bash
206
+ run : |
207
+ PLATFORM_TAG=$(python scripts/set_platform_tag.py ${{ matrix.arch }})
208
+ echo "PLATFORM_TAG=$PLATFORM_TAG"
209
+ wheel tags --remove --abi-tag=none --python-tag=py3 --platform-tag=$PLATFORM_TAG dist/bitsandbytes-*.whl
210
+ - name : Upload build artifact
211
+ uses : actions/upload-artifact@v4
212
+ with :
213
+ name : bdist_wheel_${{ matrix.os }}_${{ matrix.arch }}
214
+ path : dist/bitsandbytes-*.whl
215
+ retention-days : 7
0 commit comments