Skip to content

Commit

Permalink
Merge pull request SciSharp#782 from martindevans/remove_opencl
Browse files Browse the repository at this point in the history
Remove OpenCL Backend.
  • Loading branch information
martindevans authored Jun 5, 2024
2 parents 6444daf + 0e08ac8 commit f1ec4ae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 138 deletions.
110 changes: 2 additions & 108 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,106 +99,6 @@ jobs:
with:
path: .\build\bin\Release\llava_shared.dll
name: llava-bin-win-${{ matrix.build }}-x64.dll

compile-clblast:
name: Compile (clblast) - ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-22.04,
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@v4
with:
repository: ggerganov/llama.cpp
ref: '${{ github.event.inputs.llama_cpp_commit }}'
- name: Download dependencies - Linux
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
sudo apt update
sudo apt install libopencl-clang-dev libclblast-dev
- 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: Build
id: cmake_build
if: ${{ matrix.os == 'windows-latest' }}
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}
copy $env:RUNNER_TEMP/clblast/lib/clblast.dll .\bin\Release\clblast.dll
# # We should probably generate a sha256 sum in a file, and use that.
# echo "78a8c98bcb2efe1a63318d901ab204d9ba96c3b29707b4ce0c4240bdcdc698d6 ./bin/Release/clblast.dll" >> tmp
# sha256sum -c tmp || exit 255
# rm tmp
ls -R
- name: Build
if: ${{ matrix.os == 'ubuntu-22.04' }}
run: |
mkdir build
cd build
cmake .. ${{ env.COMMON_DEFINE }} -DLLAMA_CLBLAST=ON
cmake --build . --config Release -j ${env:NUMBER_OF_PROCESSORS}
# if we ever want to pull libclblast.so back into the packages, just uncomment this line, and the one below for the upload
# cp $(ldconfig -p | grep libclblast.so | tail -n 1 | cut -d ' ' -f 4) ./
ls -R
- name: Upload artifacts (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v4
with:
path: |
.\build\bin\Release\llama.dll
.\build\bin\Release\clblast.dll
name: llama-bin-win-clblast-x64.dll
- name: Upload llava artifacts (Windows)
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v4
with:
path: |
.\build\bin\Release\llava_shared.dll
name: llava-bin-win-clblast-x64.dll
- name: Upload artifacts (linux)
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: actions/upload-artifact@v4
with:
path: |
./build/libllama.so
# ./build/libclblast.so
name: llama-bin-linux-clblast-x64.so
- name: Upload llava artifacts (linux)
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: actions/upload-artifact@v4
with:
path: |
./build/examples/llava/libllava_shared.so
name: llava-bin-linux-clblast-x64.so


compile-cublas:
name: Compile (cublas)
Expand Down Expand Up @@ -323,8 +223,7 @@ jobs:
"compile-linux",
"compile-macos",
"compile-windows",
"compile-cublas",
"compile-clblast"
"compile-cublas"
]
steps:
- uses: actions/download-artifact@v4
Expand All @@ -335,7 +234,7 @@ jobs:
- name: Rearrange Files
run: |
# Make all directories at once
mkdir --parents deps/{avx,avx2,avx512,osx-arm64,osx-x64,osx-x64-rosetta2,cu11.7.1,cu12.1.0,clblast}
mkdir --parents deps/{avx,avx2,avx512,osx-arm64,osx-x64,osx-x64-rosetta2,cu11.7.1,cu12.1.0}
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
Expand Down Expand Up @@ -379,11 +278,6 @@ jobs:
cp artifacts/llama-bin-linux-cublas-cu12.1.0-x64.so/libllama.so deps/cu12.1.0/libllama.so
cp artifacts/llava-bin-linux-cublas-cu12.1.0-x64.so/libllava_shared.so deps/cu12.1.0/libllava_shared.so
cp artifacts/llama-bin-win-clblast-x64.dll/{llama,clblast}.dll deps/clblast/
cp artifacts/llava-bin-win-clblast-x64.dll/llava_shared.dll deps/clblast/llava_shared.dll
cp artifacts/llama-bin-linux-clblast-x64.so/libllama.so deps/clblast/
cp artifacts/llava-bin-linux-clblast-x64.so/libllava_shared.so deps/clblast/libllava_shared.so
- name: Upload artifacts
Expand Down
30 changes: 0 additions & 30 deletions LLama/runtimes/build/LLamaSharp.Backend.OpenCL.nuspec

This file was deleted.

0 comments on commit f1ec4ae

Please sign in to comment.