forked from bitsandbytes-foundation/bitsandbytes
-
Notifications
You must be signed in to change notification settings - Fork 0
455 lines (388 loc) · 13.2 KB
/
tests.yml
File metadata and controls
455 lines (388 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
name: Nightly Tests
on:
workflow_dispatch:
schedule:
# Every day at 02:15 AM UTC
- cron: "15 2 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Skip rebuilding the CPU library when installing the wheels.
# We build the libraries in separate jobs and upload as artifacts.
BNB_SKIP_CMAKE: 1
jobs:
build-cpu:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025, macos-15]
include:
- os: ubuntu-22.04
arch: x86_64
- os: ubuntu-22.04-arm
arch: aarch64
- os: windows-2025
arch: x86_64
- os: macos-15
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup MSVC
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
- name: Build C++
run: bash .github/scripts/build-cpu.sh
env:
build_os: ${{ matrix.os }}
build_arch: ${{ matrix.arch }}
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: lib_cpu_${{ matrix.os }}_${{ matrix.arch }}
path: output/${{ matrix.os }}/${{ matrix.arch }}/*
retention-days: 7
build-cuda:
strategy:
matrix:
# TODO: Add 13.0.1 when we have runners with new enough drivers.
cuda_version: ["11.8.0", "12.6.3", "12.8.1", "12.9.1"]
os: [ubuntu-22.04, ubuntu-22.04-arm]
include:
- os: ubuntu-22.04
arch: x86_64
- os: ubuntu-22.04-arm
arch: aarch64
- os: windows-2025
arch: x86_64
cuda_version: "11.8.0"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install CUDA Toolkit
uses: Jimver/cuda-toolkit@c35baa1a18fd1fc9dcf47c5bd839bf30559c0bc3 # v0.2.24
if: startsWith(matrix.os, 'windows')
id: cuda-toolkit
with:
cuda: ${{ matrix.cuda_version }}
method: "network"
sub-packages: '["nvcc","cudart","cusparse","cublas","thrust","nvrtc_dev","cublas_dev","cusparse_dev"]'
use-github-cache: false
- name: Setup MSVC
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl
# Target just the architectures used for our runners.
- name: Build C++ / CUDA
run: bash .github/scripts/build-cuda.sh
env:
build_os: ${{ matrix.os }}
build_arch: ${{ matrix.arch }}
cuda_version: ${{ matrix.cuda_version }}
cuda_targets: "75;89"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: lib_cuda_${{matrix.cuda_version}}_${{ matrix.os }}_${{ matrix.arch }}
path: output/${{ matrix.os }}/${{ matrix.arch }}/*
retention-days: 7
test-cpu:
if: github.repository == 'bitsandbytes-foundation/bitsandbytes'
needs: build-cpu
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2025, macos-15]
# Test with the oldest supported torch version, the newest two stable/RC.
torch_version: ["2.3.1", "2.8.0", "2.9.0"]
include:
- os: ubuntu-22.04
arch: x86_64
runner: banb-aws-general-8-plus-use1-public-80
- os: ubuntu-22.04-arm
arch: aarch64
- os: ubuntu-22.04-arm
arch: aarch64
torch_version: "2.5.1" # Higher minimum requirement for aarch64
- os: windows-2025
arch: x86_64
- os: macos-15
arch: arm64
exclude:
- os: ubuntu-22.04-arm
torch_version: "2.3.1"
runs-on: ${{ matrix.runner || matrix.os }}
env:
BNB_TEST_DEVICE: cpu
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lib_cpu_${{ matrix.os }}_${{ matrix.arch }}
path: bitsandbytes/
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Setup MSVC
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1.13.0 # to use cl for torch.compile
- name: Install dependencies
run: |
pip install torch==${{ matrix.torch_version }} --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[test]" -v
pip install pytest-cov
# We need to downgrade to numpy<2 for torch<2.4.1 compatibility on Windows
# See: https://github.com/pytorch/pytorch/issues/131668
- name: Downgrade NumPy
if: startsWith(matrix.os, 'windows') && startsWith(matrix.torch_version, '2.3.')
run: pip install "numpy<2"
- name: Show installed packages
run: pip list
- name: Show environment information
run: python -m torch.utils.collect_env
- name: Run tests
run: pytest --durations=100
test-cpu-intel:
if: github.repository == 'bitsandbytes-foundation/bitsandbytes'
needs: build-cpu
runs-on: banb-aws-general-8-plus-use1-public-80
env:
BNB_TEST_DEVICE: cpu
steps:
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lib_cpu_ubuntu-22.04_x86_64
path: bitsandbytes/
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install torch==2.7.1 --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[test]" -v
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Show environment information
run: python -m torch.utils.collect_env
- name: Run tests
run: pytest --durations=100
# test-cuda-aarch64:
# if: github.repository == 'bitsandbytes-foundation/bitsandbytes'
# needs: build-cuda
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-22.04-arm]
# arch: [aarch64]
# torch_version: ["2.7.0"]
# cuda_version: ["11.8.0", "12.8.1"]
# runs-on: bandb-aws-g5g-4xlarge-plus-use1-public-80
# env:
# BNB_TEST_DEVICE: cuda
# steps:
# - name: Show GPU Information
# run: nvidia-smi
# - name: Show pip packages
# run: pip list
test-hpu:
if: false # github.repository == 'bitsandbytes-foundation/bitsandbytes'
needs: build-cpu
strategy:
fail-fast: false
matrix:
torch_version: ["2.6.0"]
runs-on:
group: bandb-itac-bmemr-gaudi3-1gaudi
env:
BNB_TEST_DEVICE: hpu
container:
image: vault.habana.ai/gaudi-docker/1.21.1/ubuntu22.04/habanalabs/pytorch-installer-2.6.0:latest
options: --runtime=habana --shm-size=64G --env HABANA_VISIBLE_DEVICES --env HABANA_VISIBLE_MODULES
env:
OMPI_MCA_btl_vader_single_copy_mechanism: none
BNB_TEST_DEVICE: hpu
steps:
- name: Show system information
run: |
echo "OS: $(uname -a)"
echo "CPU: $(lscpu | grep 'Model name')"
echo "Memory: $(free -h)"
- name: Show HPU Information
run: |
hl-smi
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lib_cpu_ubuntu-22.04_x86_64
path: bitsandbytes/
merge-multiple: true
- name: Show installed packages
run: pip list
- name: Install dependencies
run: |
pip install -e ".[test]" -v
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Show environment information
run: |
python -m torch.utils.collect_env
python -m bitsandbytes
- name: Run tests
run: pytest --durations=100
test-xpu:
if: false # github.repository == 'bitsandbytes-foundation/bitsandbytes'
needs: build-cpu
strategy:
fail-fast: false
matrix:
torch_version: ["2.7.1"] #["2.6.0", "2.7.1"]
runs-on:
group: bandb-itac-bmsprpvc1550-8-1gpu
env:
BNB_TEST_DEVICE: xpu
steps:
- name: Show system information
run: |
echo "OS: $(uname -a)"
echo "CPU: $(lscpu | grep 'Model name')"
echo "Memory: $(free -h)"
- name: Show XPU Information
run: |
xpu-smi discovery
sudo xpu-smi discovery
sudo apt-get install -y hwinfo
hwinfo --display
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lib_cpu_ubuntu-22.04_x86_64
path: bitsandbytes/
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install PyTorch
run: pip install torch==${{ matrix.torch_version }} --index-url https://download.pytorch.org/whl/xpu
- name: Install dependencies
run: |
pip install -e ".[test]" -v
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Show environment information
run: |
python -m torch.utils.collect_env
python -m bitsandbytes
# - name: Run tests
# run: pytest --durations=100
test-cuda:
if: github.repository == 'bitsandbytes-foundation/bitsandbytes'
needs: build-cuda
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2025]
arch: [x86_64]
gpu: [T4, L40S]
cuda_version: ["11.8.0", "12.6.3", "12.8.1", "12.9.1"] #, "13.0.1"]
include:
- cuda_version: "11.8.0"
torch_version: "2.3.1"
pypi_index: "https://download.pytorch.org/whl/cu118"
- cuda_version: "12.6.3"
torch_version: "2.6.0"
pypi_index: "https://download.pytorch.org/whl/cu126"
- cuda_version: "12.9.1"
torch_version: "2.8.0"
pypi_index: "https://download.pytorch.org/whl/cu129"
- cuda_version: "12.8.1"
torch_version: "2.9.0"
pypi_index: "https://download.pytorch.org/whl/test/cu128"
# Note: Currently our runners do not have new enough drivers for CUDA 13.
# Add this when supported.
# - cuda_version: "13.0.1"
# torch_version: "2.9.0"
# pypi_index: "https://download.pytorch.org/whl/test/cu130"
# Linux L40S runners
- os: ubuntu-22.04
gpu: L40S
runner: bandb-aws-g6e-4xlarge-plus-use1-public-80
# Linux T4 runners
- os: ubuntu-22.04
gpu: T4
runner: bandb-aws-g4dn-4xlarge-plus-use1-public-80
# Specific Windows runners using cu118
- os: windows-2025
arch: x86_64
gpu: T4
runner: CUDA-Windows-x64
cuda_version: "11.8.0"
torch_version: "2.3.1"
pypi_index: "https://download.pytorch.org/whl/cu118"
- os: windows-2025
arch: x86_64
gpu: T4
runner: CUDA-Windows-x64
cuda_version: "11.8.0"
torch_version: "2.6.0"
pypi_index: "https://download.pytorch.org/whl/cu118"
- os: windows-2025
arch: x86_64
gpu: T4
runner: CUDA-Windows-x64
cuda_version: "11.8.0"
torch_version: "2.7.1" # Note: this is the last PyTorch release supporting CUDA 11.8.
pypi_index: "https://download.pytorch.org/whl/cu118"
exclude:
# Our current T4 Windows runner has a driver too old (471.11)
# and cannot support CUDA 12+. Skip for now.
- os: windows-2025
cuda_version: "13.0.1"
- os: windows-2025
cuda_version: "12.9.1"
- os: windows-2025
cuda_version: "12.8.1"
- os: windows-2025
cuda_version: "12.6.3"
# No Windows L40S runners.
- os: windows-2025
gpu: L40S
runs-on: ${{ matrix.runner }}
env:
BNB_TEST_DEVICE: cuda
steps:
- name: Show GPU Information
run: nvidia-smi
- uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lib_cuda_${{ matrix.cuda_version }}_${{ matrix.os }}_${{ matrix.arch }}
path: bitsandbytes/
merge-multiple: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
pip install --pre torch~=${{ matrix.torch_version }}.dev0 --index-url ${{ matrix.pypi_index }}
pip install -e ".[test]" -v
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Show environment information
run: python -m torch.utils.collect_env
- name: Run tests
run: pytest --durations=100