From 45d3bcd4340170ebee57bae83cdf224e0f9e110c Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Fri, 20 Dec 2024 22:37:03 -0700 Subject: [PATCH 01/19] 12.6.2 --- .github/workflows/custom_build.yml | 177 +++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 .github/workflows/custom_build.yml diff --git a/.github/workflows/custom_build.yml b/.github/workflows/custom_build.yml new file mode 100644 index 0000000000..02237991fc --- /dev/null +++ b/.github/workflows/custom_build.yml @@ -0,0 +1,177 @@ +name: build_win_cuda_full + +on: + workflow_dispatch: # allows manual triggering + inputs: + create_release: + description: 'Create new release' + required: true + type: boolean + cuda: + description: 'cuda version used to build. For available versions, check https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts' + required: false + type: string + default: '12.6.2' + gpu_arch: + description: 'nvidia gpu arch numbers' + required: false + type: string + default: '70;75;80;86' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: write + +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + GGML_NLOOP: 3 + GGML_N_THREADS: 1 + LLAMA_LOG_COLORS: 1 + LLAMA_LOG_PREFIX: 1 + LLAMA_LOG_TIMESTAMPS: 1 + +jobs: + + + windows-2019-cmake-cuda: + runs-on: windows-2019 + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get Python + uses: actions/setup-python@v2 + with: + python-version: 3.8.10 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install customtkinter==5.2.0 pyinstaller==5.11.0 psutil==5.9.5 + + - name: Download and install win64devkit + run: | + curl -L https://github.com/skeeto/w64devkit/releases/download/v1.22.0/w64devkit-1.22.0.zip --output w64devkit.zip + Expand-Archive w64devkit.zip -DestinationPath . + + - name: Add w64devkit to PATH + run: | + echo "$(Get-Location)\w64devkit\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Print System Environment Variables + id: printvars + run: | + echo "Number of processors: ${env:NUMBER_OF_PROCESSORS}" + echo "Processor Architecture: ${env:PROCESSOR_ARCHITECTURE}" + echo "Computer Name: ${env:COMPUTERNAME}" + wmic cpu get name + wmic os get TotalVisibleMemorySize, FreePhysicalMemory + + - uses: Jimver/cuda-toolkit@v0.2.19 + id: cuda-toolkit + with: + cuda: ${{ github.event.inputs.cuda }} + + + - name: Install ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }}-cuda${{ github.event.inputs.cuda }} + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" -DCMAKE_SYSTEM_VERSION="10.0.19041.0" + cmake --build . --config Release -j 2 + + - name: Determine tag name + id: tag + shell: bash + run: | + BUILD_NUMBER="$(git rev-list --count HEAD)" + SHORT_HASH="$(git rev-parse --short=7 HEAD)" + if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then + echo "name=b${BUILD_NUMBER}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT + else + SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-') + echo "name=WinFull-${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT + fi + + - name: Pack artifacts + id: pack_artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + run: | + 7z a llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip .\build\bin\Release\* + + - name: Upload artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + name: llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + + - name: Copy and pack Cuda runtime + run: | + echo "Cuda install location: ${{ env.CUDA_PATH }}" + $dst='.\build\bin\cudart\' + robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll + robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll + 7z a cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip $dst\* + + - name: Upload Cuda runtime + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + name: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + + - name: Download artifacts + id: download-artifact + uses: actions/download-artifact@v4 + with: + path: ./artifact + + - name: Move artifacts + id: move_artifacts + run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release + + - name: Create release + id: create_release + if: ${{ github.event.inputs.create_release == 'true' }} + uses: anzz1/action-create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.name }} + + - name: Upload release + id: upload_release + if: ${{ github.event.inputs.create_release == 'true' }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const path = require('path'); + const fs = require('fs'); + const release_id = '${{ steps.create_release.outputs.id }}'; + for (let file of await fs.readdirSync('./artifact/release')) { + if (path.extname(file) === '.zip') { + console.log('uploadReleaseAsset', file); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: file, + data: await fs.readFileSync(`./artifact/release/${file}`) + }); + } + } From 59afb0160e39cfeb8c5c90a9a84d7a4cf45bb4a5 Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Fri, 20 Dec 2024 22:37:51 -0700 Subject: [PATCH 02/19] custom_build_wincuda --- .../workflows/{custom_build.yml => custom_build_wincuda.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{custom_build.yml => custom_build_wincuda.yml} (96%) diff --git a/.github/workflows/custom_build.yml b/.github/workflows/custom_build_wincuda.yml similarity index 96% rename from .github/workflows/custom_build.yml rename to .github/workflows/custom_build_wincuda.yml index 02237991fc..069fa23787 100644 --- a/.github/workflows/custom_build.yml +++ b/.github/workflows/custom_build_wincuda.yml @@ -1,4 +1,4 @@ -name: build_win_cuda_full +name: custom_build_wincuda on: workflow_dispatch: # allows manual triggering From 9449305e47aaa96af249b10fc6bc341df2a765b7 Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Sun, 29 Dec 2024 16:08:46 -0700 Subject: [PATCH 03/19] trim trailing whitespaces --- .github/workflows/custom_build_wincuda.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/custom_build_wincuda.yml b/.github/workflows/custom_build_wincuda.yml index 069fa23787..27a9e7517f 100644 --- a/.github/workflows/custom_build_wincuda.yml +++ b/.github/workflows/custom_build_wincuda.yml @@ -23,7 +23,7 @@ concurrency: cancel-in-progress: true permissions: - contents: write + contents: write env: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} @@ -34,7 +34,7 @@ env: LLAMA_LOG_TIMESTAMPS: 1 jobs: - + windows-2019-cmake-cuda: runs-on: windows-2019 @@ -45,7 +45,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - + - name: Get Python uses: actions/setup-python@v2 with: @@ -73,12 +73,12 @@ jobs: echo "Computer Name: ${env:COMPUTERNAME}" wmic cpu get name wmic os get TotalVisibleMemorySize, FreePhysicalMemory - + - uses: Jimver/cuda-toolkit@v0.2.19 id: cuda-toolkit with: cuda: ${{ github.event.inputs.cuda }} - + - name: Install ccache uses: hendrikmuhs/ccache-action@v1.2 @@ -91,7 +91,7 @@ jobs: mkdir build cd build cmake .. -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" -DCMAKE_SYSTEM_VERSION="10.0.19041.0" - cmake --build . --config Release -j 2 + cmake --build . --config Release -j 2 - name: Determine tag name id: tag @@ -142,7 +142,7 @@ jobs: - name: Move artifacts id: move_artifacts - run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release + run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release - name: Create release id: create_release @@ -152,7 +152,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ steps.tag.outputs.name }} - + - name: Upload release id: upload_release if: ${{ github.event.inputs.create_release == 'true' }} From 632bc30e7542d906dbd51f3887ab87855b5bc143 Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Sun, 20 Apr 2025 14:00:06 -0600 Subject: [PATCH 04/19] test auto sync --- .github/workflows/syn_upstream.yml | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/syn_upstream.yml diff --git a/.github/workflows/syn_upstream.yml b/.github/workflows/syn_upstream.yml new file mode 100644 index 0000000000..5925f5cc38 --- /dev/null +++ b/.github/workflows/syn_upstream.yml @@ -0,0 +1,40 @@ +name: Sync Upstream + +on: + schedule: + - cron: '0 0 * * 0' # Every Sunday at midnight + +jobs: + merge: + runs-on: ubuntu-latest + steps: + - name: Checkout master branch + uses: actions/checkout@v2 + with: + ref: master + + - name: Merge upstream master + id: merge + run: | + git remote add upstream https://github.com/ggml-org/repository.git + git fetch upstream + if git merge upstream/master; then + echo "merge_success=true" >> $GITHUB_OUTPUT + else + echo "merge_success=false" >> $GITHUB_OUTPUT + echo "Automatic merge failed. Skipping push." + exit 0 + fi + + - name: Push changes + if: steps.merge.outputs.merge_success == 'true' + run: | + # Check if there are any changes + if git diff --quiet HEAD@{1} HEAD; then + echo "No changes to push" + else + echo "Changes detected, pushing updates..." + git push origin master + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From d251d891645cd3231d770fcbfe7943ce84fd9421 Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Wed, 27 Aug 2025 15:27:29 -0600 Subject: [PATCH 05/19] drop deprecated windows 2019 runner --- .github/workflows/custom_build_wincuda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/custom_build_wincuda.yml b/.github/workflows/custom_build_wincuda.yml index 27a9e7517f..30d88c87ba 100644 --- a/.github/workflows/custom_build_wincuda.yml +++ b/.github/workflows/custom_build_wincuda.yml @@ -36,8 +36,8 @@ env: jobs: - windows-2019-cmake-cuda: - runs-on: windows-2019 + windows-latest-cmake-cuda: + runs-on: windows-latest steps: - name: Clone From 2a1e77436c920973f79b9795dcb34ed55b13bf22 Mon Sep 17 00:00:00 2001 From: Jianlin Shi Date: Wed, 11 Mar 2026 20:02:20 -0500 Subject: [PATCH 06/19] build-linux-cuda --- .github/workflows/custom_build_rockylinux.yml | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 .github/workflows/custom_build_rockylinux.yml diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml new file mode 100644 index 0000000000..8ba3861eb1 --- /dev/null +++ b/.github/workflows/custom_build_rockylinux.yml @@ -0,0 +1,130 @@ +name: build-linux-cuda + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-linux-cuda: + runs-on: ubuntu-latest + + container: + image: nvidia/cuda:12.8.0-devel-rockylinux8 + + env: + BUILD_TYPE: Release + ARCHIVE_BASENAME: llama-bin-linux-cuda-12.8-rockylinux8 + + steps: + - name: Install build dependencies + shell: bash + run: | + set -euxo pipefail + yum -y update + yum -y install \ + git \ + cmake \ + gcc \ + gcc-c++ \ + make \ + ninja-build \ + tar \ + gzip \ + zip \ + findutils \ + file \ + which + yum clean all + + - name: Checkout source at release tag + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} + submodules: recursive + fetch-depth: 0 + + - name: Show build environment + shell: bash + run: | + set -euxo pipefail + cat /etc/os-release || true + uname -a + gcc --version + g++ --version + cmake --version + nvcc --version + + - name: Configure + shell: bash + run: | + set -euxo pipefail + cmake -S . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DGGML_CUDA=ON \ + -DCMAKE_CUDA_COMPILER=$(command -v nvcc) + + - name: Build + shell: bash + run: | + set -euxo pipefail + cmake --build build --config ${BUILD_TYPE} -j"$(nproc)" + + - name: Prepare release payload + shell: bash + run: | + set -euxo pipefail + + TAG="${{ github.event.release.tag_name }}" + OUTDIR="${ARCHIVE_BASENAME}-${TAG}" + mkdir -p "${OUTDIR}/bin" "${OUTDIR}/lib" "${OUTDIR}/meta" + + if [[ -d build/bin ]]; then + find build/bin -maxdepth 1 -type f \( -name 'llama-*' -o -name 'ggml-*' \) -exec cp -av {} "${OUTDIR}/bin/" \; + fi + + find build -maxdepth 3 -type f \( -name 'libllama*' -o -name 'libggml*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true + + git rev-parse HEAD > "${OUTDIR}/meta/git-commit.txt" + git describe --tags --always > "${OUTDIR}/meta/git-describe.txt" || true + cat /etc/os-release > "${OUTDIR}/meta/os-release.txt" || true + gcc --version > "${OUTDIR}/meta/gcc-version.txt" + g++ --version > "${OUTDIR}/meta/gxx-version.txt" + cmake --version > "${OUTDIR}/meta/cmake-version.txt" + nvcc --version > "${OUTDIR}/meta/nvcc-version.txt" + + if compgen -G "${OUTDIR}/bin/*" > /dev/null; then + file "${OUTDIR}"/bin/* > "${OUTDIR}/meta/file-bin.txt" || true + ldd "${OUTDIR}"/bin/* > "${OUTDIR}/meta/ldd-bin.txt" || true + fi + + if compgen -G "${OUTDIR}/lib/*" > /dev/null; then + file "${OUTDIR}"/lib/* > "${OUTDIR}/meta/file-lib.txt" || true + ldd "${OUTDIR}"/lib/* > "${OUTDIR}/meta/ldd-lib.txt" || true + fi + + tar -czf "${OUTDIR}.tar.gz" "${OUTDIR}" + sha256sum "${OUTDIR}.tar.gz" > "${OUTDIR}.tar.gz.sha256" + + - name: Upload tarball to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz + asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz + asset_content_type: application/gzip + + - name: Upload checksum to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 + asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 + asset_content_type: text/plain From 29b3c14619df80335edd68b5902aecb2fd0e9f04 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 21:44:36 -0600 Subject: [PATCH 07/19] workflow: update build configurations for Linux and Windows CUDA --- .github/workflows/custom_build_rockylinux.yml | 260 ++++++------- .github/workflows/custom_build_wincuda.yml | 354 +++++++++--------- .github/workflows/syn_upstream.yml | 80 ++-- 3 files changed, 347 insertions(+), 347 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 8ba3861eb1..a025f141ce 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -1,130 +1,130 @@ -name: build-linux-cuda - -on: - release: - types: [published] - -permissions: - contents: write - -jobs: - build-linux-cuda: - runs-on: ubuntu-latest - - container: - image: nvidia/cuda:12.8.0-devel-rockylinux8 - - env: - BUILD_TYPE: Release - ARCHIVE_BASENAME: llama-bin-linux-cuda-12.8-rockylinux8 - - steps: - - name: Install build dependencies - shell: bash - run: | - set -euxo pipefail - yum -y update - yum -y install \ - git \ - cmake \ - gcc \ - gcc-c++ \ - make \ - ninja-build \ - tar \ - gzip \ - zip \ - findutils \ - file \ - which - yum clean all - - - name: Checkout source at release tag - uses: actions/checkout@v4 - with: - ref: ${{ github.event.release.tag_name }} - submodules: recursive - fetch-depth: 0 - - - name: Show build environment - shell: bash - run: | - set -euxo pipefail - cat /etc/os-release || true - uname -a - gcc --version - g++ --version - cmake --version - nvcc --version - - - name: Configure - shell: bash - run: | - set -euxo pipefail - cmake -S . -B build \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DGGML_CUDA=ON \ - -DCMAKE_CUDA_COMPILER=$(command -v nvcc) - - - name: Build - shell: bash - run: | - set -euxo pipefail - cmake --build build --config ${BUILD_TYPE} -j"$(nproc)" - - - name: Prepare release payload - shell: bash - run: | - set -euxo pipefail - - TAG="${{ github.event.release.tag_name }}" - OUTDIR="${ARCHIVE_BASENAME}-${TAG}" - mkdir -p "${OUTDIR}/bin" "${OUTDIR}/lib" "${OUTDIR}/meta" - - if [[ -d build/bin ]]; then - find build/bin -maxdepth 1 -type f \( -name 'llama-*' -o -name 'ggml-*' \) -exec cp -av {} "${OUTDIR}/bin/" \; - fi - - find build -maxdepth 3 -type f \( -name 'libllama*' -o -name 'libggml*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true - - git rev-parse HEAD > "${OUTDIR}/meta/git-commit.txt" - git describe --tags --always > "${OUTDIR}/meta/git-describe.txt" || true - cat /etc/os-release > "${OUTDIR}/meta/os-release.txt" || true - gcc --version > "${OUTDIR}/meta/gcc-version.txt" - g++ --version > "${OUTDIR}/meta/gxx-version.txt" - cmake --version > "${OUTDIR}/meta/cmake-version.txt" - nvcc --version > "${OUTDIR}/meta/nvcc-version.txt" - - if compgen -G "${OUTDIR}/bin/*" > /dev/null; then - file "${OUTDIR}"/bin/* > "${OUTDIR}/meta/file-bin.txt" || true - ldd "${OUTDIR}"/bin/* > "${OUTDIR}/meta/ldd-bin.txt" || true - fi - - if compgen -G "${OUTDIR}/lib/*" > /dev/null; then - file "${OUTDIR}"/lib/* > "${OUTDIR}/meta/file-lib.txt" || true - ldd "${OUTDIR}"/lib/* > "${OUTDIR}/meta/ldd-lib.txt" || true - fi - - tar -czf "${OUTDIR}.tar.gz" "${OUTDIR}" - sha256sum "${OUTDIR}.tar.gz" > "${OUTDIR}.tar.gz.sha256" - - - name: Upload tarball to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz - asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz - asset_content_type: application/gzip - - - name: Upload checksum to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 - asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 - asset_content_type: text/plain +name: build-linux-cuda + +on: + release: + types: [published] + +permissions: + contents: write + +jobs: + build-linux-cuda: + runs-on: ubuntu-latest + + container: + image: nvidia/cuda:12.8.0-devel-rockylinux8 + + env: + BUILD_TYPE: Release + ARCHIVE_BASENAME: llama-bin-linux-cuda-12.8-rockylinux8 + + steps: + - name: Install build dependencies + shell: bash + run: | + set -euxo pipefail + yum -y update + yum -y install \ + git \ + cmake \ + gcc \ + gcc-c++ \ + make \ + ninja-build \ + tar \ + gzip \ + zip \ + findutils \ + file \ + which + yum clean all + + - name: Checkout source at release tag + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} + submodules: recursive + fetch-depth: 0 + + - name: Show build environment + shell: bash + run: | + set -euxo pipefail + cat /etc/os-release || true + uname -a + gcc --version + g++ --version + cmake --version + nvcc --version + + - name: Configure + shell: bash + run: | + set -euxo pipefail + cmake -S . -B build \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ + -DGGML_CUDA=ON \ + -DCMAKE_CUDA_COMPILER=$(command -v nvcc) + + - name: Build + shell: bash + run: | + set -euxo pipefail + cmake --build build --config ${BUILD_TYPE} -j"$(nproc)" + + - name: Prepare release payload + shell: bash + run: | + set -euxo pipefail + + TAG="${{ github.event.release.tag_name }}" + OUTDIR="${ARCHIVE_BASENAME}-${TAG}" + mkdir -p "${OUTDIR}/bin" "${OUTDIR}/lib" "${OUTDIR}/meta" + + if [[ -d build/bin ]]; then + find build/bin -maxdepth 1 -type f \( -name 'llama-*' -o -name 'ggml-*' \) -exec cp -av {} "${OUTDIR}/bin/" \; + fi + + find build -maxdepth 3 -type f \( -name 'libllama*' -o -name 'libggml*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true + + git rev-parse HEAD > "${OUTDIR}/meta/git-commit.txt" + git describe --tags --always > "${OUTDIR}/meta/git-describe.txt" || true + cat /etc/os-release > "${OUTDIR}/meta/os-release.txt" || true + gcc --version > "${OUTDIR}/meta/gcc-version.txt" + g++ --version > "${OUTDIR}/meta/gxx-version.txt" + cmake --version > "${OUTDIR}/meta/cmake-version.txt" + nvcc --version > "${OUTDIR}/meta/nvcc-version.txt" + + if compgen -G "${OUTDIR}/bin/*" > /dev/null; then + file "${OUTDIR}"/bin/* > "${OUTDIR}/meta/file-bin.txt" || true + ldd "${OUTDIR}"/bin/* > "${OUTDIR}/meta/ldd-bin.txt" || true + fi + + if compgen -G "${OUTDIR}/lib/*" > /dev/null; then + file "${OUTDIR}"/lib/* > "${OUTDIR}/meta/file-lib.txt" || true + ldd "${OUTDIR}"/lib/* > "${OUTDIR}/meta/ldd-lib.txt" || true + fi + + tar -czf "${OUTDIR}.tar.gz" "${OUTDIR}" + sha256sum "${OUTDIR}.tar.gz" > "${OUTDIR}.tar.gz.sha256" + + - name: Upload tarball to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz + asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz + asset_content_type: application/gzip + + - name: Upload checksum to release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 + asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 + asset_content_type: text/plain diff --git a/.github/workflows/custom_build_wincuda.yml b/.github/workflows/custom_build_wincuda.yml index 30d88c87ba..9791726399 100644 --- a/.github/workflows/custom_build_wincuda.yml +++ b/.github/workflows/custom_build_wincuda.yml @@ -1,177 +1,177 @@ -name: custom_build_wincuda - -on: - workflow_dispatch: # allows manual triggering - inputs: - create_release: - description: 'Create new release' - required: true - type: boolean - cuda: - description: 'cuda version used to build. For available versions, check https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts' - required: false - type: string - default: '12.6.2' - gpu_arch: - description: 'nvidia gpu arch numbers' - required: false - type: string - default: '70;75;80;86' - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: write - -env: - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - GGML_NLOOP: 3 - GGML_N_THREADS: 1 - LLAMA_LOG_COLORS: 1 - LLAMA_LOG_PREFIX: 1 - LLAMA_LOG_TIMESTAMPS: 1 - -jobs: - - - windows-latest-cmake-cuda: - runs-on: windows-latest - - steps: - - name: Clone - id: checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get Python - uses: actions/setup-python@v2 - with: - python-version: 3.8.10 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip install customtkinter==5.2.0 pyinstaller==5.11.0 psutil==5.9.5 - - - name: Download and install win64devkit - run: | - curl -L https://github.com/skeeto/w64devkit/releases/download/v1.22.0/w64devkit-1.22.0.zip --output w64devkit.zip - Expand-Archive w64devkit.zip -DestinationPath . - - - name: Add w64devkit to PATH - run: | - echo "$(Get-Location)\w64devkit\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - - - name: Print System Environment Variables - id: printvars - run: | - echo "Number of processors: ${env:NUMBER_OF_PROCESSORS}" - echo "Processor Architecture: ${env:PROCESSOR_ARCHITECTURE}" - echo "Computer Name: ${env:COMPUTERNAME}" - wmic cpu get name - wmic os get TotalVisibleMemorySize, FreePhysicalMemory - - - uses: Jimver/cuda-toolkit@v0.2.19 - id: cuda-toolkit - with: - cuda: ${{ github.event.inputs.cuda }} - - - - name: Install ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ github.job }}-cuda${{ github.event.inputs.cuda }} - - - name: Build - id: cmake_build - run: | - mkdir build - cd build - cmake .. -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" -DCMAKE_SYSTEM_VERSION="10.0.19041.0" - cmake --build . --config Release -j 2 - - - name: Determine tag name - id: tag - shell: bash - run: | - BUILD_NUMBER="$(git rev-list --count HEAD)" - SHORT_HASH="$(git rev-parse --short=7 HEAD)" - if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then - echo "name=b${BUILD_NUMBER}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT - else - SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-') - echo "name=WinFull-${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT - fi - - - name: Pack artifacts - id: pack_artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - run: | - 7z a llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip .\build\bin\Release\* - - - name: Upload artifacts - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: actions/upload-artifact@v4 - with: - path: llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip - name: llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip - - - name: Copy and pack Cuda runtime - run: | - echo "Cuda install location: ${{ env.CUDA_PATH }}" - $dst='.\build\bin\cudart\' - robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll - robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll - 7z a cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip $dst\* - - - name: Upload Cuda runtime - if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} - uses: actions/upload-artifact@v4 - with: - path: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip - name: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip - - - name: Download artifacts - id: download-artifact - uses: actions/download-artifact@v4 - with: - path: ./artifact - - - name: Move artifacts - id: move_artifacts - run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release - - - name: Create release - id: create_release - if: ${{ github.event.inputs.create_release == 'true' }} - uses: anzz1/action-create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.tag.outputs.name }} - - - name: Upload release - id: upload_release - if: ${{ github.event.inputs.create_release == 'true' }} - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GITHUB_TOKEN}} - script: | - const path = require('path'); - const fs = require('fs'); - const release_id = '${{ steps.create_release.outputs.id }}'; - for (let file of await fs.readdirSync('./artifact/release')) { - if (path.extname(file) === '.zip') { - console.log('uploadReleaseAsset', file); - await github.repos.uploadReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: release_id, - name: file, - data: await fs.readFileSync(`./artifact/release/${file}`) - }); - } - } +name: custom_build_wincuda + +on: + workflow_dispatch: # allows manual triggering + inputs: + create_release: + description: 'Create new release' + required: true + type: boolean + cuda: + description: 'cuda version used to build. For available versions, check https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts' + required: false + type: string + default: '12.6.2' + gpu_arch: + description: 'nvidia gpu arch numbers' + required: false + type: string + default: '70;75;80;86' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: write + +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + GGML_NLOOP: 3 + GGML_N_THREADS: 1 + LLAMA_LOG_COLORS: 1 + LLAMA_LOG_PREFIX: 1 + LLAMA_LOG_TIMESTAMPS: 1 + +jobs: + + + windows-latest-cmake-cuda: + runs-on: windows-latest + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get Python + uses: actions/setup-python@v2 + with: + python-version: 3.8.10 + + - name: Install python dependencies + run: | + python -m pip install --upgrade pip + pip install customtkinter==5.2.0 pyinstaller==5.11.0 psutil==5.9.5 + + - name: Download and install win64devkit + run: | + curl -L https://github.com/skeeto/w64devkit/releases/download/v1.22.0/w64devkit-1.22.0.zip --output w64devkit.zip + Expand-Archive w64devkit.zip -DestinationPath . + + - name: Add w64devkit to PATH + run: | + echo "$(Get-Location)\w64devkit\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + + - name: Print System Environment Variables + id: printvars + run: | + echo "Number of processors: ${env:NUMBER_OF_PROCESSORS}" + echo "Processor Architecture: ${env:PROCESSOR_ARCHITECTURE}" + echo "Computer Name: ${env:COMPUTERNAME}" + wmic cpu get name + wmic os get TotalVisibleMemorySize, FreePhysicalMemory + + - uses: Jimver/cuda-toolkit@v0.2.19 + id: cuda-toolkit + with: + cuda: ${{ github.event.inputs.cuda }} + + + - name: Install ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ github.job }}-cuda${{ github.event.inputs.cuda }} + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" -DCMAKE_SYSTEM_VERSION="10.0.19041.0" + cmake --build . --config Release -j 2 + + - name: Determine tag name + id: tag + shell: bash + run: | + BUILD_NUMBER="$(git rev-list --count HEAD)" + SHORT_HASH="$(git rev-parse --short=7 HEAD)" + if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then + echo "name=b${BUILD_NUMBER}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT + else + SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-') + echo "name=WinFull-${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}-${{ github.event.inputs.cuda }}" >> $GITHUB_OUTPUT + fi + + - name: Pack artifacts + id: pack_artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + run: | + 7z a llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip .\build\bin\Release\* + + - name: Upload artifacts + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: llama-${{ steps.tag.outputs.name }}-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + name: llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + + - name: Copy and pack Cuda runtime + run: | + echo "Cuda install location: ${{ env.CUDA_PATH }}" + $dst='.\build\bin\cudart\' + robocopy "${{env.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll + robocopy "${{env.CUDA_PATH}}\lib" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll + 7z a cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip $dst\* + + - name: Upload Cuda runtime + if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} + uses: actions/upload-artifact@v4 + with: + path: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + name: cudart-llama-bin-win-cu${{ github.event.inputs.cuda }}-x64.zip + + - name: Download artifacts + id: download-artifact + uses: actions/download-artifact@v4 + with: + path: ./artifact + + - name: Move artifacts + id: move_artifacts + run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release + + - name: Create release + id: create_release + if: ${{ github.event.inputs.create_release == 'true' }} + uses: anzz1/action-create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.name }} + + - name: Upload release + id: upload_release + if: ${{ github.event.inputs.create_release == 'true' }} + uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const path = require('path'); + const fs = require('fs'); + const release_id = '${{ steps.create_release.outputs.id }}'; + for (let file of await fs.readdirSync('./artifact/release')) { + if (path.extname(file) === '.zip') { + console.log('uploadReleaseAsset', file); + await github.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: release_id, + name: file, + data: await fs.readFileSync(`./artifact/release/${file}`) + }); + } + } diff --git a/.github/workflows/syn_upstream.yml b/.github/workflows/syn_upstream.yml index 5925f5cc38..683e6d0a0f 100644 --- a/.github/workflows/syn_upstream.yml +++ b/.github/workflows/syn_upstream.yml @@ -1,40 +1,40 @@ -name: Sync Upstream - -on: - schedule: - - cron: '0 0 * * 0' # Every Sunday at midnight - -jobs: - merge: - runs-on: ubuntu-latest - steps: - - name: Checkout master branch - uses: actions/checkout@v2 - with: - ref: master - - - name: Merge upstream master - id: merge - run: | - git remote add upstream https://github.com/ggml-org/repository.git - git fetch upstream - if git merge upstream/master; then - echo "merge_success=true" >> $GITHUB_OUTPUT - else - echo "merge_success=false" >> $GITHUB_OUTPUT - echo "Automatic merge failed. Skipping push." - exit 0 - fi - - - name: Push changes - if: steps.merge.outputs.merge_success == 'true' - run: | - # Check if there are any changes - if git diff --quiet HEAD@{1} HEAD; then - echo "No changes to push" - else - echo "Changes detected, pushing updates..." - git push origin master - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file +name: Sync Upstream + +on: + schedule: + - cron: '0 0 * * 0' # Every Sunday at midnight + +jobs: + merge: + runs-on: ubuntu-latest + steps: + - name: Checkout master branch + uses: actions/checkout@v2 + with: + ref: master + + - name: Merge upstream master + id: merge + run: | + git remote add upstream https://github.com/ggml-org/repository.git + git fetch upstream + if git merge upstream/master; then + echo "merge_success=true" >> $GITHUB_OUTPUT + else + echo "merge_success=false" >> $GITHUB_OUTPUT + echo "Automatic merge failed. Skipping push." + exit 0 + fi + + - name: Push changes + if: steps.merge.outputs.merge_success == 'true' + run: | + # Check if there are any changes + if git diff --quiet HEAD@{1} HEAD; then + echo "No changes to push" + else + echo "Changes detected, pushing updates..." + git push origin master + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a3cc7bf99247a3eac06b9853dd6baa2d4a9628cf Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 21:46:17 -0600 Subject: [PATCH 08/19] workflow: add manual trigger for release creation in Rocky Linux build --- .github/workflows/custom_build_rockylinux.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index a025f141ce..e1549b51d2 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -1,6 +1,12 @@ name: build-linux-cuda on: + workflow_dispatch: # allows manual triggering + inputs: + create_release: + description: 'Create new release' + required: true + type: boolean release: types: [published] From 38c82a6db77cea411f252452f3a522002e408242 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 21:55:44 -0600 Subject: [PATCH 09/19] workflow: install epel-release as a build dependency for Rocky Linux --- .github/workflows/custom_build_rockylinux.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index e1549b51d2..d638205b7d 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -30,6 +30,7 @@ jobs: run: | set -euxo pipefail yum -y update + yum -y install epel-release yum -y install \ git \ cmake \ From ddb3fcd924d69b3cf50e26d37d0be1e844f8e207 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 22:01:02 -0600 Subject: [PATCH 10/19] workflow: comment out yum update in Rocky Linux build script --- .github/workflows/custom_build_rockylinux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index d638205b7d..0d8f34b583 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -29,7 +29,7 @@ jobs: shell: bash run: | set -euxo pipefail - yum -y update + # yum -y update yum -y install epel-release yum -y install \ git \ From 65f59acdde54b34566c4788883e5a2044d8afcd1 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 22:05:15 -0600 Subject: [PATCH 11/19] workflow: update package manager commands from yum to dnf in Rocky Linux build script --- .github/workflows/custom_build_rockylinux.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 0d8f34b583..02ef65e514 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -29,9 +29,11 @@ jobs: shell: bash run: | set -euxo pipefail - # yum -y update - yum -y install epel-release - yum -y install \ + # dnf -y update + dnf -y install epel-release + dnf config-manager --set-enabled powertools + dnf config-manager --set-enabled crb + dnf -y install \ git \ cmake \ gcc \ @@ -44,7 +46,7 @@ jobs: findutils \ file \ which - yum clean all + dnf clean all - name: Checkout source at release tag uses: actions/checkout@v4 From 200905df28f4a90063207d7ac9966fdc9db0da77 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 22:10:13 -0600 Subject: [PATCH 12/19] workflow: remove crb repository enablement from Rocky Linux build script --- .github/workflows/custom_build_rockylinux.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 02ef65e514..809ee85ba6 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -32,7 +32,6 @@ jobs: # dnf -y update dnf -y install epel-release dnf config-manager --set-enabled powertools - dnf config-manager --set-enabled crb dnf -y install \ git \ cmake \ From b1e28fa5110891a6d25a8b90e07b9d8684b6e561 Mon Sep 17 00:00:00 2001 From: jianlins Date: Wed, 11 Mar 2026 22:28:21 -0600 Subject: [PATCH 13/19] workflow: add gpu_arch input for customizable CUDA architecture in build script --- .github/workflows/custom_build_rockylinux.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 809ee85ba6..5a82b28cee 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -7,6 +7,11 @@ on: description: 'Create new release' required: true type: boolean + gpu_arch: + description: 'nvidia gpu arch numbers (semicolon-separated, e.g. 70;75;80;86)' + required: false + type: string + default: '70;75;80;86;89' release: types: [published] @@ -73,7 +78,8 @@ jobs: -G Ninja \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DGGML_CUDA=ON \ - -DCMAKE_CUDA_COMPILER=$(command -v nvcc) + -DCMAKE_CUDA_COMPILER=$(command -v nvcc) \ + -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" - name: Build shell: bash From 460a53595658fe48c1549e51909eaeb43c6e6012 Mon Sep 17 00:00:00 2001 From: jianlins Date: Thu, 12 Mar 2026 00:01:18 -0600 Subject: [PATCH 14/19] workflow: update build script to use gcc-toolset-12 and add linker flags --- .github/workflows/custom_build_rockylinux.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 5a82b28cee..dd7332d9fc 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -40,8 +40,7 @@ jobs: dnf -y install \ git \ cmake \ - gcc \ - gcc-c++ \ + gcc-toolset-12 \ make \ ninja-build \ tar \ @@ -63,6 +62,7 @@ jobs: shell: bash run: | set -euxo pipefail + source scl_source enable gcc-toolset-12 cat /etc/os-release || true uname -a gcc --version @@ -74,17 +74,20 @@ jobs: shell: bash run: | set -euxo pipefail + source scl_source enable gcc-toolset-12 cmake -S . -B build \ -G Ninja \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DGGML_CUDA=ON \ -DCMAKE_CUDA_COMPILER=$(command -v nvcc) \ - -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" + -DCMAKE_CUDA_ARCHITECTURES="${{ github.event.inputs.gpu_arch }}" \ + -DCMAKE_EXE_LINKER_FLAGS=-Wl,--allow-shlib-undefined - name: Build shell: bash run: | set -euxo pipefail + source scl_source enable gcc-toolset-12 cmake --build build --config ${BUILD_TYPE} -j"$(nproc)" - name: Prepare release payload From eb7a304948d31cc06342e53cc99d1678403f42ee Mon Sep 17 00:00:00 2001 From: jianlins Date: Thu, 12 Mar 2026 00:08:04 -0600 Subject: [PATCH 15/19] workflow: update build steps to handle gcc-toolset-12 sourcing more safely --- .github/workflows/custom_build_rockylinux.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index dd7332d9fc..9a1b895198 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -62,7 +62,7 @@ jobs: shell: bash run: | set -euxo pipefail - source scl_source enable gcc-toolset-12 + set +u; source scl_source enable gcc-toolset-12; set -u cat /etc/os-release || true uname -a gcc --version @@ -74,7 +74,7 @@ jobs: shell: bash run: | set -euxo pipefail - source scl_source enable gcc-toolset-12 + set +u; source scl_source enable gcc-toolset-12; set -u cmake -S . -B build \ -G Ninja \ -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ @@ -87,7 +87,7 @@ jobs: shell: bash run: | set -euxo pipefail - source scl_source enable gcc-toolset-12 + set +u; source scl_source enable gcc-toolset-12; set -u cmake --build build --config ${BUILD_TYPE} -j"$(nproc)" - name: Prepare release payload From a23f3fb7fdd6c7c5c8bc3e52a3becac48be322b2 Mon Sep 17 00:00:00 2001 From: jianlins Date: Thu, 12 Mar 2026 20:12:53 -0600 Subject: [PATCH 16/19] workflow: add safe.directory configuration for Git in build script --- .github/workflows/custom_build_rockylinux.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 9a1b895198..3231aaacc0 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -105,6 +105,8 @@ jobs: find build -maxdepth 3 -type f \( -name 'libllama*' -o -name 'libggml*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true + git config --global --add safe.directory "${GITHUB_WORKSPACE:-/__w/llama.cpp/llama.cpp}" + git rev-parse HEAD > "${OUTDIR}/meta/git-commit.txt" git describe --tags --always > "${OUTDIR}/meta/git-describe.txt" || true cat /etc/os-release > "${OUTDIR}/meta/os-release.txt" || true From 25581cbb35e9a0dd6859e2a8d278abc2cdf51d08 Mon Sep 17 00:00:00 2001 From: jianlins Date: Thu, 12 Mar 2026 22:05:23 -0600 Subject: [PATCH 17/19] workflow: require tag_name input for manual release trigger and update asset upload process --- .github/workflows/custom_build_rockylinux.yml | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 3231aaacc0..3b45c5b444 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -7,6 +7,10 @@ on: description: 'Create new release' required: true type: boolean + tag_name: + description: 'Tag name for the release (required for manual trigger)' + required: true + type: string gpu_arch: description: 'nvidia gpu arch numbers (semicolon-separated, e.g. 70;75;80;86)' required: false @@ -28,6 +32,7 @@ jobs: env: BUILD_TYPE: Release ARCHIVE_BASENAME: llama-bin-linux-cuda-12.8-rockylinux8 + TAG_NAME: ${{ github.event.release.tag_name || github.event.inputs.tag_name }} steps: - name: Install build dependencies @@ -54,7 +59,7 @@ jobs: - name: Checkout source at release tag uses: actions/checkout@v4 with: - ref: ${{ github.event.release.tag_name }} + ref: ${{ env.TAG_NAME }} submodules: recursive fetch-depth: 0 @@ -95,7 +100,7 @@ jobs: run: | set -euxo pipefail - TAG="${{ github.event.release.tag_name }}" + TAG="${TAG_NAME}" OUTDIR="${ARCHIVE_BASENAME}-${TAG}" mkdir -p "${OUTDIR}/bin" "${OUTDIR}/lib" "${OUTDIR}/meta" @@ -128,22 +133,11 @@ jobs: tar -czf "${OUTDIR}.tar.gz" "${OUTDIR}" sha256sum "${OUTDIR}.tar.gz" > "${OUTDIR}.tar.gz.sha256" - - name: Upload tarball to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload release assets + if: github.event_name == 'release' || github.event.inputs.create_release == 'true' + uses: softprops/action-gh-release@v2 with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz - asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz - asset_content_type: application/gzip - - - name: Upload checksum to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ./llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 - asset_name: llama-bin-linux-cuda-12.8-rockylinux8-${{ github.event.release.tag_name }}.tar.gz.sha256 - asset_content_type: text/plain + tag_name: ${{ env.TAG_NAME }} + files: | + ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz + ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz.sha256 From cd9d8771c2b743de97d672edbbf5587acbcbaba3 Mon Sep 17 00:00:00 2001 From: jianlins Date: Thu, 12 Mar 2026 23:02:38 -0600 Subject: [PATCH 18/19] workflow: update source checkout step and add tag creation logic in build script --- .github/workflows/custom_build_rockylinux.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 3b45c5b444..6a53f84dc0 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -56,13 +56,26 @@ jobs: which dnf clean all - - name: Checkout source at release tag + - name: Checkout source uses: actions/checkout@v4 with: - ref: ${{ env.TAG_NAME }} submodules: recursive fetch-depth: 0 + - name: Create tag if it does not exist + shell: bash + run: | + set -euxo pipefail + git config --global --add safe.directory "${GITHUB_WORKSPACE:-/__w/llama.cpp/llama.cpp}" + if git rev-parse "refs/tags/${TAG_NAME}" >/dev/null 2>&1; then + echo "Tag ${TAG_NAME} already exists, checking out." + git checkout "${TAG_NAME}" + else + echo "Tag ${TAG_NAME} does not exist, creating it on HEAD." + git tag "${TAG_NAME}" + git push origin "refs/tags/${TAG_NAME}" + fi + - name: Show build environment shell: bash run: | @@ -140,4 +153,4 @@ jobs: tag_name: ${{ env.TAG_NAME }} files: | ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz - ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz.sha256 + ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz.sha256 \ No newline at end of file From 48c561fcc9af58a1eaf24f52b39df3acced4db15 Mon Sep 17 00:00:00 2001 From: jianlins Date: Fri, 13 Mar 2026 11:57:51 -0600 Subject: [PATCH 19/19] workflow: enhance library packaging by preserving symlinks and adding runtime checks --- .github/workflows/custom_build_rockylinux.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/custom_build_rockylinux.yml b/.github/workflows/custom_build_rockylinux.yml index 6a53f84dc0..1abc520c3b 100644 --- a/.github/workflows/custom_build_rockylinux.yml +++ b/.github/workflows/custom_build_rockylinux.yml @@ -121,7 +121,12 @@ jobs: find build/bin -maxdepth 1 -type f \( -name 'llama-*' -o -name 'ggml-*' \) -exec cp -av {} "${OUTDIR}/bin/" \; fi - find build -maxdepth 3 -type f \( -name 'libllama*' -o -name 'libggml*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true + # Keep both files and symlinks so SONAME links (for example libmtmd.so.0) survive packaging. + find build -maxdepth 3 \( -type f -o -type l \) \( -name 'libllama*' -o -name 'libggml*' -o -name 'libmtmd*' \) -exec cp -av {} "${OUTDIR}/lib/" \; || true + + # Fail fast if required runtime library links are missing from the payload. + test -e "${OUTDIR}/lib/libmtmd.so.0" + test -e "${OUTDIR}/lib/libllama.so.0" git config --global --add safe.directory "${GITHUB_WORKSPACE:-/__w/llama.cpp/llama.cpp}" @@ -153,4 +158,4 @@ jobs: tag_name: ${{ env.TAG_NAME }} files: | ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz - ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz.sha256 \ No newline at end of file + ./${{ env.ARCHIVE_BASENAME }}-${{ env.TAG_NAME }}.tar.gz.sha256