-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: thxCode <[email protected]>
- Loading branch information
Showing
1 changed file
with
110 additions
and
29 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
# cache-able building with ccache. | ||
darwin-metal: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -59,7 +61,7 @@ jobs: | |
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-darwin-metal-${{ matrix.arch }}-${{ matrix.version }}-${{ hashFiles('**/.gitmodules') }} | ||
key: cache-darwin-metal-${{ matrix.arch }}-${{ matrix.version }} | ||
path: | | ||
${{ github.workspace }}/.cache | ||
- name: Deps | ||
|
@@ -96,6 +98,7 @@ jobs: | |
path: ${{ github.workspace }}/out/*.zip | ||
name: llama-box-darwin-${{ matrix.arch }}-metal-${{ matrix.version }} | ||
|
||
# cache-able building with ccache. | ||
linux-hip: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -124,7 +127,7 @@ jobs: | |
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-linux-hip-${{ matrix.arch }}-${{ matrix.version }}-${{ hashFiles('**/.gitmodules') }} | ||
key: cache-linux-hip-${{ matrix.arch }}-${{ matrix.version }} | ||
path: | | ||
${{ github.workspace }}/.cache | ||
- name: Setup QEMU | ||
|
@@ -193,6 +196,7 @@ jobs: | |
path: ${{ github.workspace }}/out/*.zip | ||
name: llama-box-linux-${{ matrix.arch }}-hip-${{ matrix.version }} | ||
|
||
# cache-able building with ccache. | ||
linux-cuda: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -221,7 +225,7 @@ jobs: | |
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-linux-cuda-${{ matrix.arch }}-${{ matrix.version }}-${{ hashFiles('**/.gitmodules') }} | ||
key: cache-linux-cuda-${{ matrix.arch }}-${{ matrix.version }} | ||
path: | | ||
${{ github.workspace }}/.cache | ||
- name: Setup QEMU | ||
|
@@ -284,6 +288,97 @@ jobs: | |
path: ${{ github.workspace }}/out/*.zip | ||
name: llama-box-linux-${{ matrix.arch }}-cuda-${{ matrix.version }} | ||
|
||
# cache-able building with ccache. | ||
linux-oneapi: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: [ amd64 ] | ||
# see https://hub.docker.com/r/intel/oneapi-basekit/tags?page=&page_size=&ordering=&name=devel. | ||
# 2024.2 ==> 2024.2.0 | ||
# 2024.1 ==> 2024.1.1 | ||
version: [ '2024.2', '2024.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 Cache | ||
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-linux-oneapi-${{ matrix.arch }}-${{ matrix.version }} | ||
path: | | ||
${{ github.workspace }}/.cache | ||
- name: Setup QEMU | ||
if: ${{ matrix.arch == 'arm64' }} | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
image: tonistiigi/binfmt:qemu-v7.0.0 | ||
platforms: "arm64" | ||
- 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 "===== SCRIPT =====" | ||
cat <<EOF > /tmp/entrypoint.sh | ||
#!/bin/bash | ||
apt-get update && apt-get install -y build-essential git cmake ccache | ||
git config --system --add safe.directory '*' | ||
mkdir -p ${{ github.workspace }}/.cache | ||
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}/build -DCMAKE_BUILD_TYPE=Release \ | ||
-DLLAMA_SYCL=on -DLLAMA_SYCL_F16=on \ | ||
${{ matrix.arch == 'amd64' && '-DLLAMA_NATIVE=off' || '-DLLAMA_NATIVE=on' }} \ | ||
-DLLAMA_OPENMP=off | ||
cmake --build ${{ github.workspace }}/build --target llama-box --config Release -- -j $(nproc) | ||
EOF | ||
chmod +x /tmp/entrypoint.sh | ||
cat /tmp/entrypoint.sh | ||
echo "===== BUILD =====" | ||
docker run \ | ||
--rm \ | ||
--privileged \ | ||
--platform linux/${{ matrix.arch }} \ | ||
--volume ${{ github.workspace }}:${{ github.workspace }} \ | ||
--workdir ${{ github.workspace }} \ | ||
--env CC=icx \ | ||
--env CXX=icx \ | ||
--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 | ||
echo "===== RESULT =====" | ||
if [ -f ${{ github.workspace }}/build/bin/llama-box ]; then | ||
ldd ${{ github.workspace }}/build/bin/llama-box | ||
else | ||
exit 1 | ||
fi | ||
echo "===== PACKAGE =====" | ||
mkdir -p ${{ github.workspace }}/out | ||
zip -j ${{ github.workspace }}/out/llama-box-linux-${{ matrix.arch }}-openapi-${{ matrix.version }}.zip ${{ github.workspace }}/build/bin/* | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: ${{ github.workspace }}/out/*.zip | ||
name: llama-box-linux-${{ matrix.arch }}-oneapi-${{ matrix.version }} | ||
|
||
# cache-able building with ccache. | ||
windows-hip: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -304,35 +399,24 @@ jobs: | |
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-windows-hip-${{ matrix.arch }}-${{ matrix.version }}-${{ hashFiles('**/.gitmodules') }} | ||
key: cache-windows-hip-${{ matrix.arch }}-${{ matrix.version }} | ||
path: | | ||
${{ github.workspace }}\.cache | ||
${{ github.workspace }}\tmp | ||
- name: Deps | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
$WarningPreference = 'SilentlyContinue' | ||
$VerbosePreference = 'SilentlyContinue' | ||
$DebugPreference = 'SilentlyContinue' | ||
$ProgressPreference = 'SilentlyContinue' | ||
choco install ccache -y | ||
- name: Setup HIP | ||
id: sdk | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
$WarningPreference = 'SilentlyContinue' | ||
$VerbosePreference = 'SilentlyContinue' | ||
$DebugPreference = 'SilentlyContinue' | ||
$ProgressPreference = 'SilentlyContinue' | ||
Write-Host "I install AMD ROCm HIP SDK" | ||
if (-not (Test-Path -Path "${{ github.workspace }}\tmp\rocm-install.exe" -PathType Leaf)) { | ||
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\tmp" -ErrorAction Ignore | Out-Null | ||
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ matrix.version == '5.7' && '23.Q4' || '23.Q3' }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe" | ||
Move-Item -Path "${env:RUNNER_TEMP}\rocm-install.exe" -Destination "${{ github.workspace }}\tmp\rocm-install.exe" | ||
} | ||
Start-Process "${{ github.workspace }}\tmp\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait | ||
Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-${{ matrix.version == '5.7' && '23.Q4' || '23.Q3' }}-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe" | ||
Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait | ||
Write-Host "I verify AMD ROCm HIP SDK" | ||
& 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version | ||
|
@@ -380,6 +464,8 @@ jobs: | |
path: ${{ github.workspace }}\\out\\*.zip | ||
name: llama-box-windows-${{ matrix.arch }}-hip-${{ matrix.version }} | ||
|
||
# uncache-able building, | ||
# see https://stackoverflow.com/questions/72829476/how-to-use-ccache-4-6-1-on-windows-msvc-with-cmake. | ||
windows-cuda: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -398,33 +484,27 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
submodules: 'recursive' | ||
- name: Setup Cache | ||
# ccache doesn't work with Visual Studio generator, | ||
# see https://stackoverflow.com/questions/72829476/how-to-use-ccache-4-6-1-on-windows-msvc-with-cmake. | ||
timeout-minutes: 5 | ||
uses: actions/cache@v3 | ||
with: | ||
key: cache-windows-cuda-${{ matrix.arch }}-${{ matrix.version }}-${{ hashFiles('**/.gitmodules') }} | ||
path: | | ||
${{ github.workspace }}\\build | ||
- name: Setup CUDA | ||
# ensure MSBuildExtensions has been configured, | ||
# see https://github.com/NVlabs/tiny-cuda-nn/issues/164#issuecomment-1280749170. | ||
id: sdk | ||
uses: Jimver/[email protected] | ||
with: | ||
cuda: ${{ matrix.version == '12.5' && '12.5.0' || '11.7.1' }} | ||
method: 'local' | ||
method: 'network' | ||
sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]' | ||
- 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. | ||
# build fat binary, | ||
# see https://developer.nvidia.com/cuda-gpus. | ||
# ensure MSBuildExtensions has been set, | ||
# see https://github.com/NVlabs/tiny-cuda-nn/issues/164#issuecomment-1280749170. | ||
env: | ||
CUDA_ARCHITECTURES: "${{ startsWith(matrix.version, '12.') && '50;52;53;60;61;62;70;72;75;80;86;87;89;90' || '50;52;53;60;61;62;70;72;75;80;86;87' }}" | ||
run: | | ||
$ErrorActionPreference = "Stop" | ||
$ProgressPreference = 'SilentlyContinue' | ||
Write-Host "===== BUILD =====" | ||
Write-Host "CUDA_PATH=${{ steps.sdk.outputs.CUDA_PATH }}" | ||
$env:CUDA_PATH = "${{ steps.sdk.outputs.CUDA_PATH }}" | ||
|
@@ -461,6 +541,7 @@ jobs: | |
- darwin-metal | ||
- linux-hip | ||
- linux-cuda | ||
- linux-openapi | ||
- windows-hip | ||
- windows-cuda | ||
steps: | ||
|