bobqianic commited on
Commit
7b4d898
·
unverified ·
1 Parent(s): 232f2a8

cmake : enable OpenBLAS on Windows (#1128)

Browse files

Fixed 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.

Files changed (1) hide show
  1. CMakeLists.txt +27 -16
CMakeLists.txt CHANGED
@@ -136,22 +136,33 @@ if (WHISPER_OPENBLAS)
136
  endif()
137
 
138
  if (WHISPER_BLAS)
139
- set(BLA_STATIC 1)
140
- set(BLA_VENDOR ${WHISPER_BLAS_VENDOR})
141
- # set(BLA_PREFER_PKGCONFIG 1)
142
- set(BLA_SIZEOF_INTEGER 8)
143
- find_package(BLAS)
144
-
145
- if(BLAS_FOUND)
146
- message(STATUS "BLAS compatible library found")
147
- message(STATUS "Libraries ${BLAS_LIBRARIES}")
148
- set(WHISPER_EXTRA_FLAGS ${WHISPER_EXTRA_FLAGS} -DGGML_USE_OPENBLAS)
149
-
150
- include_directories(${BLAS_INCLUDE_DIRS})
151
- set(WHISPER_EXTRA_LIBS ${WHISPER_EXTRA_LIBS} ${BLAS_LIBRARIES})
152
- else()
153
- message(WARNING "BLAS library was not found")
154
- endif()
 
 
 
 
 
 
 
 
 
 
 
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)