Skip to content

Commit 391fac1

Browse files
ORipplerCISC
andauthored
ci : add ubuntu-cuda builds to release (ggml-org#28186)
* release : add ubuntu-cuda build job (12.8/13.3, x64+arm64) * Add GCC 14 for CUDA arm64 builds in CI * Eplicit bash * Install git for CCCL fetch * Install git before we clone/checkout * Match CI names for WIndows * Whitelist llama.cpp repo to git * Use $GITHUB_WORKSPACE * Also ship dependent libs on Ubuntu Need NCCL additionally as it's pre-built available on Linux * Avoid duplicate files in packaged cudart * Copy NCCL license * Install CURL to fetch NCCL license * Update .github/workflows/release.yml Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co> * Remove NCCL until licensing has been confirmed --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
1 parent 41abbfd commit 391fac1

1 file changed

Lines changed: 143 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,145 @@ jobs:
310310
with:
311311
key: release-${{ matrix.os }}-vulkan
312312

313+
ubuntu-cuda:
314+
name: ubuntu-cuda (${{ matrix.label }}, ${{ matrix.build }})
315+
needs: [check-release, ui-build]
316+
if: ${{ needs.check-release.outputs.should_release == 'true' }}
317+
318+
strategy:
319+
matrix:
320+
include:
321+
# label = short version used in artifact names / release body
322+
# cuda = full container image tag
323+
- build: 'x64'
324+
os: ubuntu-24.04
325+
cuda: '12.8.2'
326+
label: '12.8'
327+
defines: '-DGGML_CUDA_CUB_3DOT2=ON'
328+
- build: 'x64'
329+
os: ubuntu-24.04
330+
cuda: '13.3.1'
331+
label: '13.3'
332+
defines: ''
333+
- build: 'arm64'
334+
os: ubuntu-24.04-arm
335+
cuda: '13.3.1'
336+
label: '13.3'
337+
defines: ''
338+
339+
runs-on: ${{ matrix.os }}
340+
container: nvidia/cuda:${{ matrix.cuda }}-devel-ubuntu24.04
341+
342+
permissions:
343+
actions: write
344+
345+
steps:
346+
# the container has no git; install it before checkout so that a real git
347+
# repository is created (the get-tag-name action and the build both need it)
348+
- name: Install git
349+
run: |
350+
apt-get update
351+
apt-get install -y --no-install-recommends git
352+
353+
- name: Clone
354+
id: checkout
355+
uses: actions/checkout@v6
356+
with:
357+
fetch-depth: 0
358+
359+
# checkout runs as the host user; in-container steps run as root, so git
360+
# refuses to touch a repo it does not own. Mark the workspace as safe.
361+
# use the env var: the github.workspace context holds the HOST path,
362+
# GITHUB_WORKSPACE the container path
363+
- name: Git safe directory
364+
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
365+
366+
- name: Download UI build
367+
uses: actions/download-artifact@v7
368+
with:
369+
name: llama-ui.zip
370+
path: tools/ui/dist
371+
372+
- name: Dependencies
373+
id: depends
374+
# container jobs default to sh (dash); need bash for the [[ ]] below
375+
shell: bash
376+
run: |
377+
apt-get update
378+
apt-get install -y --no-install-recommends build-essential cmake ninja-build libssl-dev jq python3-venv
379+
# the container ships GCC 13, which does not know the 'sme' march
380+
# feature used by the armv9.2 CPU variant of GGML_CPU_ALL_VARIANTS
381+
if [[ "${{ matrix.build }}" == "arm64" ]]; then
382+
apt-get install -y --no-install-recommends gcc-14 g++-14
383+
echo "CC=gcc-14" >> "$GITHUB_ENV"
384+
echo "CXX=g++-14" >> "$GITHUB_ENV"
385+
fi
386+
387+
- name: ccache
388+
uses: ggml-org/ccache-action@v1.2.24
389+
with:
390+
key: release-ubuntu-${{ matrix.os }}-cuda-${{ matrix.label }}-${{ matrix.build }}
391+
evict-old-files: 1d
392+
max-size: "1G"
393+
394+
- name: Build
395+
id: cmake_build
396+
# no CMAKE_CUDA_ARCHITECTURES: use the broad default arch set from
397+
# ggml/src/ggml-cuda/CMakeLists.txt so the release binary covers many GPUs
398+
run: |
399+
cmake -B build \
400+
-DCMAKE_INSTALL_RPATH='$ORIGIN' \
401+
-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
402+
-DGGML_BACKEND_DL=ON \
403+
-DGGML_NATIVE=OFF \
404+
-DGGML_CPU_ALL_VARIANTS=ON \
405+
-DGGML_CUDA=ON \
406+
-DGGML_CUDA_NCCL=OFF \
407+
${{ env.CMAKE_ARGS }} ${{ matrix.defines }}
408+
cmake --build build --config Release -j $(nproc)
409+
410+
- name: Determine tag name
411+
id: tag
412+
uses: ./.github/actions/get-tag-name
413+
414+
- name: Pack artifacts
415+
id: pack_artifacts
416+
run: |
417+
cp LICENSE ./build/bin/
418+
tar -czvf llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz --transform "s,^\.,llama-${{ steps.tag.outputs.name }}," -C ./build/bin .
419+
420+
- name: Upload artifacts
421+
uses: actions/upload-artifact@v6
422+
with:
423+
path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz
424+
name: llama-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz
425+
426+
# ship the CUDA runtime libraries the backend links against, mirroring
427+
# the windows-cuda cudart zip - extract next to the binaries ($ORIGIN rpath)
428+
- name: Pack CUDA runtime
429+
id: pack_cuda_runtime
430+
run: |
431+
major="${{ matrix.label }}"
432+
major="${major%%.*}"
433+
mkdir -p ./cudart
434+
# cp -L dereferences the SONAME symlinks into plain files, so the
435+
# tarball holds exactly 3 files with no versioned duplicates
436+
cp -L /usr/local/cuda/lib64/libcudart.so.${major} ./cudart/
437+
cp -L /usr/local/cuda/lib64/libcublas.so.${major} ./cudart/
438+
cp -L /usr/local/cuda/lib64/libcublasLt.so.${major} ./cudart/
439+
tar -czvf cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz --transform "s,^\.,cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}," -C ./cudart .
440+
441+
- name: Upload CUDA runtime
442+
uses: actions/upload-artifact@v6
443+
with:
444+
path: cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz
445+
name: cudart-llama-bin-ubuntu-cuda-${{ matrix.label }}-${{ matrix.build }}.tar.gz
446+
447+
- name: ccache-clear
448+
uses: ./.github/actions/ccache-clear
449+
with:
450+
key: release-ubuntu-${{ matrix.os }}-cuda-${{ matrix.label }}-${{ matrix.build }}
451+
313452
android-arm64:
314453
needs: [check-release, ui-build]
315454
if: ${{ needs.check-release.outputs.should_release == 'true' }}
@@ -1572,6 +1711,7 @@ jobs:
15721711
- ubuntu-24-rocm
15731712
- ubuntu-cpu
15741713
- ubuntu-vulkan
1714+
- ubuntu-cuda
15751715
- ubuntu-24-openvino
15761716
- ubuntu-24-sycl
15771717
- android-arm64
@@ -1703,6 +1843,9 @@ jobs:
17031843
- [Ubuntu s390x (CPU)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-s390x.tar.gz)
17041844
- [Ubuntu x64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-x64.tar.gz)
17051845
- [Ubuntu arm64 (Vulkan)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-vulkan-arm64.tar.gz)
1846+
- [Ubuntu x64 (CUDA 12)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-12.8-x64.tar.gz) - [CUDA 12.8 libraries](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-12.8-x64.tar.gz)
1847+
- [Ubuntu x64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-13.3-x64.tar.gz) - [CUDA 13.3 libraries](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-13.3-x64.tar.gz)
1848+
- [Ubuntu arm64 (CUDA 13)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-13.3-arm64.tar.gz) - [CUDA 13.3 libraries](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/cudart-llama-${{ steps.tag.outputs.name }}-bin-ubuntu-cuda-13.3-arm64.tar.gz)
17061849
- [Ubuntu x64 (ROCm 10.0)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-rocm-10.0-x64.tar.gz)
17071850
- [Ubuntu x64 (OpenVINO)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-openvino-${{ needs.ubuntu-24-openvino.outputs.openvino_version }}-x64.tar.gz)
17081851
- [Ubuntu x64 (SYCL FP32)](https://github.com/ggml-org/llama.cpp/releases/download/${{ steps.tag.outputs.name }}/llama-${{ steps.tag.outputs.name }}-bin-ubuntu-sycl-fp32-x64.tar.gz)

0 commit comments

Comments
 (0)