From a48eebe621957e0d36bd4eed0006033247e5f654 Mon Sep 17 00:00:00 2001 From: Henri Vasserman Date: Tue, 2 May 2023 00:19:10 +0300 Subject: [PATCH] Add OpenCL and CLBlast support --- .github/workflows/build.yml | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 179080576..01e0b2223 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,12 +158,34 @@ jobs: defines: '-DLLAMA_AVX2=OFF' - build: 'avx512' defines: '-DLLAMA_AVX512=ON -DBUILD_SHARED_LIBS=ON' + - build: 'opencl' + defines: '-DLLAMA_CLBLAST=ON -DCMAKE_PREFIX_PATH="$env:RUNNER_TEMP/clblast"' steps: - name: Clone id: checkout uses: actions/checkout@v1 + - name: Download OpenCL SDK + id: get_opencl + if: ${{ matrix.build == 'opencl' }} + run: | + curl.exe -o $env:RUNNER_TEMP/opencl.zip -L https://github.com/KhronosGroup/OpenCL-SDK/releases/download/v2023.04.17/OpenCL-SDK-v2023.04.17-Win-x64.zip + mkdir $env:RUNNER_TEMP/opencl + tar.exe -xvf $env:RUNNER_TEMP/opencl.zip --strip-components=1 -C $env:RUNNER_TEMP/opencl + + - name: Download CLBlast + id: get_clblast + if: ${{ matrix.build == 'opencl' }} + run: | + curl.exe -o $env:RUNNER_TEMP/clblast.zip -L https://github.com/CNugteren/CLBlast/releases/download/1.5.3/CLBlast-1.5.3-Windows-x64.zip + mkdir $env:RUNNER_TEMP/clblast + tar.exe -xvf $env:RUNNER_TEMP/clblast.zip -C $env:RUNNER_TEMP/clblast + foreach ($f in (gci -Recurse -Path "$env:RUNNER_TEMP/clblast" -Filter '*.cmake')) { + $txt = Get-Content -Path $f -Raw + $txt.Replace('C:/dependencies/opencl/', "$($env:RUNNER_TEMP.Replace('\','/'))/opencl/") | Set-Content -Path $f -Encoding UTF8 + } + - name: Build id: cmake_build run: | @@ -172,6 +194,12 @@ jobs: cmake .. ${{ matrix.defines }} cmake --build . --config Release + - name: Add clblast.dll + id: add_clblast_dll + if: ${{ matrix.build == 'opencl' }} + run: | + cp $env:RUNNER_TEMP/clblast/lib/clblast.dll ./build/bin/Release + - name: Check AVX512F support id: check_avx512f if: ${{ matrix.build == 'avx512' }} @@ -187,7 +215,7 @@ jobs: - name: Test id: cmake_test - if: ${{ matrix.build != 'avx512' || env.HAS_AVX512F == '1' }} # Test AVX-512 only when possible + if: ${{ ( matrix.build != 'avx512' || env.HAS_AVX512F == '1' ) && matrix.build != 'opencl' }} # Test AVX-512 only when possible run: | cd build ctest -C Release --verbose