Skip to content

Commit

Permalink
ci: adjust cache
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <thxcode0824@gmail.com>
  • Loading branch information
thxCode committed Jul 24, 2024
1 parent b540d86 commit 2cfe779
Showing 1 changed file with 27 additions and 45 deletions.
72 changes: 27 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ jobs:

darwin-metal:
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
arch: [ amd64, arm64 ]
Expand All @@ -53,9 +52,6 @@ jobs:
with:
fetch-depth: 0
submodules: 'recursive'
- name: Deps
run: |
brew update && brew install ccache
- name: Setup XCode
uses: maxim-lobanov/setup-xcode@v1
with:
Expand All @@ -66,16 +62,13 @@ jobs:
with:
key: cache-darwin-metal-${{ matrix.arch }}-${{ matrix.version }}
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/build
- name: Build
# disable OpenMP,
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}/.cache/ccache"
run: |
echo "===== BUILD ====="
mkdir -p ${{ github.workspace }}/.cache
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \
-DGGML_ACCELERATE=on -DGGML_METAL=on -DGGML_METAL_EMBED_LIBRARY=on \
${{ matrix.arch == 'amd64' && '-DGGML_NATIVE=off' || '-DGGML_NATIVE=on' }} \
Expand All @@ -100,7 +93,6 @@ jobs:

linux-hip:
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
# see https://hub.docker.com/r/rocm/dev-ubuntu-22.04/tags.
Expand Down Expand Up @@ -144,7 +136,7 @@ jobs:
with:
key: cache-linux-hip-${{ matrix.arch }}-${{ matrix.version }}-${{ matrix.size }}
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/build
- name: Setup QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
Expand All @@ -156,15 +148,13 @@ jobs:
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}/.cache/ccache"
AMDGPU_TARGETS: "${{ matrix.hip_arch }}"
run: |
echo "===== SCRIPT ====="
cat <<EOF > /tmp/entrypoint.sh
#!/bin/bash
apt-get update && apt-get install -y build-essential git cmake ccache
apt-get update && apt-get install -y build-essential git cmake
git config --system --add safe.directory '*'
mkdir -p ${{ github.workspace }}/.cache
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \
-DGGML_HIPBLAS=on -DAMDGPU_TARGETS="${AMDGPU_TARGETS}" \
${{ matrix.arch == 'amd64' && '-DGGML_NATIVE=off' || '-DGGML_NATIVE=on' }} \
Expand All @@ -189,7 +179,6 @@ jobs:
--workdir ${{ github.workspace }} \
--env CC=/opt/rocm/llvm/bin/clang \
--env CXX=/opt/rocm/llvm/bin/clang++ \
--env CCACHE_DIR \
--env AMDGPU_TARGETS \
--volume /tmp/entrypoint.sh:/entrypoint.sh \
--entrypoint /entrypoint.sh \
Expand All @@ -206,7 +195,6 @@ jobs:

linux-cuda:
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
# see https://hub.docker.com/r/nvidia/cuda/tags?page=&page_size=&ordering=&name=devel.
Expand Down Expand Up @@ -246,7 +234,7 @@ jobs:
with:
key: cache-linux-cuda-${{ matrix.arch }}-${{ matrix.version }}-${{ matrix.size }}
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/build
- name: Setup QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
Expand All @@ -258,15 +246,13 @@ jobs:
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}/.cache/ccache"
CUDA_ARCHITECTURES: "${{ matrix.cuda_arch }}"
run: |
echo "===== SCRIPT ====="
cat <<EOF > /tmp/entrypoint.sh
#!/bin/bash
apt-get update && apt-get install -y build-essential git cmake ccache
apt-get update && apt-get install -y build-essential git cmake
git config --system --add safe.directory '*'
mkdir -p ${{ github.workspace }}/.cache
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \
-DGGML_CUDA=on -DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHITECTURES}" \
${{ matrix.arch == 'amd64' && '-DGGML_NATIVE=off' || '-DGGML_NATIVE=on' }} \
Expand All @@ -289,7 +275,6 @@ jobs:
--platform linux/${{ matrix.arch }} \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
--env CCACHE_DIR \
--env CUDA_ARCHITECTURES \
--volume /tmp/entrypoint.sh:/entrypoint.sh \
--entrypoint /entrypoint.sh \
Expand All @@ -306,7 +291,6 @@ jobs:

linux-oneapi:
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
# see https://hub.docker.com/r/intel/oneapi-basekit/tags?page=&page_size=&ordering=&name=devel.
Expand Down Expand Up @@ -335,7 +319,7 @@ jobs:
with:
key: cache-linux-oneapi-${{ matrix.arch }}-${{ matrix.version }}
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/build
- name: Setup QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
Expand All @@ -346,15 +330,12 @@ jobs:
# disable OpenMP,
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}/.cache/ccache"
run: |
echo "===== SCRIPT ====="
cat <<EOF > /tmp/entrypoint.sh
#!/bin/bash
apt-get update && apt-get install -y build-essential git cmake ccache
apt-get update && apt-get install -y build-essential git cmake
git config --system --add safe.directory '*'
mkdir -p ${{ github.workspace }}/.cache
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \
-DGGML_SYCL=on -DGGML_SYCL_F16=on \
${{ matrix.arch == 'amd64' && '-DGGML_NATIVE=off' || '-DGGML_NATIVE=on' }} \
Expand All @@ -379,7 +360,6 @@ jobs:
--workdir ${{ github.workspace }} \
--env CC=icx \
--env CXX=icpx \
--env CCACHE_DIR \
--volume /tmp/entrypoint.sh:/entrypoint.sh \
--entrypoint /entrypoint.sh \
intel/oneapi-basekit:${{ matrix.version == '2024.2' && '2024.2.0' || '2024.1.1' }}-devel-ubuntu22.04
Expand All @@ -395,7 +375,6 @@ jobs:

linux-cann:
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
# see https://hub.docker.com/r/ascendai/cann/tags?page=&page_size=&ordering=&name=.
Expand Down Expand Up @@ -423,7 +402,7 @@ jobs:
with:
key: cache-linux-cann-${{ matrix.arch }}-${{ matrix.version }}
path: |
${{ github.workspace }}/.cache
${{ github.workspace }}/build
- name: Setup QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
Expand All @@ -434,16 +413,13 @@ jobs:
# disable OpenMP,
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}/.cache/ccache"
run: |
echo "===== SCRIPT ====="
cat <<EOF > /tmp/entrypoint.sh
#!/bin/bash
source /usr/local/Ascend/ascend-toolkit/set_env.sh
apt-get update && apt-get install -y build-essential git cmake ccache
apt-get update && apt-get install -y build-essential git cmake
git config --system --add safe.directory '*'
mkdir -p ${{ github.workspace }}/.cache
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \
-DGGML_CANN=on \
${{ matrix.arch == 'amd64' && '-DGGML_NATIVE=off' || '-DGGML_NATIVE=on' }} \
Expand All @@ -466,7 +442,6 @@ jobs:
--platform linux/${{ matrix.arch }} \
--volume ${{ github.workspace }}:${{ github.workspace }} \
--workdir ${{ github.workspace }} \
--env CCACHE_DIR \
--volume /tmp/entrypoint.sh:/entrypoint.sh \
--entrypoint /entrypoint.sh \
ascendai/cann:${{ matrix.version }}
Expand All @@ -483,7 +458,6 @@ jobs:
windows-hip:
continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
strategy:
# cache-able building with ccache.
fail-fast: false
matrix:
# see https://www.amd.com/en/developer/resources/rocm-hub/hip-sdk.html.
Expand Down Expand Up @@ -518,14 +492,14 @@ jobs:
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
choco install ccache curl -y
choco install curl -y
- name: Setup Cache
timeout-minutes: 5
uses: actions/cache@v3
with:
key: cache-windows-hip-${{ matrix.arch }}-${{ matrix.version }}-${{ matrix.size }}
path: |
${{ github.workspace }}\.cache
${{ github.workspace }}\build
- name: Setup HIP
run: |
$ErrorActionPreference = "Stop"
Expand All @@ -548,12 +522,10 @@ jobs:
# see https://github.com/ggerganov/llama.cpp/issues/7743#issuecomment-2148342691,
# https://github.com/ggerganov/llama.cpp/issues/7719#issuecomment-2147631216.
env:
CCACHE_DIR: "${{ github.workspace }}\\.cache\\ccache"
AMDGPU_TARGETS: "${{ matrix.hip_arch }}"
run: |
Write-Host "===== BUILD ====="
Write-Host "HIP_PATH=${env:HIP_PATH}"
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\.cache" -ErrorAction Ignore | Out-Null
$env:CMAKE_PREFIX_PATH = "${env:HIP_PATH}"
cmake -G "Unix Makefiles" -S ${{ github.workspace }} -B ${{ github.workspace }}\build -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" `
Expand Down Expand Up @@ -581,9 +553,7 @@ jobs:
windows-cuda:
continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
strategy:
# uncache-able building,
# see https://stackoverflow.com/questions/72829476/how-to-use-ccache-4-6-1-on-windows-msvc-with-cmake.
fail-fast: true
fail-fast: false
matrix:
# see https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=Server2022&target_type=exe_network.
# 12.5 ==> 12.5.0
Expand Down Expand Up @@ -611,6 +581,13 @@ jobs:
with:
fetch-depth: 0
submodules: 'recursive'
- name: Setup Cache
timeout-minutes: 5
uses: actions/cache@v3
with:
key: cache-windows-cuda-${{ matrix.arch }}-${{ matrix.version }}-${{ matrix.size }}
path: |
${{ github.workspace }}\build
- name: Setup CUDA
# ensure MSBuildExtensions has been configured,
# see https://github.com/NVlabs/tiny-cuda-nn/issues/164#issuecomment-1280749170.
Expand Down Expand Up @@ -658,9 +635,7 @@ jobs:
windows-oneapi:
continue-on-error: ${{ !startsWith(github.ref, 'refs/tags/') }}
strategy:
# uncache-able building,
# as the oneAPI need to configure the environment variables via setvars.bat.
fail-fast: true
fail-fast: false
matrix:
# see https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html?operatingsystem=windows&windows-install-type=offline.
# 2024.2 ==> 2024.2.0
Expand All @@ -680,6 +655,13 @@ jobs:
$ProgressPreference = 'SilentlyContinue'
choco install curl ninja -y
- name: Setup Cache
timeout-minutes: 5
uses: actions/cache@v3
with:
key: cache-windows-openapi-${{ matrix.arch }}-${{ matrix.version }}
path: |
${{ github.workspace }}\build
- name: Setup oneAPI
run: |
$ErrorActionPreference = "Stop"
Expand Down

0 comments on commit 2cfe779

Please sign in to comment.