ggml icon indicating copy to clipboard operation
ggml copied to clipboard

custom blas

Open wmx-github opened this issue 1 year ago • 0 comments

https://github.com/ggerganov/llama.cpp/discussions/625 custom blas : if your blas in C:/workspace/program/openblas

Blas is accelerated by compiling GGML provided, so in the ggml/src/CMakeLists.txt file , add the following code in this line of code if GGML_BLAS front

# add custom blas
if (CUSTOM_BLAS)
  set(BLAS_ROOT "C:/workspace/program/openblas")
  set(BLAS_INCLUDE_DIRS
        "${BLAS_ROOT}/include/"
        "${BLAS_ROOT}/include/openblas"
    )
  set(BLAS_LIBRARIES "${BLAS_ROOT}/lib/openblas.lib")
  list(APPEND GGML_CDEF_PUBLIC GGML_USE_BLAS)
  
  set(GGML_HEADERS_BLAS .. /include/ggml-blas.h)
  set(GGML_SOURCES_BLAS ggml-blas.cpp)
  
  set(GGML_EXTRA_LIBS     ${GGML_EXTRA_LIBS}     ${BLAS_LIBRARIES})
  set(GGML_EXTRA_INCLUDES ${GGML_EXTRA_INCLUDES} ${BLAS_INCLUDE_DIRS})
endif()

Then compile, specifying CUSTOM_BLAS=ON :

cmake -B build -DGGML_BLAS=OFF  -DCUSTOM_BLAS=ON
cmake --build build --config Release

wmx-github avatar Sep 12 '24 02:09 wmx-github