diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index d9a742e6..8c8c2910 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -86,6 +86,67 @@ jobs: path: .\build\bin\Release\llama.dll name: llama-bin-win-${{ matrix.build }}-x64.dll + compile-clblast: + name: Compile (clblast) - ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ +# ubuntu-20.04, # This is not built in llalam.cpp, so for now we'll skip it + windows-latest + ] + env: + OPENBLAS_VERSION: 0.3.23 + OPENCL_VERSION: 2023.04.17 + CLBLAST_VERSION: 1.6.0 + VULKAN_VERSION: 1.3.261.1 + runs-on: ${{ matrix.os }} + steps: + - name: Clone + id: checkout + uses: actions/checkout@v3 + with: + repository: ggerganov/llama.cpp + - name: Download dependencies - Windows + id: get_opencl + if: ${{ matrix.os == 'windows-latest' }} + run: | + curl.exe -o $env:RUNNER_TEMP/opencl.zip -L "https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v${env:OPENCL_VERSION}/OpenCL-SDK-v${env:OPENCL_VERSION}-Win-x64.zip" + mkdir $env:RUNNER_TEMP/opencl + tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl + curl.exe -o $env:RUNNER_TEMP/clblast.7z -L "https://github.com/CNugteren/CLBlast/releases/download/${env:CLBLAST_VERSION}/CLBlast-${env:CLBLAST_VERSION}-windows-x64.7z" + curl.exe -o $env:RUNNER_TEMP/CLBlast.LICENSE.txt -L "https://github.com/CNugteren/CLBlast/raw/${env:CLBLAST_VERSION}/LICENSE" + 7z x "-o${env:RUNNER_TEMP}" $env:RUNNER_TEMP/clblast.7z + rename-item $env:RUNNER_TEMP/CLBlast-${env:CLBLAST_VERSION}-windows-x64 clblast + foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) { + $txt = Get-Content -Path $f -Raw + $txt.Replace('C:/vcpkg/packages/opencl_x64-windows/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8 + } +# - name: Download dependencies - Linux +# if: ${{ matrix.os == "ubuntu-20.04" }} +# run: | +# wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add - +# sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list http://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list +# sudo add-apt-repository ppa:cnugteren/clblast +# sudo apt update +# sudo apt install vulkan-sdk libclblast-dev + + - name: Build + id: cmake_build + run: | + mkdir build + cd build + cmake .. ${{ env.COMMON_DEFINE }} -DLLAMA_CLBLAST=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast" + cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS} + ls -R + + - name: Upload artifacts (Windows) + if: ${{ matrix.os == 'windows-latest' }} + uses: actions/upload-artifact@v3 + with: + path: .\build\bin\Release\llama.dll + name: llama-bin-win-clblast-x64.dll + compile-cublas: name: Compile (cublas) strategy: @@ -189,7 +250,8 @@ jobs: "compile-linux", "compile-macos", "compile-windows", - "compile-cublas" + "compile-cublas", + "compile-clblast" ] steps: - uses: actions/download-artifact@v3 @@ -199,17 +261,8 @@ jobs: run: | ls -R - mkdir deps - - mkdir deps/avx - mkdir deps/avx2 - mkdir deps/avx512 - - mkdir deps/osx-arm64 - mkdir deps/osx-x64 - - mkdir deps/cu11.7.1 - mkdir deps/cu12.1.0 + # Make all directories at once + mkdir --parents deps/{avx,avx2,avx512,osx-arm64,osx-x64,cu11.7.1,cu12.1.0,clblast} cp artifacts/llama-bin-linux-noavx-x64.so/libllama.so deps/libllama.so cp artifacts/llama-bin-linux-avx-x64.so/libllama.so deps/avx/libllama.so @@ -229,6 +282,8 @@ jobs: cp artifacts/llama-bin-linux-cublas-cu11.7.1-x64.so/libllama.so deps/cu11.7.1/libllama.so cp artifacts/llama-bin-win-cublas-cu12.1.0-x64.dll/llama.dll deps/cu12.1.0/llama.dll cp artifacts/llama-bin-linux-cublas-cu12.1.0-x64.so/libllama.so deps/cu12.1.0/libllama.so + + cp artifacts/llama-bin-win-clblast-x64.dll/llama.dll deps/clblast/llama.dll - name: Upload artifacts uses: actions/upload-artifact@v3