feat: first commit #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
permissions: | |
contents: read | |
pull-requests: read | |
actions: read | |
env: | |
VERSION: "${{ github.ref_name }}" | |
on: | |
workflow_dispatch: { } | |
push: | |
tags: | |
- "v*.*.*" | |
branches: | |
- main | |
paths-ignore: | |
- "docs/**" | |
- "**.md" | |
- "**.mdx" | |
- "**.png" | |
- "**.jpg" | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- "docs/**" | |
- "**.md" | |
- "**.mdx" | |
- "**.png" | |
- "**.jpg" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
darwin-metal: | |
strategy: | |
fail-fast: false | |
matrix: | |
# see https://github.com/actions/runner-images?tab=readme-ov-file#available-images. | |
os: [ macos-13, macos-14 ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup XCode | |
if: ${{ matrix.os == 'macos-13' }} | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.2' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Deps | |
continue-on-error: true | |
run: | | |
brew update | |
- name: Build | |
run: | | |
echo "===== BUILD =====" | |
make -j LLAMA_METAL=1 | |
echo "===== RESULT =====" | |
[ -f ./.dist/llama-box ] && file ./.dist/llama-box | |
- name: Release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./.dist/llama-box | |
name: llama-box-darwin-${{ endsWith(matrix.os, '-13') && 'amd64' || 'arm64' }}-metal | |
linux-hip: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ amd64 ] | |
version: [ '6.0.2' ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Maximize Space | |
# see https://github.com/easimon/maximize-build-space/blob/master/action.yml. | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
sudo docker image prune --all --force | |
- name: Clone | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:qemu-v7.0.0 | |
platforms: "arm64" | |
- name: Build | |
# disable OpenMP to support static linking, | |
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691, | |
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216. | |
run: | | |
echo "===== SCRIPT =====" | |
cat <<EOF > /tmp/entrypoint.sh | |
#!/bin/bash | |
apt-get update && apt-get install -y build-essential git rocblas-dev hipblas-dev libgomp1 | |
git config --global --add safe.directory /workspace/llama.cpp | |
make -j LLAMA_HIPBLAS=1 LLAMA_NO_OPENMP=1 | |
EOF | |
chmod +x /tmp/entrypoint.sh | |
cat /tmp/entrypoint.sh | |
echo "===== BUILD =====" | |
docker run \ | |
--rm \ | |
--privileged \ | |
--platform linux/${{ matrix.arch }} \ | |
--volume $(pwd):/workspace \ | |
--volume /tmp/entrypoint.sh:/entrypoint.sh \ | |
--entrypoint /entrypoint.sh \ | |
--workdir /workspace \ | |
--env CC=/opt/rocm/llvm/bin/clang \ | |
--env CXX=/opt/rocm/llvm/bin/clang++ \ | |
--env GPU_TARGETS="gfx803 gfx900 gfx906 gfx908 gfx90a gfx1010 gfx1030 gfx1100 gfx1101 gfx1102" \ | |
rocm/dev-ubuntu-22.04:${{ matrix.version }} | |
echo "===== RESULT =====" | |
[ -f ./.dist/llama-box ] && file ./.dist/llama-box | |
- name: Release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./.dist/llama-box | |
name: llama-box-linux-${{ matrix.arch }}-hip | |
linux-cuda: | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [ amd64, arm64 ] | |
version: [ '11.7.1' ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Maximize Space | |
# see https://github.com/easimon/maximize-build-space/blob/master/action.yml. | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
sudo docker image prune --all --force | |
- name: Clone | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:qemu-v7.0.0 | |
platforms: "arm64" | |
- name: Build | |
# disable OpenMP to support static linking, | |
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691, | |
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216. | |
run: | | |
echo "===== SCRIPT =====" | |
cat <<EOF > /tmp/entrypoint.sh | |
#!/bin/bash | |
apt-get update && apt-get install -y build-essential git libgomp1 | |
git config --global --add safe.directory /workspace/llama.cpp | |
make -j LLAMA_CUDA=1 LLAMA_NO_OPENMP=1 | |
EOF | |
chmod +x /tmp/entrypoint.sh | |
cat /tmp/entrypoint.sh | |
echo "===== BUILD =====" | |
docker run \ | |
--rm \ | |
--privileged \ | |
--platform linux/${{ matrix.arch }} \ | |
--volume $(pwd):/workspace \ | |
--workdir /workspace \ | |
--volume /tmp/entrypoint.sh:/entrypoint.sh \ | |
--entrypoint /entrypoint.sh \ | |
--env CUDA_DOCKER_ARCH=all \ | |
nvidia/cuda:${{ matrix.version }}-devel-ubuntu22.04 | |
echo "===== RESULT =====" | |
[ -f ./.dist/llama-box ] && file ./.dist/llama-box | |
- name: Release | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ./.dist/llama-box | |
name: llama-box-linux-${{ matrix.arch }}-cuda |