/ .github / workflows / build.yml
build.yml
   1  name: CI
   2  
   3  on:
   4    workflow_dispatch: # allows manual triggering
   5      inputs:
   6        create_release:
   7          description: 'Create new release'
   8          required: true
   9          type: boolean
  10    push:
  11      branches:
  12        - master
  13      paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.swift', '**/*.m']
  14    pull_request:
  15      types: [opened, synchronize, reopened]
  16      paths: ['.github/workflows/build.yml', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.hpp', '**/*.c', '**/*.cpp', '**/*.cu', '**/*.cuh', '**/*.swift', '**/*.m']
  17  
  18  concurrency:
  19    group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
  20    cancel-in-progress: true
  21  
  22  env:
  23    BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
  24    GGML_NLOOP: 3
  25    GGML_N_THREADS: 1
  26  
  27  jobs:
  28    macOS-latest-cmake-arm64:
  29      runs-on: macos-14
  30  
  31      steps:
  32        - name: Clone
  33          id: checkout
  34          uses: actions/checkout@v4
  35          with:
  36            fetch-depth: 0
  37  
  38        - name: Dependencies
  39          id: depends
  40          continue-on-error: true
  41          run: |
  42            brew update
  43  
  44        - name: Build
  45          id: cmake_build
  46          run: |
  47            sysctl -a
  48            mkdir build
  49            cd build
  50            cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL_EMBED_LIBRARY=ON -DLLAMA_CURL=ON ..
  51            cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
  52  
  53        - name: Test
  54          id: cmake_test
  55          run: |
  56            cd build
  57            ctest -L 'main|curl' --verbose --timeout 900
  58  
  59        - name: Determine tag name
  60          id: tag
  61          shell: bash
  62          run: |
  63            BUILD_NUMBER="$(git rev-list --count HEAD)"
  64            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
  65            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
  66              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
  67            else
  68              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
  69              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
  70            fi
  71  
  72        - name: Pack artifacts
  73          id: pack_artifacts
  74          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  75          run: |
  76            cp LICENSE ./build/bin/
  77            zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip ./build/bin/*
  78  
  79        - name: Upload artifacts
  80          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
  81          uses: actions/upload-artifact@v4
  82          with:
  83            path: llama-${{ steps.tag.outputs.name }}-bin-macos-arm64.zip
  84            name: llama-bin-macos-arm64.zip
  85  
  86    macOS-latest-cmake-x64:
  87      runs-on: macos-12
  88  
  89      steps:
  90        - name: Clone
  91          id: checkout
  92          uses: actions/checkout@v4
  93          with:
  94            fetch-depth: 0
  95  
  96        - name: Dependencies
  97          id: depends
  98          continue-on-error: true
  99          run: |
 100            brew update
 101  
 102        - name: Build
 103          id: cmake_build
 104          run: |
 105            sysctl -a
 106            # Metal is disabled due to intermittent failures with Github runners not having a GPU:
 107            # https://github.com/ggerganov/llama.cpp/actions/runs/8635935781/job/23674807267#step:5:2313
 108            cmake -B build -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL=OFF -DLLAMA_CURL=ON
 109            cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
 110  
 111        - name: Test
 112          id: cmake_test
 113          run: |
 114            cd build
 115            ctest -L main --verbose --timeout 900
 116  
 117        - name: Determine tag name
 118          id: tag
 119          shell: bash
 120          run: |
 121            BUILD_NUMBER="$(git rev-list --count HEAD)"
 122            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
 123            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
 124              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
 125            else
 126              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
 127              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
 128            fi
 129  
 130        - name: Pack artifacts
 131          id: pack_artifacts
 132          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 133          run: |
 134            cp LICENSE ./build/bin/
 135            zip -r llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip ./build/bin/*
 136  
 137        - name: Upload artifacts
 138          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 139          uses: actions/upload-artifact@v4
 140          with:
 141            path: llama-${{ steps.tag.outputs.name }}-bin-macos-x64.zip
 142            name: llama-bin-macos-x64.zip
 143  
 144    ubuntu-focal-make:
 145      runs-on: ubuntu-20.04
 146      env:
 147        LLAMA_NODE_AVAILABLE: true
 148        LLAMA_PYTHON_AVAILABLE: true
 149  
 150      steps:
 151        - name: Clone
 152          id: checkout
 153          uses: actions/checkout@v4
 154  
 155        - name: Dependencies
 156          id: depends
 157          run: |
 158            sudo apt-get update
 159            sudo apt-get install build-essential gcc-8
 160  
 161        - uses: actions/setup-node@v4
 162          with:
 163            node-version: "20"
 164  
 165        - uses: actions/setup-python@v5
 166          with:
 167            python-version: "3.11"
 168  
 169        - name: Build
 170          id: make_build
 171          env:
 172              LLAMA_FATAL_WARNINGS: 1
 173          run: |
 174            CC=gcc-8 make -j $(nproc)
 175  
 176        - name: Test
 177          id: make_test
 178          run: |
 179            CC=gcc-8 make tests -j $(nproc)
 180            make test -j $(nproc)
 181  
 182    ubuntu-focal-make-curl:
 183      runs-on: ubuntu-20.04
 184  
 185      steps:
 186        - name: Clone
 187          id: checkout
 188          uses: actions/checkout@v4
 189  
 190        - name: Dependencies
 191          id: depends
 192          run: |
 193            sudo apt-get update
 194            sudo apt-get install build-essential gcc-8 libcurl4-openssl-dev
 195  
 196        - name: Build
 197          id: make_build
 198          env:
 199            LLAMA_FATAL_WARNINGS: 1
 200            LLAMA_CURL: 1
 201          run: |
 202            CC=gcc-8 make -j $(nproc)
 203  
 204    ubuntu-latest-cmake:
 205      runs-on: ubuntu-latest
 206  
 207      steps:
 208        - name: Clone
 209          id: checkout
 210          uses: actions/checkout@v4
 211          with:
 212            fetch-depth: 0
 213  
 214        - name: Dependencies
 215          id: depends
 216          run: |
 217            sudo apt-get update
 218            sudo apt-get install build-essential libcurl4-openssl-dev
 219  
 220        - name: Build
 221          id: cmake_build
 222          run: |
 223            mkdir build
 224            cd build
 225            cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_CURL=ON
 226            cmake --build . --config Release -j $(nproc)
 227  
 228        - name: Test
 229          id: cmake_test
 230          run: |
 231            cd build
 232            ctest -L 'main|curl' --verbose --timeout 900
 233  
 234        - name: Test llama2c conversion
 235          id: llama2c_test
 236          run: |
 237            cd build
 238            echo "Fetch tokenizer"
 239            wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/tok512.bin
 240            echo "Fetch llama2c model"
 241            wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
 242            ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
 243            ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
 244  
 245        - name: Determine tag name
 246          id: tag
 247          shell: bash
 248          run: |
 249            BUILD_NUMBER="$(git rev-list --count HEAD)"
 250            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
 251            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
 252              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
 253            else
 254              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
 255              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
 256            fi
 257  
 258        - name: Pack artifacts
 259          id: pack_artifacts
 260          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 261          run: |
 262            cp LICENSE ./build/bin/
 263            zip -r llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip ./build/bin/*
 264  
 265        - name: Upload artifacts
 266          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 267          uses: actions/upload-artifact@v4
 268          with:
 269            path: llama-${{ steps.tag.outputs.name }}-bin-ubuntu-x64.zip
 270            name: llama-bin-ubuntu-x64.zip
 271  
 272    ubuntu-latest-cmake-sanitizer:
 273      runs-on: ubuntu-latest
 274  
 275      continue-on-error: true
 276  
 277      strategy:
 278        matrix:
 279          sanitizer: [ADDRESS, THREAD, UNDEFINED]
 280          build_type: [Debug, Release]
 281  
 282      steps:
 283        - name: Clone
 284          id: checkout
 285          uses: actions/checkout@v4
 286  
 287        - name: Dependencies
 288          id: depends
 289          run: |
 290            sudo apt-get update
 291            sudo apt-get install build-essential
 292  
 293        - name: Build
 294          id: cmake_build
 295          if: ${{ matrix.sanitizer != 'THREAD' }}
 296          run: |
 297            mkdir build
 298            cd build
 299            cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
 300            cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
 301  
 302        - name: Build (no OpenMP)
 303          id: cmake_build_no_openmp
 304          if: ${{ matrix.sanitizer == 'THREAD' }}
 305          run: |
 306            mkdir build
 307            cd build
 308            cmake .. -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DLLAMA_OPENMP=OFF
 309            cmake --build . --config ${{ matrix.build_type }} -j $(nproc)
 310  
 311        - name: Test
 312          id: cmake_test
 313          run: |
 314            cd build
 315            ctest -L main --verbose --timeout 900
 316  
 317    ubuntu-latest-cmake-rpc:
 318      runs-on: ubuntu-latest
 319  
 320      continue-on-error: true
 321  
 322      steps:
 323        - name: Clone
 324          id: checkout
 325          uses: actions/checkout@v4
 326  
 327        - name: Dependencies
 328          id: depends
 329          run: |
 330            sudo apt-get update
 331            sudo apt-get install build-essential
 332  
 333        - name: Build
 334          id: cmake_build
 335          run: |
 336            mkdir build
 337            cd build
 338            cmake -DLLAMA_RPC=ON ..
 339            cmake --build . --config Release -j $(nproc)
 340  
 341        - name: Test
 342          id: cmake_test
 343          run: |
 344            cd build
 345            ctest -L main --verbose
 346  
 347    ubuntu-22-cmake-vulkan:
 348      runs-on: ubuntu-22.04
 349  
 350      steps:
 351        - name: Clone
 352          id: checkout
 353          uses: actions/checkout@v4
 354  
 355        - name: Dependencies
 356          id: depends
 357          run: |
 358            sudo apt-get update
 359            sudo apt-get install build-essential libvulkan-dev
 360  
 361        - name: Build
 362          id: cmake_build
 363          run: |
 364            mkdir build
 365            cd build
 366            cmake -DLLAMA_VULKAN=ON ..
 367            cmake --build . --config Release -j $(nproc)
 368  
 369    ubuntu-22-cmake-hip:
 370      runs-on: ubuntu-22.04
 371      container: rocm/dev-ubuntu-22.04:6.0.2
 372  
 373      steps:
 374        - name: Clone
 375          id: checkout
 376          uses: actions/checkout@v3
 377  
 378        - name: Dependencies
 379          id: depends
 380          run: |
 381            sudo apt-get update
 382            sudo apt-get install -y build-essential git cmake rocblas-dev hipblas-dev
 383  
 384        - name: Build with native CMake HIP support
 385          id: cmake_build
 386          run: |
 387            cmake -B build -S . -DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" -DLLAMA_HIPBLAS=ON
 388            cmake --build build --config Release -j $(nproc)
 389  
 390        - name: Build with legacy HIP support
 391          id: cmake_build_legacy_hip
 392          run: |
 393            cmake -B build2 -S . -DCMAKE_C_COMPILER=hipcc -DCMAKE_CXX_COMPILER=hipcc -DLLAMA_HIPBLAS=ON
 394            cmake --build build2 --config Release -j $(nproc)
 395  
 396    ubuntu-22-cmake-sycl:
 397      runs-on: ubuntu-22.04
 398  
 399      continue-on-error: true
 400  
 401      steps:
 402        - uses: actions/checkout@v2
 403  
 404        - name: add oneAPI to apt
 405          shell: bash
 406          run: |
 407            cd /tmp
 408            wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 409            sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 410            rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 411            sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
 412  
 413        - name: install oneAPI dpcpp compiler
 414          shell: bash
 415          run: |
 416            sudo apt update
 417            sudo apt install intel-oneapi-compiler-dpcpp-cpp
 418  
 419        - name: install oneAPI MKL library
 420          shell: bash
 421          run: |
 422            sudo apt install intel-oneapi-mkl-devel
 423  
 424        - name: Clone
 425          id: checkout
 426          uses: actions/checkout@v4
 427  
 428        - name: Build
 429          id: cmake_build
 430          run: |
 431            source /opt/intel/oneapi/setvars.sh
 432            mkdir build
 433            cd build
 434            cmake -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx ..
 435            cmake --build . --config Release -j $(nproc)
 436  
 437    ubuntu-22-cmake-sycl-fp16:
 438      runs-on: ubuntu-22.04
 439  
 440      continue-on-error: true
 441  
 442      steps:
 443        - uses: actions/checkout@v2
 444  
 445        - name: add oneAPI to apt
 446          shell: bash
 447          run: |
 448            cd /tmp
 449            wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 450            sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 451            rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
 452            sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
 453  
 454        - name: install oneAPI dpcpp compiler
 455          shell: bash
 456          run: |
 457            sudo apt update
 458            sudo apt install intel-oneapi-compiler-dpcpp-cpp
 459  
 460        - name: install oneAPI MKL library
 461          shell: bash
 462          run: |
 463            sudo apt install intel-oneapi-mkl-devel
 464  
 465        - name: Clone
 466          id: checkout
 467          uses: actions/checkout@v4
 468  
 469        - name: Build
 470          id: cmake_build
 471          run: |
 472            source /opt/intel/oneapi/setvars.sh
 473            mkdir build
 474            cd build
 475            cmake -DLLAMA_SYCL=ON -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DLLAMA_SYCL_F16=ON ..
 476            cmake --build . --config Release -j $(nproc)
 477  
 478    # TODO: build with LLAMA_NO_METAL because test-backend-ops fail on "Apple Paravirtual device" and I don't know
 479    #       how to debug it.
 480    #       ref: https://github.com/ggerganov/llama.cpp/actions/runs/7131777249/job/19420981052#step:5:1124
 481    macOS-latest-make:
 482      runs-on: macos-latest
 483  
 484      steps:
 485        - name: Clone
 486          id: checkout
 487          uses: actions/checkout@v4
 488  
 489        - name: Dependencies
 490          id: depends
 491          continue-on-error: true
 492          run: |
 493            brew update
 494  
 495        - name: Build
 496          id: make_build
 497          env:
 498              LLAMA_FATAL_WARNINGS: 1
 499          run: |
 500            LLAMA_NO_METAL=1 make -j $(sysctl -n hw.logicalcpu)
 501  
 502        - name: Test
 503          id: make_test
 504          run: |
 505            LLAMA_NO_METAL=1 make tests -j $(sysctl -n hw.logicalcpu)
 506            LLAMA_NO_METAL=1 make test  -j $(sysctl -n hw.logicalcpu)
 507  
 508    # TODO: build with LLAMA_METAL=OFF because test-backend-ops fail on "Apple Paravirtual device" and I don't know
 509    #       how to debug it.
 510    #       ref: https://github.com/ggerganov/llama.cpp/actions/runs/7132125951/job/19422043567?pr=4359#step:5:6584
 511    #       would be great if we fix these
 512    macOS-latest-cmake:
 513      runs-on: macos-latest
 514  
 515      steps:
 516        - name: Clone
 517          id: checkout
 518          uses: actions/checkout@v4
 519  
 520        - name: Dependencies
 521          id: depends
 522          continue-on-error: true
 523          run: |
 524            brew update
 525  
 526        - name: Build
 527          id: cmake_build
 528          run: |
 529            sysctl -a
 530            mkdir build
 531            cd build
 532            cmake -DLLAMA_FATAL_WARNINGS=ON -DLLAMA_METAL=OFF ..
 533            cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
 534  
 535        - name: Test
 536          id: cmake_test
 537          run: |
 538            cd build
 539            ctest -L main --verbose --timeout 900
 540  
 541    macOS-latest-cmake-ios:
 542      runs-on: macos-latest
 543  
 544      steps:
 545        - name: Clone
 546          id: checkout
 547          uses: actions/checkout@v1
 548  
 549        - name: Dependencies
 550          id: depends
 551          continue-on-error: true
 552          run: |
 553            brew update
 554  
 555        - name: Build
 556          id: cmake_build
 557          run: |
 558            sysctl -a
 559            mkdir build
 560            cd build
 561            cmake -G Xcode .. \
 562              -DLLAMA_METAL_EMBED_LIBRARY=ON \
 563              -DLLAMA_BUILD_EXAMPLES=OFF \
 564              -DLLAMA_BUILD_TESTS=OFF \
 565              -DLLAMA_BUILD_SERVER=OFF \
 566              -DCMAKE_SYSTEM_NAME=iOS \
 567              -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
 568            cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
 569  
 570    macOS-latest-cmake-tvos:
 571      runs-on: macos-latest
 572  
 573      steps:
 574        - name: Clone
 575          id: checkout
 576          uses: actions/checkout@v1
 577  
 578        - name: Dependencies
 579          id: depends
 580          continue-on-error: true
 581          run: |
 582            brew update
 583  
 584        - name: Build
 585          id: cmake_build
 586          run: |
 587            sysctl -a
 588            mkdir build
 589            cd build
 590            cmake -G Xcode .. \
 591              -DLLAMA_METAL_EMBED_LIBRARY=ON \
 592              -DLLAMA_BUILD_EXAMPLES=OFF \
 593              -DLLAMA_BUILD_TESTS=OFF \
 594              -DLLAMA_BUILD_SERVER=OFF \
 595              -DCMAKE_SYSTEM_NAME=tvOS \
 596              -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
 597            cmake --build . --config Release -j $(sysctl -n hw.logicalcpu)
 598  
 599    macOS-latest-swift:
 600      runs-on: macos-latest
 601  
 602      strategy:
 603        matrix:
 604          destination: ['generic/platform=macOS', 'generic/platform=iOS', 'generic/platform=tvOS']
 605  
 606      steps:
 607        - name: Clone
 608          id: checkout
 609          uses: actions/checkout@v1
 610  
 611        - name: Dependencies
 612          id: depends
 613          continue-on-error: true
 614          run: |
 615            brew update
 616  
 617        - name: xcodebuild for swift package
 618          id: xcodebuild
 619          run: |
 620            xcodebuild -scheme llama -destination "${{ matrix.destination }}"
 621  
 622        - name: Build Swift Example
 623          id: make_build_swift_example
 624          run: |
 625              make swift
 626  
 627    windows-msys2:
 628      runs-on: windows-latest
 629  
 630      strategy:
 631        fail-fast: false
 632        matrix:
 633          include:
 634            - { sys: UCRT64,  env: ucrt-x86_64,  build: Release }
 635            - { sys: CLANG64, env: clang-x86_64, build: Release }
 636  
 637      steps:
 638        - name: Clone
 639          uses: actions/checkout@v4
 640  
 641        - name: Setup ${{ matrix.sys }}
 642          uses: msys2/setup-msys2@v2
 643          with:
 644            update: true
 645            msystem: ${{matrix.sys}}
 646            install: >-
 647              base-devel
 648              mingw-w64-${{matrix.env}}-toolchain
 649              mingw-w64-${{matrix.env}}-cmake
 650              mingw-w64-${{matrix.env}}-openblas
 651  
 652        - name: Build using make
 653          shell: msys2 {0}
 654          run: |
 655              make -j $(nproc)
 656  
 657        - name: Clean after building using make
 658          shell: msys2 {0}
 659          run: |
 660              make clean
 661  
 662        - name: Build using make w/ OpenBLAS
 663          shell: msys2 {0}
 664          run: |
 665              make LLAMA_OPENBLAS=1 -j $(nproc)
 666  
 667        - name: Build using CMake
 668          shell: msys2 {0}
 669          run: |
 670              cmake -B build
 671              cmake --build build --config ${{ matrix.build }} -j $(nproc)
 672  
 673        - name: Clean after building using CMake
 674          shell: msys2 {0}
 675          run: |
 676              rm -rf build
 677  
 678        - name: Build using CMake w/ OpenBLAS
 679          shell: msys2 {0}
 680          run: |
 681              cmake -B build -DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS
 682              cmake --build build --config ${{ matrix.build }} -j $(nproc)
 683  
 684    windows-latest-cmake:
 685      runs-on: windows-2019
 686  
 687      env:
 688        OPENBLAS_VERSION: 0.3.23
 689        SDE_VERSION: 9.33.0-2024-01-07
 690        VULKAN_VERSION: 1.3.261.1
 691  
 692      strategy:
 693        matrix:
 694          include:
 695            - build: 'rpc-x64'
 696              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_RPC=ON -DBUILD_SHARED_LIBS=ON'
 697            - build: 'noavx-x64'
 698              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_FMA=OFF -DBUILD_SHARED_LIBS=ON'
 699            - build: 'avx2-x64'
 700              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
 701            - build: 'avx-x64'
 702              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX2=OFF -DBUILD_SHARED_LIBS=ON'
 703            - build: 'avx512-x64'
 704              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON'
 705            - build: 'openblas-x64'
 706              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS -DBLAS_INCLUDE_DIRS="$env:RUNNER_TEMP/openblas/include" -DBLAS_LIBRARIES="$env:RUNNER_TEMP/openblas/lib/openblas.lib"'
 707            - build: 'kompute-x64'
 708              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_KOMPUTE=ON -DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON -DBUILD_SHARED_LIBS=ON'
 709            - build: 'vulkan-x64'
 710              defines: '-DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_VULKAN=ON -DBUILD_SHARED_LIBS=ON'
 711            - build: 'llvm-arm64'
 712              defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-llvm.cmake -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
 713            - build: 'msvc-arm64'
 714              defines: '-G "Ninja Multi-Config" -D CMAKE_TOOLCHAIN_FILE=cmake/arm64-windows-msvc.cmake -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=ON'
 715  
 716      steps:
 717        - name: Clone
 718          id: checkout
 719          uses: actions/checkout@v4
 720          with:
 721            fetch-depth: 0
 722  
 723        - name: Clone Kompute submodule
 724          id: clone_kompute
 725          if: ${{ matrix.build == 'kompute-x64' }}
 726          run: |
 727            git submodule update --init kompute
 728  
 729        - name: Download OpenBLAS
 730          id: get_openblas
 731          if: ${{ matrix.build == 'openblas-x64' }}
 732          run: |
 733            curl.exe -o $env:RUNNER_TEMP/openblas.zip -L "https://github.com/xianyi/OpenBLAS/releases/download/v${env:OPENBLAS_VERSION}/OpenBLAS-${env:OPENBLAS_VERSION}-x64.zip"
 734            curl.exe -o $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt -L "https://github.com/xianyi/OpenBLAS/raw/v${env:OPENBLAS_VERSION}/LICENSE"
 735            mkdir $env:RUNNER_TEMP/openblas
 736            tar.exe -xvf $env:RUNNER_TEMP/openblas.zip -C $env:RUNNER_TEMP/openblas
 737            $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
 738            $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
 739            $lib =  $(join-path $msvc 'bin\Hostx64\x64\lib.exe')
 740            & $lib /machine:x64 "/def:${env:RUNNER_TEMP}/openblas/lib/libopenblas.def" "/out:${env:RUNNER_TEMP}/openblas/lib/openblas.lib" /name:openblas.dll
 741  
 742        - name: Install Vulkan SDK
 743          id: get_vulkan
 744          if: ${{ matrix.build == 'kompute-x64' || matrix.build == 'vulkan-x64' }}
 745          run: |
 746            curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/VulkanSDK-${env:VULKAN_VERSION}-Installer.exe"
 747            & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install
 748            Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}"
 749            Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin"
 750  
 751        - name: Install Ninja
 752          id: install_ninja
 753          run: |
 754            choco install ninja
 755  
 756        - name: Build
 757          id: cmake_build
 758          run: |
 759            cmake -S . -B build ${{ matrix.defines }}
 760            cmake --build build --config Release -j ${env:NUMBER_OF_PROCESSORS}
 761  
 762        - name: Add libopenblas.dll
 763          id: add_libopenblas_dll
 764          if: ${{ matrix.build == 'openblas-x64' }}
 765          run: |
 766            cp $env:RUNNER_TEMP/openblas/bin/libopenblas.dll ./build/bin/Release/openblas.dll
 767            cp $env:RUNNER_TEMP/OpenBLAS.LICENSE.txt ./build/bin/Release/OpenBLAS-${env:OPENBLAS_VERSION}.txt
 768  
 769        - name: Check AVX512F support
 770          id: check_avx512f
 771          if: ${{ matrix.build == 'avx512-x64' }}
 772          continue-on-error: true
 773          run: |
 774            cd build
 775            $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath)
 776            $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim()))
 777            $cl =  $(join-path $msvc 'bin\Hostx64\x64\cl.exe')
 778            echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c
 779            & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main
 780            .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO"
 781  
 782        - name: Test
 783          id: cmake_test
 784          # not all machines have native AVX-512
 785          if: ${{ matrix.build != 'msvc-arm64' && matrix.build != 'llvm-arm64' && matrix.build != 'kompute-x64' && matrix.build != 'vulkan-x64' && (matrix.build != 'avx512-x64' || env.HAS_AVX512F == '1') }}
 786          run: |
 787            cd build
 788            ctest -L main -C Release --verbose --timeout 900
 789  
 790        - name: Test (Intel SDE)
 791          id: cmake_test_sde
 792          if: ${{ matrix.build == 'avx512-x64' && env.HAS_AVX512F == '0' }} # use Intel SDE for AVX-512 emulation
 793          run: |
 794            curl.exe -o $env:RUNNER_TEMP/sde.tar.xz -L "https://downloadmirror.intel.com/813591/sde-external-${env:SDE_VERSION}-win.tar.xz"
 795            # for some weird reason windows tar doesn't like sde tar.xz
 796            7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar.xz
 797            7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/sde.tar
 798            $sde = $(join-path $env:RUNNER_TEMP sde-external-${env:SDE_VERSION}-win/sde.exe)
 799            cd build
 800            & $sde -future -- ctest -L main -C Release --verbose --timeout 900
 801  
 802        - name: Determine tag name
 803          id: tag
 804          shell: bash
 805          run: |
 806            BUILD_NUMBER="$(git rev-list --count HEAD)"
 807            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
 808            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
 809              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
 810            else
 811              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
 812              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
 813            fi
 814  
 815        - name: Pack artifacts
 816          id: pack_artifacts
 817          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 818          run: |
 819            Copy-Item LICENSE .\build\bin\Release\llama.cpp.txt
 820            7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip .\build\bin\Release\*
 821  
 822        - name: Upload artifacts
 823          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 824          uses: actions/upload-artifact@v4
 825          with:
 826            path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}.zip
 827            name: llama-bin-win-${{ matrix.build }}.zip
 828  
 829    windows-latest-cmake-cuda:
 830      runs-on: windows-2019
 831  
 832      strategy:
 833        matrix:
 834          cuda: ['12.2.0', '11.7.1']
 835          build: ['cuda']
 836  
 837      steps:
 838        - name: Clone
 839          id: checkout
 840          uses: actions/checkout@v4
 841          with:
 842            fetch-depth: 0
 843  
 844        - name: Install CUDA toolkit
 845          id: cuda-toolkit
 846          uses: Jimver/cuda-toolkit@v0.2.15
 847          with:
 848            cuda: ${{ matrix.cuda }}
 849            method: 'network'
 850            sub-packages: '["nvcc", "cudart", "cublas", "cublas_dev", "thrust", "visual_studio_integration"]'
 851  
 852        - name: Build
 853          id: cmake_build
 854          run: |
 855            mkdir build
 856            cd build
 857            cmake .. -DLLAMA_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_CUDA=ON -DBUILD_SHARED_LIBS=ON
 858            cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
 859  
 860        - name: Determine tag name
 861          id: tag
 862          shell: bash
 863          run: |
 864            BUILD_NUMBER="$(git rev-list --count HEAD)"
 865            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
 866            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
 867              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
 868            else
 869              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
 870              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
 871            fi
 872  
 873        - name: Pack artifacts
 874          id: pack_artifacts
 875          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 876          run: |
 877            7z a llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip .\build\bin\Release\*
 878  
 879        - name: Upload artifacts
 880          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 881          uses: actions/upload-artifact@v4
 882          with:
 883            path: llama-${{ steps.tag.outputs.name }}-bin-win-${{ matrix.build }}-cu${{ matrix.cuda }}-x64.zip
 884            name: llama-bin-win-cu${{ matrix.cuda }}-x64.zip
 885  
 886        - name: Copy and pack Cuda runtime
 887          run: |
 888            echo "Cuda install location: ${{steps.cuda-toolkit.outputs.CUDA_PATH}}"
 889            $dst='.\build\bin\cudart\'
 890            robocopy "${{steps.cuda-toolkit.outputs.CUDA_PATH}}\bin" $dst cudart64_*.dll cublas64_*.dll cublasLt64_*.dll
 891            7z a cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip $dst\*
 892  
 893        - name: Upload Cuda runtime
 894          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 895          uses: actions/upload-artifact@v4
 896          with:
 897            path: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
 898            name: cudart-llama-bin-win-cu${{ matrix.cuda }}-x64.zip
 899  
 900    windows-latest-cmake-sycl:
 901      runs-on: windows-latest
 902  
 903      defaults:
 904        run:
 905          shell: bash
 906  
 907      env:
 908        WINDOWS_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/7dff44ba-e3af-4448-841c-0d616c8da6e7/w_BaseKit_p_2024.1.0.595_offline.exe
 909        WINDOWS_DPCPP_MKL: intel.oneapi.win.cpp-dpcpp-common:intel.oneapi.win.mkl.devel
 910        ONEAPI_ROOT: "C:/Program Files (x86)/Intel/oneAPI"
 911      steps:
 912        - name: Clone
 913          id: checkout
 914          uses: actions/checkout@v4
 915          with:
 916            fetch-depth: 0
 917  
 918        - name: Install
 919          run:  scripts/install-oneapi.bat $WINDOWS_BASEKIT_URL $WINDOWS_DPCPP_MKL
 920  
 921        - name: Build
 922          id: cmake_build
 923          run:  examples/sycl/win-build-sycl.bat
 924  
 925        - name: Determine tag name
 926          id: tag
 927          shell: bash
 928          run: |
 929            BUILD_NUMBER="$(git rev-list --count HEAD)"
 930            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
 931            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
 932              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
 933            else
 934              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
 935              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
 936            fi
 937  
 938        - name: Pack artifacts
 939          id: pack_artifacts
 940          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 941          run: |
 942            echo "cp oneAPI running time dll files in ${{ env.ONEAPI_ROOT }} to ./build/bin"
 943            cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_sycl_blas.4.dll" ./build/bin
 944            cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_core.2.dll" ./build/bin
 945            cp "${{ env.ONEAPI_ROOT }}/mkl/latest/bin/mkl_tbb_thread.2.dll" ./build/bin
 946  
 947            cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_win_proxy_loader.dll" ./build/bin
 948            cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/pi_level_zero.dll" ./build/bin
 949            cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/sycl7.dll" ./build/bin
 950            cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/svml_dispmd.dll" ./build/bin
 951            cp "${{ env.ONEAPI_ROOT }}/compiler/latest/bin/libmmd.dll" ./build/bin
 952            echo "cp oneAPI running time dll files to ./build/bin done"
 953            7z a llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip ./build/bin/*
 954  
 955        - name: Upload artifacts
 956          if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
 957          uses: actions/upload-artifact@v4
 958          with:
 959            path: llama-${{ steps.tag.outputs.name }}-bin-win-sycl-x64.zip
 960            name: llama-bin-win-sycl-x64.zip
 961  
 962    windows-latest-cmake-hip:
 963      runs-on: windows-latest
 964  
 965      steps:
 966        - name: Clone
 967          id: checkout
 968          uses: actions/checkout@v3
 969  
 970        - name: Install
 971          id: depends
 972          run: |
 973            $ErrorActionPreference = "Stop"
 974            write-host "Downloading AMD HIP SDK Installer"
 975            Invoke-WebRequest -Uri "https://download.amd.com/developer/eula/rocm-hub/AMD-Software-PRO-Edition-23.Q4-WinSvr2022-For-HIP.exe" -OutFile "${env:RUNNER_TEMP}\rocm-install.exe"
 976            write-host "Installing AMD HIP SDK"
 977            Start-Process "${env:RUNNER_TEMP}\rocm-install.exe" -ArgumentList '-install' -NoNewWindow -Wait
 978            write-host "Completed AMD HIP SDK installation"
 979  
 980        - name: Verify ROCm
 981          id: verify
 982          run: |
 983            & 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' --version
 984  
 985        - name: Build
 986          id: cmake_build
 987          run: |
 988            $env:HIP_PATH=$(Resolve-Path 'C:\Program Files\AMD\ROCm\*\bin\clang.exe' | split-path | split-path)
 989            $env:CMAKE_PREFIX_PATH="${env:HIP_PATH}"
 990            cmake -G "Unix Makefiles" -B build -S . -DCMAKE_C_COMPILER="${env:HIP_PATH}\bin\clang.exe" -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\bin\clang++.exe" -DLLAMA_HIPBLAS=ON
 991            cmake --build build --config Release
 992  
 993    ios-xcode-build:
 994      runs-on: macos-latest
 995  
 996      steps:
 997        - name: Checkout code
 998          uses: actions/checkout@v4
 999  
1000        - name: Build Xcode project
1001          run: xcodebuild -project examples/llama.swiftui/llama.swiftui.xcodeproj -scheme llama.swiftui -sdk iphoneos CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= -destination 'generic/platform=iOS' build
1002  
1003    android-build:
1004      runs-on: ubuntu-latest
1005  
1006      steps:
1007        - name: Clone
1008          uses: actions/checkout@v4
1009  
1010        - name: Set up JDK
1011          uses: actions/setup-java@v3
1012          with:
1013            java-version: 17
1014            distribution: zulu
1015  
1016        - name: Setup Android SDK
1017          uses: android-actions/setup-android@v3
1018          with:
1019            log-accepted-android-sdk-licenses: false
1020  
1021        - name: Build
1022          run: |
1023            cd examples/llama.android
1024  
1025            ./gradlew build --no-daemon
1026  
1027  #  freeBSD-latest:
1028  #    runs-on: macos-12
1029  #    steps:
1030  #    - name: Clone
1031  #      uses: actions/checkout@v4
1032  #
1033  #    - name: Build
1034  #      uses: cross-platform-actions/action@v0.19.0
1035  #      with:
1036  #        operating_system: freebsd
1037  #        version: '13.2'
1038  #        hypervisor: 'qemu'
1039  #        run: |
1040  #            sudo pkg update
1041  #            sudo pkg install -y gmake automake autoconf pkgconf llvm15 openblas
1042  #            gmake CC=/usr/local/bin/clang15 CXX=/usr/local/bin/clang++15 -j `sysctl -n hw.ncpu`
1043  
1044    release:
1045      if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
1046  
1047      runs-on: ubuntu-latest
1048  
1049      needs:
1050        - ubuntu-focal-make
1051        - ubuntu-latest-cmake
1052        - macOS-latest-make
1053        - macOS-latest-cmake
1054        - windows-latest-cmake
1055        - windows-latest-cmake-cuda
1056        - macOS-latest-cmake-arm64
1057        - macOS-latest-cmake-x64
1058  
1059      steps:
1060        - name: Clone
1061          id: checkout
1062          uses: actions/checkout@v4
1063          with:
1064            fetch-depth: 0
1065  
1066        - name: Determine tag name
1067          id: tag
1068          shell: bash
1069          run: |
1070            BUILD_NUMBER="$(git rev-list --count HEAD)"
1071            SHORT_HASH="$(git rev-parse --short=7 HEAD)"
1072            if [[ "${{ env.BRANCH_NAME }}" == "master" ]]; then
1073              echo "name=b${BUILD_NUMBER}" >> $GITHUB_OUTPUT
1074            else
1075              SAFE_NAME=$(echo "${{ env.BRANCH_NAME }}" | tr '/' '-')
1076              echo "name=${SAFE_NAME}-b${BUILD_NUMBER}-${SHORT_HASH}" >> $GITHUB_OUTPUT
1077            fi
1078  
1079        - name: Download artifacts
1080          id: download-artifact
1081          uses: actions/download-artifact@v4
1082          with:
1083            path: ./artifact
1084  
1085        - name: Move artifacts
1086          id: move_artifacts
1087          run: mkdir -p ./artifact/release && mv ./artifact/*/*.zip ./artifact/release
1088  
1089        - name: Create release
1090          id: create_release
1091          uses: anzz1/action-create-release@v1
1092          env:
1093            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1094          with:
1095            tag_name: ${{ steps.tag.outputs.name }}
1096  
1097        - name: Upload release
1098          id: upload_release
1099          uses: actions/github-script@v3
1100          with:
1101            github-token: ${{secrets.GITHUB_TOKEN}}
1102            script: |
1103              const path = require('path');
1104              const fs = require('fs');
1105              const release_id = '${{ steps.create_release.outputs.id }}';
1106              for (let file of await fs.readdirSync('./artifact/release')) {
1107                if (path.extname(file) === '.zip') {
1108                  console.log('uploadReleaseAsset', file);
1109                  await github.repos.uploadReleaseAsset({
1110                    owner: context.repo.owner,
1111                    repo: context.repo.repo,
1112                    release_id: release_id,
1113                    name: file,
1114                    data: await fs.readFileSync(`./artifact/release/${file}`)
1115                  });
1116                }
1117              }
1118  
1119  #  ubuntu-latest-gcc:
1120  #    runs-on: ubuntu-latest
1121  #
1122  #    strategy:
1123  #      matrix:
1124  #        build: [Debug, Release]
1125  #
1126  #    steps:
1127  #      - name: Clone
1128  #        uses: actions/checkout@v4
1129  #
1130  #      - name: Dependencies
1131  #        run: |
1132  #          sudo apt-get update
1133  #          sudo apt-get install build-essential
1134  #          sudo apt-get install cmake
1135  #
1136  #      - name: Configure
1137  #        run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
1138  #
1139  #      - name: Build
1140  #        run: |
1141  #          make
1142  #
1143  #  ubuntu-latest-clang:
1144  #    runs-on: ubuntu-latest
1145  #
1146  #    strategy:
1147  #      matrix:
1148  #        build: [Debug, Release]
1149  #
1150  #    steps:
1151  #      - name: Clone
1152  #        uses: actions/checkout@v4
1153  #
1154  #      - name: Dependencies
1155  #        run: |
1156  #          sudo apt-get update
1157  #          sudo apt-get install build-essential
1158  #          sudo apt-get install cmake
1159  #
1160  #      - name: Configure
1161  #        run: cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }} -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
1162  #
1163  #      - name: Build
1164  #        run: |
1165  #          make
1166  #
1167  #  ubuntu-latest-gcc-sanitized:
1168  #    runs-on: ubuntu-latest
1169  #
1170  #    strategy:
1171  #      matrix:
1172  #        sanitizer: [ADDRESS, THREAD, UNDEFINED]
1173  #
1174  #    steps:
1175  #      - name: Clone
1176  #        uses: actions/checkout@v4
1177  #
1178  #      - name: Dependencies
1179  #        run: |
1180  #          sudo apt-get update
1181  #          sudo apt-get install build-essential
1182  #          sudo apt-get install cmake
1183  #
1184  #      - name: Configure
1185  #        run: cmake . -DCMAKE_BUILD_TYPE=Debug -DLLAMA_SANITIZE_${{ matrix.sanitizer }}=ON
1186  #
1187  #      - name: Build
1188  #        run: |
1189  #          make
1190  #
1191  #  windows:
1192  #    runs-on: windows-latest
1193  #
1194  #    strategy:
1195  #      matrix:
1196  #        build: [Release]
1197  #        arch: [Win32, x64]
1198  #        include:
1199  #          - arch: Win32
1200  #            s2arc: x86
1201  #          - arch: x64
1202  #            s2arc: x64
1203  #
1204  #    steps:
1205  #      - name: Clone
1206  #        uses: actions/checkout@v4
1207  #
1208  #      - name: Add msbuild to PATH
1209  #        uses: microsoft/setup-msbuild@v1
1210  #
1211  #      - name: Configure
1212  #        run: >
1213  #          cmake -S . -B ./build -A ${{ matrix.arch }}
1214  #          -DCMAKE_BUILD_TYPE=${{ matrix.build }}
1215  #
1216  #      - name: Build
1217  #        run: |
1218  #          cd ./build
1219  #          msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
1220  #
1221  #      - name: Upload binaries
1222  #        uses: actions/upload-artifact@v4
1223  #        with:
1224  #          name: llama-bin-${{ matrix.arch }}
1225  #          path: build/bin/${{ matrix.build }}
1226  #
1227  #  windows-blas:
1228  #    runs-on: windows-latest
1229  #
1230  #    strategy:
1231  #      matrix:
1232  #        build: [Release]
1233  #        arch: [Win32, x64]
1234  #        blas: [ON]
1235  #        include:
1236  #          - arch: Win32
1237  #            obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x86.zip
1238  #            s2arc: x86
1239  #          - arch: x64
1240  #            obzip: https://github.com/xianyi/OpenBLAS/releases/download/v0.3.21/OpenBLAS-0.3.21-x64.zip
1241  #            s2arc: x64
1242  #
1243  #    steps:
1244  #      - name: Clone
1245  #        uses: actions/checkout@v4
1246  #
1247  #      - name: Add msbuild to PATH
1248  #        uses: microsoft/setup-msbuild@v1
1249  #
1250  #      - name: Fetch OpenBLAS
1251  #        if: matrix.blas == 'ON'
1252  #        run: |
1253  #          C:/msys64/usr/bin/wget.exe -qO blas.zip ${{ matrix.obzip }}
1254  #          7z x blas.zip -oblas -y
1255  #          copy blas/include/cblas.h .
1256  #          copy blas/include/openblas_config.h .
1257  #          echo "blasdir=$env:GITHUB_WORKSPACE/blas" >> $env:GITHUB_ENV
1258  #
1259  #      - name: Configure
1260  #        run: >
1261  #          cmake -S . -B ./build -A ${{ matrix.arch }}
1262  #          -DCMAKE_BUILD_TYPE=${{ matrix.build }}
1263  #          -DLLAMA_SUPPORT_OPENBLAS=${{ matrix.blas }}
1264  #          -DCMAKE_LIBRARY_PATH="$env:blasdir/lib"
1265  #
1266  #      - name: Build
1267  #        run: |
1268  #          cd ./build
1269  #          msbuild ALL_BUILD.vcxproj -t:build -p:configuration=${{ matrix.build }} -p:platform=${{ matrix.arch }}
1270  #
1271  #      - name: Copy libopenblas.dll
1272  #        if: matrix.blas == 'ON'
1273  #        run: copy "$env:blasdir/bin/libopenblas.dll" build/bin/${{ matrix.build }}
1274  #
1275  #      - name: Upload binaries
1276  #        if: matrix.blas == 'ON'
1277  #        uses: actions/upload-artifact@v4
1278  #        with:
1279  #          name: llama-blas-bin-${{ matrix.arch }}
1280  #          path: build/bin/${{ matrix.build }}
1281  #
1282  #  emscripten:
1283  #    runs-on: ubuntu-latest
1284  #
1285  #    strategy:
1286  #      matrix:
1287  #        build: [Release]
1288  #
1289  #    steps:
1290  #      - name: Clone
1291  #        uses: actions/checkout@v4
1292  #
1293  #      - name: Dependencies
1294  #        run: |
1295  #          wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz
1296  #          tar -xvf master.tar.gz
1297  #          emsdk-master/emsdk update
1298  #          emsdk-master/emsdk install latest
1299  #          emsdk-master/emsdk activate latest
1300  #
1301  #      - name: Configure
1302  #        run: echo "tmp"
1303  #
1304  #      - name: Build
1305  #        run: |
1306  #          pushd emsdk-master
1307  #          source ./emsdk_env.sh
1308  #          popd
1309  #          emcmake cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build }}
1310  #          make