-
-
Notifications
You must be signed in to change notification settings - Fork 4
248 lines (235 loc) · 12.3 KB
/
build.yml
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
name: Build binaries
on:
push:
branches: [main]
jobs:
unix-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-15]
device: [cpu, metal, cuda]
exclude:
- os: macos-15
device: cpu
- os: macos-15
device: cuda
- os: ubuntu-22.04
device: metal
container: ${{ matrix.device == 'cuda' && 'nvidia/cuda:12.8.0-devel-ubuntu22.04' || '' }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.device }}
cancel-in-progress: true
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install System Dependencies
if: ${{ runner.os == 'Linux' && matrix.device == 'cuda' }}
run: |
apt update
apt install -y cmake build-essential zip unzip libgomp1 git
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7
- name: Configure sccache
id: sccache
run: |
export SCCACHE_DIR="$PWD/bindings/.sccache"
echo "SCCACHE_DIR=$SCCACHE_DIR" >> $GITHUB_ENV
- name: Cache sccache storage
uses: actions/cache@v4
with:
path: ${{ env.SCCACHE_DIR }}
key: sccache-${{ runner.os }}-${{ matrix.device }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
sccache-${{ runner.os }}-${{ matrix.device }}-${{ github.ref_name }}-
sccache-${{ runner.os }}-${{ matrix.device }}-
- name: Get short SHA
id: sha
run: |
LONG_SHA=${{ github.sha }}
echo "sha=${LONG_SHA::7}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: deno install
- name: Save SHA to textfile
run: echo ${{ steps.sha.outputs.sha }} > gitSha.txt
- name: Build bindings and compile
run: |
if [ "${{ matrix.device }}" = "cuda" ]; then
export GGML_CUDA=1
export CMAKE_CUDA_ARCHITECTURES="75;86;89;120"
fi
deno task bindings
deno task compile
chmod +x YALS
- name: Copy CUDA libraries
run: |
# Move native CUDA lib files
cp /usr/local/cuda/lib64/libcudart.so.12.* lib
cp /usr/local/cuda/lib64/libcublas.so.12.* lib
cp /usr/local/cuda/lib64/libcublasLt.so.12.* lib
# Create symlinks
cd lib
mv libcudart.so* libcudart.so.12
mv libcublas.so* libcublas.so.12
mv libcublasLt.so* libcublasLt.so.12
if: ${{ matrix.device == 'cuda' }}
- name: Set folder name
id: folder-name
run: echo "name=YALS-${{ runner.os }}-${{ matrix.device }}-${{ steps.sha.outputs.sha }}" >> $GITHUB_OUTPUT
- name: Move to artifact folder
run: |
mkdir ${{ steps.folder-name.outputs.name }}
mv lib models templates config_sample.yml YALS ${{ steps.folder-name.outputs.name }}
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ steps.folder-name.outputs.name }}
# path: ./${{ steps.folder-name.outputs.name }}
# if-no-files-found: error
- name: Zip files
run: |
cd ${{ steps.folder-name.outputs.name }}
zip -r ${{ steps.folder-name.outputs.name }}.zip YALS lib/* models/* templates/* config_sample.yml
mv ${{ steps.folder-name.outputs.name }}.zip ../
- name: Upload release
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.folder-name.outputs.name }}.zip
tag: ${{ steps.sha.outputs.sha }}
overwrite: true
release_name: YALS-${{ steps.sha.outputs.sha }}
body: |
CI Builds of YALS commit [${{ steps.sha.outputs.sha }}](https://github.com/${{ github.repository }}/commit/${{ steps.sha.outputs.sha }})
For more details, please refer to the commit history.
Builds:
- **CPU**: Compiled with AVX1 and AVX2 support.
- **CUDA** - Built for CUDA 12, optimized for Turing and newer consumer GPUs.
- **Metal** - Includes both Metal and CPU support for macOS.
windows-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2022]
device: [cpu, cuda]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.device }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Install CUDA 12.8
if: ${{ matrix.device == 'cuda' }}
run: |
mkdir -p "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8"
choco install unzip -y
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cudart/windows-x86_64/cuda_cudart-windows-x86_64-12.8.57-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvcc/windows-x86_64/cuda_nvcc-windows-x86_64-12.8.61-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/windows-x86_64/cuda_nvrtc-windows-x86_64-12.8.61-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/libcublas/windows-x86_64/libcublas-windows-x86_64-12.8.3.14-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvtx/windows-x86_64/cuda_nvtx-windows-x86_64-12.8.55-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_profiler_api/windows-x86_64/cuda_profiler_api-windows-x86_64-12.8.55-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/visual_studio_integration/windows-x86_64/visual_studio_integration-windows-x86_64-12.8.55-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvprof/windows-x86_64/cuda_nvprof-windows-x86_64-12.8.57-archive.zip"
curl -O "https://developer.download.nvidia.com/compute/cuda/redist/cuda_cccl/windows-x86_64/cuda_cccl-windows-x86_64-12.8.55-archive.zip"
unzip '*.zip' -d "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8"
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_cudart-windows-x86_64-12.8.57-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_nvcc-windows-x86_64-12.8.61-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_nvrtc-windows-x86_64-12.8.61-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libcublas-windows-x86_64-12.8.3.14-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_nvtx-windows-x86_64-12.8.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_profiler_api-windows-x86_64-12.8.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\visual_studio_integration-windows-x86_64-12.8.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_nvprof-windows-x86_64-12.8.57-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
xcopy "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\cuda_cccl-windows-x86_64-12.8.55-archive\*" "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" /E /I /H /Y
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8\libnvvp" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
echo "CUDA_PATH_V12_8=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.8" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.7
- name: Configure sccache
run: |
$env:SCCACHE_DIR="$PWD/bindings/.sccache"
echo "SCCACHE_DIR=$env:SCCACHE_DIR" >> $env:GITHUB_ENV
- name: Cache sccache storage
uses: actions/cache@v4
with:
path: ${{ env.SCCACHE_DIR }}
key: sccache-${{ runner.os }}-${{ matrix.device }}-${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
sccache-${{ runner.os }}-${{ matrix.device }}-${{ github.ref_name }}-
sccache-${{ runner.os }}-${{ matrix.device }}-
- name: Get short SHA
id: sha
run: echo "sha=$("${{ github.sha }}".Substring(0,7))" >> $env:GITHUB_OUTPUT
- name: Install dependencies
run: deno install
- name: Save SHA to textfile
run: Set-Content -Path "gitSha.txt" -Value "${{ steps.sha.outputs.sha }}"
- name: Build bindings and compile
run: |
$OldDir = $PWD
Import-Module 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
Enter-VsDevShell -VsInstallPath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' -DevCmdArguments '-arch=x64 -host_arch=x64'
cd $OldDir
if ('${{ matrix.device }}' -eq 'cuda') {
$env:GGML_CUDA = 1
$env:CMAKE_CUDA_ARCHITECTURES="75;86;89;120"
}
deno task bindings-win
deno task compile-win
- name: Copy vcruntime
run: |
cp "C:\Windows\System32\vcruntime140.dll" lib
cp "C:\Windows\System32\vcruntime140_1.dll" lib
- name: Copy CUDA libraries
run: |
cp "${env:CUDA_PATH}\bin\cudart64_*.dll" lib
cp "${env:CUDA_PATH}\bin\cublas64_*.dll" lib
cp "${env:CUDA_PATH}\bin\cublasLt64_*.dll" lib
if: ${{ matrix.device == 'cuda' }}
- name: Set folder name
id: folder-name
run: echo "name=YALS-${{ runner.os }}-${{ matrix.device }}-${{ steps.sha.outputs.sha }}" >> $env:GITHUB_OUTPUT
- name: Move to artifact folder
run: |
mkdir ${{ steps.folder-name.outputs.name }}
mv YALS.exe,lib,models,templates,config_sample.yml ${{ steps.folder-name.outputs.name }}
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ steps.folder-name.outputs.name }}
# path: ./${{ steps.folder-name.outputs.name }}
# if-no-files-found: error
- name: Zip files
run: |
cd ${{ steps.folder-name.outputs.name }}
Compress-Archive -Path @('.\YALS.exe', '.\lib', '.\models', '.\templates', '.\config_sample.yml') -DestinationPath ${{ steps.folder-name.outputs.name }}.zip
mv ${{ steps.folder-name.outputs.name }}.zip ../
- name: Upload release
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.folder-name.outputs.name }}.zip
tag: ${{ steps.sha.outputs.sha }}
overwrite: true
release_name: YALS-${{ steps.sha.outputs.sha }}
body: |
CI Builds of YALS commit [${{ steps.sha.outputs.sha }}](https://github.com/${{ github.repository }}/commit/${{ steps.sha.outputs.sha }})
For more details, please refer to the commit history.
Builds:
- **CPU**: Compiled with AVX1 and AVX2 support.
- **CUDA** - Built for CUDA 12, optimized for Turing and newer consumer GPUs.
- **Metal** - Includes both Metal and CPU support for macOS.