-
-
Notifications
You must be signed in to change notification settings - Fork 851
174 lines (148 loc) · 4.71 KB
/
tests.yml
File metadata and controls
174 lines (148 loc) · 4.71 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
name: Unit tests
on:
workflow_dispatch:
schedule:
# Every day at 02:15 AM UTC
- cron: "15 2 * * *"
push:
branches: [testing-ci]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-cpu:
strategy:
matrix:
os: [ubuntu-22.04, windows-2025]
arch: [x86_64]
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:
cuda_version: ["11.8.0", "12.8.1"]
os: [ubuntu-22.04, windows-2025]
arch: [x86_64]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install CUDA Toolkit
uses: Jimver/cuda-toolkit@v0.2.23
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
# We're running on T4 only for now, so we only target sm75.
- name: Build C++ / CUDA
run: bash .github/scripts/build-cuda.sh
env:
build_os: ${{ matrix.os }}
build_arch: x86_64
cuda_version: ${{ matrix.cuda_version }}
cuda_targets: "75"
- 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
cpu-tests:
needs: build-cpu
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2025]
arch: [x86_64]
torch_version: ["2.7.0"]
runs-on: ${{ 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.9
- name: Install dependencies
run: |
pip install torch==${{ matrix.torch_version }} --index-url https://download.pytorch.org/whl/cpu
pip install -e ".[test]"
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Run tests
run: pytest
cuda-tests:
needs: build-cuda
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-2025]
arch: [x86_64]
cuda_version: ["11.8.0", "12.8.1"]
include:
- cuda_version: "11.8.0"
torch_version: "2.4.1"
pypi_index: "https://download.pytorch.org/whl/cu118"
- cuda_version: "12.8.1"
torch_version: "2.7.0"
pypi_index: "https://download.pytorch.org/whl/cu128"
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: "12.8.1"
runs-on:
labels: ${{ contains(matrix.os, 'windows') && 'CUDA-Windows-x64' || 'CUDA-Linux-x64' }}
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.9
- name: Install dependencies
run: |
pip install torch==${{ matrix.torch_version }} --index-url ${{ matrix.pypi_index }}
pip install -e ".[test]"
pip install pytest-cov
- name: Show installed packages
run: pip list
- name: Run tests
run: pytest