|
1 |
| -cmake_minimum_required(VERSION 3.12) # Don't bump this version for no reason |
| 1 | +cmake_minimum_required(VERSION 3.25) # Don't bump this version for no reason |
2 | 2 | project("llama.cpp" C CXX)
|
3 | 3 |
|
4 | 4 | set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
@@ -65,8 +65,8 @@ endif()
|
65 | 65 |
|
66 | 66 | # 3rd party libs
|
67 | 67 | option(LLAMA_ACCELERATE "llama: enable Accelerate framework" ON)
|
68 |
| -option(LLAMA_OPENBLAS "llama: use OpenBLAS" OFF) |
69 |
| -option(LLAMA_BLIS "llama: use blis" OFF) |
| 68 | +option(LLAMA_BLAS "llama: use BLAS" OFF) |
| 69 | +option(LLAMA_BLAS_VENDOR "llama: BLA_VENDOR from https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors" Generic) |
70 | 70 | option(LLAMA_CUBLAS "llama: use cuBLAS" OFF)
|
71 | 71 | option(LLAMA_CLBLAST "llama: use CLBlast" OFF)
|
72 | 72 |
|
@@ -146,57 +146,26 @@ if (APPLE AND LLAMA_ACCELERATE)
|
146 | 146 | endif()
|
147 | 147 | endif()
|
148 | 148 |
|
149 |
| -if (LLAMA_OPENBLAS) |
| 149 | +if (LLAMA_BLAS) |
150 | 150 | if (LLAMA_STATIC)
|
151 | 151 | set(BLA_STATIC ON)
|
152 | 152 | endif()
|
153 |
| - |
154 |
| - set(BLA_VENDOR OpenBLAS) |
| 153 | + set(BLA_SIZEOF_INTEGRER 8) |
| 154 | + set(BLA_VENDOR ${LLAMA_BLAS_VENDOR}) |
155 | 155 | find_package(BLAS)
|
156 | 156 | if (BLAS_FOUND)
|
157 |
| - message(STATUS "OpenBLAS found") |
| 157 | + message(STATUS "BLAS found, Libraries: ${BLAS_LIBRARIES}") |
158 | 158 |
|
159 | 159 | add_compile_definitions(GGML_USE_OPENBLAS)
|
160 |
| - add_link_options(${BLAS_LIBRARIES}) |
161 |
| - set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} openblas) |
162 |
| - |
163 |
| - # find header file |
164 |
| - set(OPENBLAS_INCLUDE_SEARCH_PATHS |
165 |
| - /usr/include |
166 |
| - /usr/include/openblas |
167 |
| - /usr/include/openblas-base |
168 |
| - /usr/local/include |
169 |
| - /usr/local/include/openblas |
170 |
| - /usr/local/include/openblas-base |
171 |
| - /opt/OpenBLAS/include |
172 |
| - $ENV{OpenBLAS_HOME} |
173 |
| - $ENV{OpenBLAS_HOME}/include |
174 |
| - ) |
175 |
| - find_path(OPENBLAS_INC NAMES cblas.h PATHS ${OPENBLAS_INCLUDE_SEARCH_PATHS}) |
176 |
| - add_compile_options(-I${OPENBLAS_INC}) |
| 160 | + set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${BLAS_LIBRARIES}) |
| 161 | + |
| 162 | + message("${BLAS_LIBRARIES}") |
| 163 | + include_directories(${BLAS_INCLUDE_DIRS}) |
177 | 164 | else()
|
178 |
| - message(WARNING "OpenBLAS not found") |
| 165 | + message(WARNING "BLAS not found, please refer to https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors to set correct LLAMA_BLAS_VENDOR") |
179 | 166 | endif()
|
180 | 167 | endif()
|
181 | 168 |
|
182 |
| -if (LLAMA_BLIS) |
183 |
| - add_compile_definitions(GGML_USE_BLIS) |
184 |
| - # we don't directly call BLIS apis, use cblas wrapper instead |
185 |
| - add_compile_definitions(GGML_USE_OPENBLAS) |
186 |
| - set(BLIS_INCLUDE_SEARCH_PATHS |
187 |
| - /usr/include |
188 |
| - /usr/include/blis |
189 |
| - /usr/local/include |
190 |
| - /usr/local/include/blis |
191 |
| - $ENV{BLIS_HOME} |
192 |
| - $ENV{BLIS_HOME}/include |
193 |
| - ) |
194 |
| - find_path(BLIS_INC NAMES blis.h PATHS ${BLIS_INCLUDE_SEARCH_PATHS}) |
195 |
| - add_compile_definitions(BLIS_ENABLE_CBLAS) |
196 |
| - add_link_options(-lblis) |
197 |
| - add_compile_options(-I${BLIS_INC}) |
198 |
| -endif() |
199 |
| - |
200 | 169 | if (LLAMA_CUBLAS)
|
201 | 170 | cmake_minimum_required(VERSION 3.17)
|
202 | 171 |
|
|
0 commit comments