Repository navigation
206 lines (174 loc) · 5.98 KB
/
Copy pathbuild-wheels-cu124-linux.yml
File metadata and controls
206 lines (174 loc) · 5.98 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
name: Build Wheels (CU124) for Linux
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build_native:
name: Build native libraries cu124 linux
runs-on: ubuntu-22.04
container: nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
outputs:
version: ${{ steps.version.outputs.version }}
backend_version: ${{ steps.version.outputs.backend_version }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04"]
cuda: ["12.4.1"]
cudaarch: ["70-real;75-real;80-real;86-real;87-real;89-real"]
defaults:
run:
shell: bash
env:
CUDAVER: ${{ matrix.cuda }}
CUDAARCHVER: ${{ matrix.cudaarch }}
CMAKE_BUILD_PARALLEL_LEVEL: 12
steps:
- name: Install dependencies
run: |
apt update
apt install -y \
build-essential \
ccache \
cmake \
curl \
git \
libgomp1 \
libjpeg-dev \
libssl-dev \
ninja-build
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Install uv and Python 3.10
uses: astral-sh/setup-uv@v7
with:
python-version: "3.10"
activate-environment: true
enable-cache: true
- name: Show CUDA version
run: nvcc -V
- name: Build native libraries and carrier wheel
env:
LD_LIBRARY_PATH: "/usr/local/cuda/lib64:/usr/local/cuda/compat:/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}"
VERBOSE: "1"
CUDA_HOME: "/usr/local/cuda"
CUDA_PATH: "/usr/local/cuda"
CUDA_TOOLKIT_ROOT_DIR: "/usr/local/cuda"
run: |
set -euo pipefail
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
find /usr/ -name 'libcuda.so.*' || true
find /usr/ -name 'libcudart.so.*' || true
# Build one CUDA wheel with dynamic GGML backends:
# - GGML_BACKEND_DL enables runtime-loadable backend shared libraries.
# - GGML_CPU_ALL_VARIANTS builds CPU variant backends when supported.
# - GGML_NATIVE=OFF avoids binding the wheel to the CI runner CPU.
CMAKE_ARGS_ARRAY=(
"-G Ninja"
# Disable non-wheel targets.
"-DLLAMA_BUILD_EXAMPLES=OFF"
"-DLLAMA_BUILD_TESTS=OFF"
"-DLLAMA_BUILD_TOOLS=OFF"
"-DLLAMA_BUILD_SERVER=OFF"
"-DLLAMA_BUILD_UI=OFF"
"-DLLAMA_USE_PREBUILT_UI=OFF"
"-DLLAMA_CURL=OFF"
"-DLLAMA_OPENSSL=ON"
# GGML dynamic backend layout.
"-DGGML_CPU=ON"
"-DGGML_CUDA=ON"
"-DGGML_RPC=ON"
"-DGGML_NATIVE=OFF"
"-DGGML_BACKEND_DL=ON"
"-DGGML_CPU_ALL_VARIANTS=ON"
"-DGGML_OPENMP=ON"
# CUDA backend.
"-DCMAKE_CUDA_ARCHITECTURES=${CUDAARCHVER}"
"-DCMAKE_CUDA_FLAGS=--diag-suppress=177,221,550"
# Build behavior.
"-DGGML_CCACHE=ON"
)
CMAKE_ARGS="${CMAKE_ARGS_ARRAY[*]}"
echo "CMAKE_ARGS=${CMAKE_ARGS}"
uv pip install --upgrade build setuptools wheel packaging
CMAKE_ARGS="${CMAKE_ARGS}" uv build --wheel
- name: Read package version
id: version
run: |
python .github/scripts/package_backend_wheel.py --version >> "$GITHUB_OUTPUT"
echo "backend_version=${{ matrix.cuda }}" >> "$GITHUB_OUTPUT"
- name: Record native build configuration
run: python .github/scripts/package_backend_wheel.py --write-manifest --seed-dir dist --backend cuda --backend-version ${{ matrix.cuda }}
- name: Share native build
uses: actions/upload-artifact@v6
with:
name: native-cu124-linux
path: |
dist/*.whl
dist/native-build.json
if-no-files-found: error
compression-level: 0
retention-days: 7
package_wheels:
name: Package cu124 linux Python ${{ matrix.pyver }}
needs: build_native
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
pyver: ["3.10", "3.11", "3.12", "3.13", "3.14"]
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install uv and Python ${{ matrix.pyver }}
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.pyver }}
activate-environment: true
enable-cache: true
- name: Download native build
uses: actions/download-artifact@v7
with:
name: native-cu124-linux
path: native-wheel
- name: Package wheel without native compilation
run: |
uv pip install build
python .github/scripts/package_backend_wheel.py --backend cuda --backend-version ${{ needs.build_native.outputs.backend_version }}
- name: Install wheel and print version information
run: python .github/scripts/package_backend_wheel.py --verify
- name: Upload wheel
uses: actions/upload-artifact@v6
with:
name: wheels-cu124-linux-py${{ matrix.pyver }}
path: dist/*.whl
if-no-files-found: error
compression-level: 0
release:
name: Publish cu124 linux wheels
needs: [build_native, package_wheels]
runs-on: ubuntu-22.04
steps:
- name: Download packaged wheels
uses: actions/download-artifact@v7
with:
pattern: wheels-cu124-linux-py*
merge-multiple: true
path: dist
- name: Get current date
id: date
run: echo "date=$(date -u +%Y%m%d)" >> "$GITHUB_OUTPUT"
- name: Create release
uses: softprops/action-gh-release@v3
with:
files: dist/*.whl
fail_on_unmatched_files: true
tag_name: v${{ needs.build_native.outputs.version }}-cu124-linux-${{ steps.date.outputs.date }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}