Skip to content

Commit

Permalink
[src] Add --debug-level=N configure option to control assertions (kal…
Browse files Browse the repository at this point in the history
  • Loading branch information
iskunk authored and danpovey committed Nov 16, 2019
1 parent ab36598 commit d97f1d8
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 9 deletions.
11 changes: 11 additions & 0 deletions src/configure
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Configuration options:
--cudatk-dir=DIR CUDA toolkit directory
--cuda-arch=FLAGS Override the default CUDA_ARCH flags. See:
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-examples.
--debug-level=N Use assertion level 0 (disabled), 1, or 2 [default=1]
--double-precision Build with BaseFloat set to double if yes [default=no],
mostly useful for testing purposes.
--static-fst Build with static OpenFst libraries [default=no]
Expand Down Expand Up @@ -739,6 +740,7 @@ ENV_LDFLAGS=$LDFLAGS
ENV_LDLIBS=$LDLIBS

# Default configuration
debug_level=1
double_precision=false
dynamic_kaldi=false
use_cuda=true
Expand Down Expand Up @@ -771,6 +773,9 @@ do
static_math=false;
static_fst=false;
shift ;;
--debug-level=*)
GetSwitchValueOrDie debug_level "$1"
shift ;;
--double-precision)
double_precision=true;
shift ;;
Expand Down Expand Up @@ -901,6 +906,11 @@ do
esac
done

case "$debug_level" in
[012]) ;;
*) failure "Invalid value --debug-level=$debug_level. Supported values are 0, 1, and 2." ;;
esac

# The idea here is that if you change the configuration options from using
# CUDA to not using it, or vice versa, we want to recompile all parts of the
# code that may use a GPU. Touching this file is a way to force this.
Expand Down Expand Up @@ -1033,6 +1043,7 @@ if $dynamic_kaldi ; then
echo "KALDI_FLAVOR := dynamic" >> kaldi.mk
echo "KALDILIBDIR := $KALDILIBDIR" >> kaldi.mk
fi
echo "DEBUG_LEVEL = $debug_level" >> kaldi.mk
if $double_precision; then
echo "DOUBLE_PRECISION = 1" >> kaldi.mk
else
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_atlas.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ATLAS specific Linux configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -22,12 +25,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -I$(ATLASINC) \
-msse -msse2 -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_atlas_ppc64le.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ATLAS specific Linux ppc64le configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -23,12 +26,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -I$(ATLASINC) \
-m64 -maltivec -mcpu=power8 -mtune=power8 -mpower8-vector -mvsx \
-pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_clapack.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CLAPACK specific Linux configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -16,12 +19,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_CLAPACK -I../../tools/CLAPACK \
-msse -msse2 -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_clapack_arm.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CLAPACK specific Linux ARM configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -16,12 +19,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_CLAPACK -I../../tools/CLAPACK \
-ftree-vectorize -mfloat-abi=hard -mfpu=neon -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_openblas.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OpenBLAS specific Linux configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -22,12 +25,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_OPENBLAS -I$(OPENBLASINC) \
-msse -msse2 -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_openblas_aarch64.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OpenBLAS specific Linux ARM configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -22,12 +25,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_OPENBLAS -I$(OPENBLASINC) \
-ftree-vectorize -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_openblas_arm.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OpenBLAS specific Linux ARM configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -22,12 +25,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_OPENBLAS -I$(OPENBLASINC) \
-ftree-vectorize -mfloat-abi=hard -mfpu=neon -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_openblas_ppc64le.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# OpenBLAS specific Linux configuration

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -23,12 +26,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_OPENBLAS -I$(OPENBLASINC) \
-m64 -maltivec -mcpu=power8 -mtune=power8 -mpower8-vector -mvsx \
-pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down
12 changes: 11 additions & 1 deletion src/makefiles/linux_x86_64_mkl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Use the options obtained from this website to manually configure for other
# platforms using MKL.

ifndef DEBUG_LEVEL
$(error DEBUG_LEVEL not defined.)
endif
ifndef DOUBLE_PRECISION
$(error DOUBLE_PRECISION not defined.)
endif
Expand All @@ -30,12 +33,19 @@ CXXFLAGS = -std=c++11 -I.. -isystem $(OPENFSTINC) -O1 $(EXTRA_CXXFLAGS) \
-DKALDI_DOUBLEPRECISION=$(DOUBLE_PRECISION) \
-DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_MKL -I$(MKLROOT)/include \
-m64 -msse -msse2 -pthread \
-g # -O0 -DKALDI_PARANOID
-g

ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
endif

ifeq ($(DEBUG_LEVEL), 0)
CXXFLAGS += -DNDEBUG
endif
ifeq ($(DEBUG_LEVEL), 2)
CXXFLAGS += -O0 -DKALDI_PARANOID
endif

# Compiler specific flags
COMPILER = $(shell $(CXX) -v 2>&1)
ifeq ($(findstring clang,$(COMPILER)),clang)
Expand Down

0 comments on commit d97f1d8

Please sign in to comment.