From 8b75bd9a7af5e607a84c982e091fe33315bcccab Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Sun, 16 Jul 2023 14:24:28 +0100 Subject: [PATCH] Set number of OpenBLAS threads --- src/Makefile | 2 +- src/model.cc | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index cd697b15..e053bde8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -68,7 +68,7 @@ else endif ifeq ($(HAVE_OPENBLAS_CLAPACK), 1) - CFLAGS += -I$(OPENBLAS_ROOT)/include + CFLAGS += -DHAVE_OPENBLAS_CLAPACK=1 -I$(OPENBLAS_ROOT)/include ifeq ($(USE_SHARED), 0) LIBS += \ $(OPENBLAS_ROOT)/lib/libopenblas.a \ diff --git a/src/model.cc b/src/model.cc index 035ffee6..069f35c4 100644 --- a/src/model.cc +++ b/src/model.cc @@ -24,9 +24,10 @@ #include #include - +#ifdef HAVE_OPENBLAS_CLAPACK +#include +#endif #ifdef HAVE_MKL -// We need to set num threads #include #endif @@ -113,6 +114,9 @@ Model::Model(const char *model_path) : model_path_str_(model_path) { SetLogHandler(KaldiLogHandler); +#ifdef HAVE_OPENBLAS_CLAPACK + openblas_set_num_threads(1); +#endif #ifdef HAVE_MKL mkl_set_num_threads(1); #endif