Spaces:
Sleeping
Sleeping
bobqianic
commited on
cmake : enable OpenBLAS on Windows (#1128)
Browse filesFixed the issue of not being able to find OpenBLAS on the Windows platform. Even though the name of the previously released binary file was whisper-blas-bin-x64.zip, BLAS was actually not enabled. After enabling, the inference speed can increase by 3-4 times.
- CMakeLists.txt +27 -16
CMakeLists.txt
CHANGED
|
@@ -136,22 +136,33 @@ if (WHISPER_OPENBLAS)
|
|
| 136 |
endif()
|
| 137 |
|
| 138 |
if (WHISPER_BLAS)
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
set(
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
endif ()
|
| 156 |
|
| 157 |
if (WHISPER_CUBLAS)
|
|
|
|
| 136 |
endif()
|
| 137 |
|
| 138 |
if (WHISPER_BLAS)
|
| 139 |
+
if (WIN32)
|
| 140 |
+
if(DEFINED ENV{OPENBLAS_PATH})
|
| 141 |
+
set(BLAS_LIBRARIES $ENV{OPENBLAS_PATH}/lib/libopenblas.dll.a)
|
| 142 |
+
message(STATUS "Libraries ${BLAS_LIBRARIES}")
|
| 143 |
+
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_OPENBLAS)
|
| 144 |
+
include_directories($ENV{OPENBLAS_PATH}/include)
|
| 145 |
+
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${BLAS_LIBRARIES})
|
| 146 |
+
else ()
|
| 147 |
+
message(WARNING "BLAS library was not found. Environment variable OPENBLAS_PATH not defined.")
|
| 148 |
+
endif ()
|
| 149 |
+
else ()
|
| 150 |
+
set(BLA_STATIC 1)
|
| 151 |
+
set(BLA_VENDOR ${WHISPER_BLAS_VENDOR})
|
| 152 |
+
# set(BLA_PREFER_PKGCONFIG 1)
|
| 153 |
+
set(BLA_SIZEOF_INTEGER 8)
|
| 154 |
+
find_package(BLAS)
|
| 155 |
+
|
| 156 |
+
if(BLAS_FOUND)
|
| 157 |
+
message(STATUS "BLAS compatible library found")
|
| 158 |
+
message(STATUS "Libraries ${BLAS_LIBRARIES}")
|
| 159 |
+
set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_OPENBLAS)
|
| 160 |
+
include_directories(${BLAS_INCLUDE_DIRS})
|
| 161 |
+
set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${BLAS_LIBRARIES})
|
| 162 |
+
else()
|
| 163 |
+
message(WARNING "BLAS library was not found")
|
| 164 |
+
endif()
|
| 165 |
+
endif ()
|
| 166 |
endif ()
|
| 167 |
|
| 168 |
if (WHISPER_CUBLAS)
|