add openblas

This commit is contained in:
Roy Shilkrot 2023-09-25 23:55:32 -04:00
parent ef6692f441
commit 01412a1094
2 changed files with 7 additions and 6 deletions

View File

@ -4,3 +4,4 @@ package 'git'
package 'jq' package 'jq'
package 'ninja-build', bin: 'ninja' package 'ninja-build', bin: 'ninja'
package 'pkg-config' package 'pkg-config'
package 'libopenblas-dev'

View File

@ -11,9 +11,9 @@ endif()
# On linux add the `-fPIC` flag to the compiler # On linux add the `-fPIC` flag to the compiler
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
set(WHISPER_EXTRA_CXX_FLAGS "-fPIC") set(WHISPER_EXTRA_CXX_FLAGS "-fPIC")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF -DWHISPER_BLAS_VENDOR=OpenBLAS)
endif() endif()
# if on Windows - download OpenBLAS prebuilt binaries
if(WIN32) if(WIN32)
if(LOCALVOCAL_WITH_CUDA) if(LOCALVOCAL_WITH_CUDA)
# Build with CUDA Check that CUDA_TOOLKIT_ROOT_DIR is set # Build with CUDA Check that CUDA_TOOLKIT_ROOT_DIR is set
@ -24,7 +24,7 @@ if(WIN32)
set(WHISPER_ADDITIONAL_ENV "CUDAToolkit_ROOT=${CUDA_TOOLKIT_ROOT_DIR}") 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}) set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_CUBLAS=ON -DCMAKE_GENERATOR_TOOLSET=cuda=${CUDA_TOOLKIT_ROOT_DIR})
else(LOCALVOCAL_WITH_CUDA) else()
# Build with OpenBLAS # Build with OpenBLAS
set(OpenBLAS_URL "https://github.com/xianyi/OpenBLAS/releases/download/v0.3.24/OpenBLAS-0.3.24-x64.zip") set(OpenBLAS_URL "https://github.com/xianyi/OpenBLAS/releases/download/v0.3.24/OpenBLAS-0.3.24-x64.zip")
set(OpenBLAS_SHA256 "6335128ee7117ea2dd2f5f96f76dafc17256c85992637189a2d5f6da0c608163") set(OpenBLAS_SHA256 "6335128ee7117ea2dd2f5f96f76dafc17256c85992637189a2d5f6da0c608163")
@ -40,7 +40,7 @@ if(WIN32)
set(OpenBLAS_DIR ${INSTALL_DIR}) set(OpenBLAS_DIR ${INSTALL_DIR})
set(WHISPER_ADDITIONAL_ENV "OPENBLAS_PATH=${OpenBLAS_DIR}") set(WHISPER_ADDITIONAL_ENV "OPENBLAS_PATH=${OpenBLAS_DIR}")
set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF) set(WHISPER_ADDITIONAL_CMAKE_ARGS -DWHISPER_BLAS=ON -DWHISPER_CUBLAS=OFF)
endif(LOCALVOCAL_WITH_CUDA) endif()
ExternalProject_Add( ExternalProject_Add(
Whispercpp_Build Whispercpp_Build
@ -78,12 +78,12 @@ else()
CMAKE_GENERATOR ${CMAKE_GENERATOR} CMAKE_GENERATOR ${CMAKE_GENERATOR}
INSTALL_COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR> --config ${Whispercpp_BUILD_TYPE} INSTALL_COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR> --config ${Whispercpp_BUILD_TYPE}
CONFIGURE_COMMAND 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} ${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_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_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 -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) endif(WIN32)
ExternalProject_Get_Property(Whispercpp_Build INSTALL_DIR) ExternalProject_Get_Property(Whispercpp_Build INSTALL_DIR)