Skip to content

Commit 1179bfc

Browse files
committed
add slim release workflow for prism
1 parent 1b0fadf commit 1179bfc

1 file changed

Lines changed: 255 additions & 0 deletions

File tree

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
name: Release (Prism)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
create_release:
7+
description: 'Create new release'
8+
required: true
9+
type: boolean
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
env:
16+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
17+
CMAKE_ARGS: "-DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_TOOLS=ON -DLLAMA_BUILD_SERVER=ON -DGGML_RPC=ON"
18+
19+
jobs:
20+
macOS-arm64:
21+
runs-on: macos-14
22+
23+
steps:
24+
- name: Clone
25+
uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
29+
- name: ccache
30+
uses: ggml-org/ccache-action@v1.2.16
31+
with:
32+
key: macOS-latest-cmake-arm64
33+
evict-old-files: 1d
34+
35+
- name: Build
36+
run: |
37+
cmake -B build \
38+
-DCMAKE_INSTALL_RPATH='@loader_path' \
39+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
40+
-DLLAMA_FATAL_WARNINGS=ON \
41+
-DGGML_METAL_USE_BF16=ON \
42+
-DGGML_METAL_EMBED_LIBRARY=ON \
43+
-DGGML_RPC=ON \
44+
${{ env.CMAKE_ARGS }}
45+
cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
46+
47+
- name: Determine tag name
48+
id: tag
49+
uses: ./.github/actions/get-tag-name
50+
51+
- name: Pack artifacts
52+
run: |
53+
cp LICENSE ./build/bin/
54+
tar -czvf llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.tar.gz -s ",./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
55+
56+
- name: Upload artifacts
57+
uses: actions/upload-artifact@v6
58+
with:
59+
path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.tar.gz
60+
name: llama-bin-macos-arm64.tar.gz
61+
62+
linux-cuda:
63+
runs-on: ubuntu-22.04
64+
65+
strategy:
66+
matrix:
67+
include:
68+
- cuda: '12.4'
69+
cuda_pkg: '12-4'
70+
- cuda: '12.8'
71+
cuda_pkg: '12-8'
72+
- cuda: '13.1'
73+
cuda_pkg: '13-1'
74+
75+
steps:
76+
- name: Clone
77+
uses: actions/checkout@v6
78+
with:
79+
fetch-depth: 0
80+
81+
- name: ccache
82+
uses: ggml-org/ccache-action@v1.2.16
83+
with:
84+
key: ubuntu-22-cmake-cuda-${{ matrix.cuda }}
85+
evict-old-files: 1d
86+
87+
- name: Install CUDA toolkit
88+
run: |
89+
wget -q https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
90+
sudo dpkg -i cuda-keyring_1.1-1_all.deb
91+
sudo apt-get update
92+
sudo apt-get -y install cuda-toolkit-${{ matrix.cuda_pkg }}
93+
echo "/usr/local/cuda-${{ matrix.cuda }}/bin" >> $GITHUB_PATH
94+
echo "CUDA_PATH=/usr/local/cuda-${{ matrix.cuda }}" >> $GITHUB_ENV
95+
echo "LD_LIBRARY_PATH=/usr/local/cuda-${{ matrix.cuda }}/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
96+
97+
- name: Build
98+
run: |
99+
cmake -B build \
100+
-DCMAKE_INSTALL_RPATH='$ORIGIN' \
101+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
102+
-DGGML_NATIVE=OFF \
103+
-DGGML_CUDA=ON \
104+
${{ env.CMAKE_ARGS }}
105+
cmake --build build --config Release -j $(nproc) 2>&1 | grep -v "^nvcc warning"
106+
107+
- name: Determine tag name
108+
id: tag
109+
uses: ./.github/actions/get-tag-name
110+
111+
- name: Pack artifacts
112+
run: |
113+
cp LICENSE ./build/bin/
114+
tar -czvf llama-${{ steps.tag.outputs.name }}-bin-linux-cuda-${{ matrix.cuda }}-x64.tar.gz --transform "s,./,llama-${{ steps.tag.outputs.name }}/," -C ./build/bin .
115+
116+
- name: Upload artifacts
117+
uses: actions/upload-artifact@v6
118+
with:
119+
path: llama-${{ steps.tag.outputs.name }}-bin-linux-cuda-${{ matrix.cuda }}-x64.tar.gz
120+
name: llama-bin-linux-cuda-${{ matrix.cuda }}-x64.tar.gz
121+
122+
windows-cuda:
123+
runs-on: windows-2022
124+
125+
strategy:
126+
matrix:
127+
cuda: ['12.4', '13.1']
128+
129+
steps:
130+
- name: Clone
131+
uses: actions/checkout@v6
132+
133+
- name: Install ccache
134+
uses: ggml-org/ccache-action@v1.2.16
135+
with:
136+
key: windows-cuda-${{ matrix.cuda }}
137+
variant: ccache
138+
evict-old-files: 1d
139+
140+
- name: Install Cuda Toolkit
141+
uses: ./.github/actions/windows-setup-cuda
142+
with:
143+
cuda_version: ${{ matrix.cuda }}
144+
145+
- name: Install Ninja
146+
run: choco install ninja
147+
148+
- name: Build
149+
shell: cmd
150+
run: |
151+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
152+
cmake -S . -B build -G "Ninja Multi-Config" ^
153+
-DGGML_NATIVE=OFF ^
154+
-DGGML_CUDA=ON ^
155+
-DLLAMA_BUILD_BORINGSSL=ON ^
156+
-DCMAKE_CUDA_FLAGS="-diag-suppress=221" ^
157+
${{ env.CMAKE_ARGS }}
158+
set /A NINJA_JOBS=%NUMBER_OF_PROCESSORS%-1
159+
cmake --build build --config Release -j %NINJA_JOBS%
160+
161+
- name: Determine tag name
162+
id: tag
163+
uses: ./.github/actions/get-tag-name
164+
165+
- name: Pack artifacts
166+
run: |
167+
7z a -snl llama-${{ steps.tag.outputs.name }}-bin-win-cuda-${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
168+
169+
- name: Upload artifacts
170+
uses: actions/upload-artifact@v6
171+
with:
172+
path: llama-${{ steps.tag.outputs.name }}-bin-win-cuda-${{ matrix.cuda }}-x64.zip
173+
name: llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip
174+
175+
- name: Copy and pack Cuda runtime
176+
run: |
177+
echo "Cuda install location: ${{ env.CUDA_PATH }}"
178+
$dst='.\build\bin\cudart\'
179+
robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
180+
robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
181+
robocopy "${{env.CUDA_PATH}}\bin\x64" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
182+
7z a cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip $dst\*
183+
184+
- name: Upload Cuda runtime
185+
uses: actions/upload-artifact@v6
186+
with:
187+
path: cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip
188+
name: cudart-llama-bin-win-cuda-${{ matrix.cuda }}-x64.zip
189+
190+
release:
191+
if: ${{ github.event.inputs.create_release == 'true' }}
192+
193+
permissions:
194+
contents: write
195+
196+
runs-on: ubuntu-latest
197+
198+
needs:
199+
- macOS-arm64
200+
- linux-cuda
201+
- windows-cuda
202+
203+
steps:
204+
- name: Clone
205+
uses: actions/checkout@v6
206+
with:
207+
fetch-depth: 0
208+
209+
- name: Determine tag name
210+
id: tag
211+
uses: ./.github/actions/get-tag-name
212+
213+
- name: Download artifacts
214+
uses: actions/download-artifact@v7
215+
with:
216+
path: ./artifact
217+
merge-multiple: true
218+
219+
- name: Move artifacts
220+
run: |
221+
mkdir -p release
222+
mv -v artifact/*.tar.gz release/ 2>/dev/null || true
223+
mv -v artifact/*.zip release/ 2>/dev/null || true
224+
ls -lh release/
225+
226+
- name: Create release
227+
id: create_release
228+
uses: ggml-org/action-create-release@v1
229+
env:
230+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231+
with:
232+
tag_name: ${{ steps.tag.outputs.name }}
233+
body: |
234+
Pre-built binaries (PrismML fork with Q1_0 1-bit quantization support).
235+
236+
**macOS:**
237+
- [macOS Apple Silicon (arm64)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.tar.gz)
238+
239+
**Linux:**
240+
- [Linux x64 (CUDA 12.4)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-linux-cuda-12.4-x64.tar.gz)
241+
- [Linux x64 (CUDA 12.8)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-linux-cuda-12.8-x64.tar.gz)
242+
- [Linux x64 (CUDA 13.1)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-linux-cuda-13.1-x64.tar.gz)
243+
244+
**Windows:**
245+
- [Windows x64 (CUDA 12.4)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-cuda-12.4-x64.zip) - [CUDA 12.4 DLLs](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-bin-win-cuda-12.4-x64.zip)
246+
- [Windows x64 (CUDA 13.1)](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-win-cuda-13.1-x64.zip) - [CUDA 13.1 DLLs](https://github.com/${{ github.repository }}/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-bin-win-cuda-13.1-x64.zip)
247+
248+
- name: Upload release
249+
env:
250+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
251+
run: |
252+
for file in release/*; do
253+
echo "Uploading $(basename $file)..."
254+
gh release upload ${{ steps.tag.outputs.name }} "$file" --clobber
255+
done

0 commit comments

Comments
 (0)