Skip to content

Commit

Permalink
add openblas
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Sep 26, 2023
1 parent ef6692f commit 01412a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/scripts/.Aptfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ package 'git'
package 'jq'
package 'ninja-build', bin: 'ninja'
package 'pkg-config'
package 'libopenblas-dev'
12 changes: 6 additions & 6 deletions cmake/BuildWhispercpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ endif()
# On linux add the `-fPIC` flag to the compiler
if(UNIX AND NOT APPLE)
set(WHISPER_EXTRA_CXX_FLAGS "-fPIC")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF -DWHISPER_BLAS_VENDOR=OpenBLAS)
endif()

# if on Windows - download OpenBLAS prebuilt binaries
if(WIN32)
if(LOCALVOCAL_WITH_CUDA)
# Build with CUDA Check that CUDA_TOOLKIT_ROOT_DIR is set
Expand All @@ -24,7 +24,7 @@ if(WIN32)

set(WHISPER_ADDITIONAL_ENV "CUDAToolkit_ROOT=${CUDA_TOOLKIT_ROOT_DIR}")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_CUBLAS=ON -DCMAKE_GENERATOR_TOOLSET=cuda=${CUDA_TOOLKIT_ROOT_DIR})
else(LOCALVOCAL_WITH_CUDA)
else()
# Build with OpenBLAS
set(OpenBLAS_URL "https://github.com/xianyi/OpenBLAS/releases/download/v0.3.24/OpenBLAS-0.3.24-x64.zip")
set(OpenBLAS_SHA256 "6335128ee7117ea2dd2f5f96f76dafc17256c85992637189a2d5f6da0c608163")
Expand All @@ -39,8 +39,8 @@ if(WIN32)
ExternalProject_Get_Property(OpenBLAS INSTALL_DIR)
set(OpenBLAS_DIR ${INSTALL_DIR})
set(WHISPER_ADDITIONAL_ENV "OPENBLAS_PATH=${OpenBLAS_DIR}")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF)
endif(LOCALVOCAL_WITH_CUDA)
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF)
endif()

ExternalProject_Add(
Whispercpp_Build
Expand Down Expand Up @@ -78,12 +78,12 @@ else()
CMAKE_GENERATOR ${CMAKE_GENERATOR}
INSTALL_COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR> --config ${Whispercpp_BUILD_TYPE}
CONFIGURE_COMMAND
${CMAKE_COMMAND} -E env OPENBLAS_PATH=${OpenBLAS_DIR} ${CMAKE_COMMAND} <SOURCE_DIR> -B <BINARY_DIR> -G
${CMAKE_COMMAND} -E env ${WHISPER_ADDITIONAL_ENV} ${CMAKE_COMMAND} <SOURCE_DIR> -B <BINARY_DIR> -G
${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> -DCMAKE_BUILD_TYPE=${Whispercpp_BUILD_TYPE}
-DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES_} -DCMAKE_CXX_FLAGS=${WHISPER_EXTRA_CXX_FLAGS}
-DCMAKE_C_FLAGS=${WHISPER_EXTRA_CXX_FLAGS} -DBUILD_SHARED_LIBS=OFF -DWHISPER_BUILD_TESTS=OFF
-DWHISPER_BUILD_EXAMPLES=OFF -DWHISPER_BLAS=OFF)
-DWHISPER_BUILD_EXAMPLES=OFF ${WHISPER_ADDITIONAL_CMAKE_ARGS})
endif(WIN32)

ExternalProject_Get_Property(Whispercpp_Build INSTALL_DIR)
Expand Down

0 comments on commit 01412a1

Please sign in to comment.