From 3ee7c70afe06d7a4ef143951dd0c37d64bfaad74 Mon Sep 17 00:00:00 2001 From: Kevin Hannon Date: Sun, 15 Mar 2026 14:23:49 -0400 Subject: [PATCH 1/2] ggml blas: set mkl threads from thread context --- ggml/src/ggml-blas/ggml-blas.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ggml/src/ggml-blas/ggml-blas.cpp b/ggml/src/ggml-blas/ggml-blas.cpp index 5de64b816f..e7a1763b54 100644 --- a/ggml/src/ggml-blas/ggml-blas.cpp +++ b/ggml/src/ggml-blas/ggml-blas.cpp @@ -121,6 +121,8 @@ static void ggml_backend_blas_mul_mat(ggml_backend_blas_context * ctx, struct gg bli_thread_set_num_threads(ctx->n_threads); #elif defined(GGML_BLAS_USE_NVPL) nvpl_blas_set_num_threads(ctx->n_threads); +#elif defined(GGML_BLAS_USE_MKL) + mkl_set_num_threads(ctx->n_threads); #endif for (int64_t i13 = 0; i13 < ne13; i13++) { From bb7c95ed1244b3d3fa864fd381781e4b9ebb836d Mon Sep 17 00:00:00 2001 From: Kevin Hannon Date: Sun, 15 Mar 2026 14:58:13 -0400 Subject: [PATCH 2/2] add code to run blas locally --- ci/run.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ci/run.sh b/ci/run.sh index 16cd80d56a..eaf6358c0d 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -25,7 +25,13 @@ # # with KLEIDIAI support # GG_BUILD_KLEIDIAI=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt # -# # with OPENVINO support +# # with BLAS support +# GG_BUILD_BLAS=1 bash ./ci/run.sh ./tmp/results ./tmp/mnt +# +# with BLAS support (custom vendor) +# GG_BUILD_BLAS=1 GG_BUILD_BLAS_VENDOR=Intel10_64lp bash ./ci/run.sh ./tmp/results ./tmp/mnt +# +# with OPENVINO support # GG_BUILD_OPENVINO=1 GG_BUILD_LOW_PERF=1 GGML_OPENVINO_DEVICE=CPU bash ./ci/run.sh ./tmp/results ./tmp/mnt # @@ -169,6 +175,10 @@ if [ -n "${GG_BUILD_KLEIDIAI}" ]; then -DBUILD_SHARED_LIBS=OFF" fi +if [ ! -z ${GG_BUILD_BLAS} ]; then + CMAKE_EXTRA="${CMAKE_EXTRA} -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=${GG_BUILD_BLAS_VENDOR:-OpenBLAS}" +fi + if [ ! -z ${GG_BUILD_OPENVINO} ]; then if [ -z ${OpenVINO_DIR} ]; then echo "OpenVINO_DIR not found, please install OpenVINO via archives and enable it by:"