Skip to content

Commit f8805ff

Browse files
committed
Build with CLBlast
1 parent db8ccdb commit f8805ff

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,12 @@ jobs:
223223
- arch: Win32
224224
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x86.zip
225225
s2arc: x86
226+
clblast: OFF
226227
- arch: x64
227228
obzip: https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.25/OpenBLAS-0.3.25-x64.zip
228229
s2arc: x64
230+
clblast: ON
231+
clver: 1.6.1
229232
- sdl2: ON
230233
s2ver: 2.28.5
231234

@@ -252,13 +255,26 @@ jobs:
252255
7z x sdl2.zip
253256
echo "SDL2_DIR=$env:GITHUB_WORKSPACE/SDL2-${{ matrix.s2ver }}/cmake" >> $env:GITHUB_ENV
254257
258+
- name: Install OpenCL
259+
if: matrix.clblast == 'ON'
260+
run: vcpkg.exe --triplet=${{ matrix.arch }}-windows install opencl
261+
262+
- name: Fetch CLBlast and set CLBlast_DIR
263+
if: matrix.clblast == 'ON'
264+
run: |
265+
C:/msys64/usr/bin/wget.exe -qO clblast.zip https://github.com/CNugteren/CLBlast/releases/download/${{ matrix.clver }}/CLBlast-${{ matrix.clver }}-windows-x64.zip
266+
7z x clblast.zip
267+
7z x CLBlast-${{ matrix.clver }}-windows-x64.7z
268+
echo "CLBlast_DIR=$env:GITHUB_WORKSPACE/CLBlast-${{ matrix.clver }}-windows-x64/lib/cmake/CLBlast" >> $env:GITHUB_ENV
269+
255270
- name: Configure
256271
run: >
257272
cmake -S . -B ./build -A ${{ matrix.arch }}
258273
-DCMAKE_BUILD_TYPE=${{ matrix.build }}
259274
-DWHISPER_OPENBLAS=${{ matrix.blas }}
260275
-DCMAKE_LIBRARY_PATH="$env:OPENBLAS_PATH/lib"
261276
-DWHISPER_SDL2=${{ matrix.sdl2 }}
277+
-DWHISPER_CLBLAST=${{ matrix.clblast }}
262278
263279
- name: Build
264280
run: |
@@ -273,11 +289,15 @@ jobs:
273289
if: matrix.sdl2 == 'ON'
274290
run: copy "$env:SDL2_DIR/../lib/${{ matrix.s2arc }}/SDL2.dll" build/bin/${{ matrix.build }}
275291

292+
- name: Copy clblast.dll
293+
if: matrix.clblast == 'ON'
294+
run: copy "$env:CLBlast_DIR/../../clblast.dll" build/bin/${{ matrix.build }}
295+
276296
- name: Upload binaries
277297
if: matrix.blas == 'ON' && matrix.sdl2 == 'ON'
278298
uses: actions/upload-artifact@v1
279299
with:
280-
name: whisper-blas-bin-${{ matrix.arch }}
300+
name: whisper-blas${{ matrix.clblast == 'ON' && '-clblast' || ''}}-bin-${{ matrix.arch }}
281301
path: build/bin/${{ matrix.build }}
282302

283303
windows-cublas:

examples/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ if (WHISPER_SDL2)
1414
message(STATUS "SDL2_LIBRARIES = ${SDL2_LIBRARIES}")
1515
endif()
1616

17+
if (WHISPER_CLBLAST)
18+
find_package(CLBlast REQUIRED)
19+
endif()
20+
1721
# common
1822

1923
set(TARGET common)

examples/talk-llama/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ if (WHISPER_SDL2)
33
set(TARGET talk-llama)
44
add_executable(${TARGET} talk-llama.cpp llama.cpp)
55
target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIRS})
6-
target_link_libraries(${TARGET} PRIVATE common common-sdl whisper ${SDL2_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
6+
7+
if (WHISPER_CLBLAST)
8+
set(CLBLAST_LIBNAME clblast)
9+
endif ()
10+
target_link_libraries(${TARGET} PRIVATE common common-sdl whisper ${SDL2_LIBRARIES} ${CLBLAST_LIBNAME} ${CMAKE_THREAD_LIBS_INIT})
711

812
if(WIN32)
913
# It requires Windows 8.1 or later for PrefetchVirtualMemory

0 commit comments

Comments
 (0)