From 5ccd600643ab3db9e0c4772a4c1b3109d93030cf Mon Sep 17 00:00:00 2001 From: John Gebbie Date: Thu, 9 Feb 2023 18:45:53 +0000 Subject: [PATCH] Add OPENBLAS and USE_SHARED_MATH --- src/Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index cd697b15..56cb3063 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,9 +4,11 @@ OPENFST_ROOT?=$(KALDI_ROOT)/tools/openfst OPENBLAS_ROOT?=$(KALDI_ROOT)/tools/OpenBLAS/install MKL_ROOT?=/opt/intel/mkl CUDA_ROOT?=/usr/local/cuda -USE_SHARED?=0 +USE_SHARED_KALDI?=0 +USE_SHARED_MATH?=0 # Math libraries HAVE_OPENBLAS_CLAPACK?=1 +HAVE_OPENBLAS?=0 HAVE_MKL?=0 HAVE_ACCELERATE=0 HAVE_CUDA?=0 @@ -37,7 +39,7 @@ CFLAGS=-g -O3 -std=c++17 -Wno-deprecated-declarations -fPIC -DFST_NO_DYNAMIC_LIN LDFLAGS= -ifeq ($(USE_SHARED), 0) +ifeq ($(USE_SHARED_KALDI), 0) LIBS = \ $(KALDI_ROOT)/src/online2/kaldi-online2.a \ $(KALDI_ROOT)/src/decoder/kaldi-decoder.a \ @@ -69,7 +71,7 @@ endif ifeq ($(HAVE_OPENBLAS_CLAPACK), 1) CFLAGS += -I$(OPENBLAS_ROOT)/include - ifeq ($(USE_SHARED), 0) + ifeq ($(USE_SHARED_MATH), 0) LIBS += \ $(OPENBLAS_ROOT)/lib/libopenblas.a \ $(OPENBLAS_ROOT)/lib/liblapack.a \ @@ -80,6 +82,15 @@ ifeq ($(HAVE_OPENBLAS_CLAPACK), 1) endif endif +ifeq ($(HAVE_OPENBLAS), 1) + CFLAGS += -I$(OPENBLAS_ROOT)/include + ifeq ($(USE_SHARED_MATH), 0) + LIBS += $(OPENBLAS_ROOT)/lib/libopenblas.a + else + LDFLAGS += -lopenblas -lgfortran + endif +endif + ifeq ($(HAVE_MKL), 1) CFLAGS += -DHAVE_MKL=1 -I$(MKL_ROOT)/include LDFLAGS += -L$(MKL_ROOT)/lib/intel64 -Wl,-rpath=$(MKL_ROOT)/lib/intel64 -lmkl_rt -lmkl_intel_lp64 -lmkl_core -lmkl_sequential