Skip to content

Commit

Permalink
Merge pull request #487 from jasoncouture/clblast_linux
Browse files Browse the repository at this point in the history
CLBlast for linux
  • Loading branch information
martindevans authored Feb 5, 2024
2 parents d4f3f64 + f7a6eaa commit d468df0
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
branches: [cron_job]
#schedule:
# - cron: "22 22 * * 2"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.llama_cpp_commit }}
cancel-in-progress: true

env:
# Compiler defines common to all platforms
Expand Down Expand Up @@ -92,7 +95,7 @@ jobs:
fail-fast: false
matrix:
os: [
# ubuntu-20.04, # This is not built in llalam.cpp, so for now we'll skip it
ubuntu-22.04,
windows-latest
]
env:
Expand All @@ -107,6 +110,12 @@ jobs:
uses: actions/checkout@v4
with:
repository: ggerganov/llama.cpp
- 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' }}
Expand All @@ -122,30 +131,42 @@ jobs:
$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
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
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}
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
path: |
.\build\bin\Release\llama.dll
.\build\bin\Release\clblast.dll
name: llama-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

compile-cublas:
name: Compile (cublas)
Expand Down Expand Up @@ -283,7 +304,8 @@ jobs:
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
cp artifacts/llama-bin-win-clblast-x64.dll/{llama,clblast}.dll deps/clblast/
cp artifacts/llama-bin-linux-clblast-x64.so/lib{llama,clblast}.so deps/clblast/
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit d468df0

Please sign in to comment.