# specify it.
# For force setting for single threaded, specify USE_THREAD = 0
# For force setting for multi threaded, specify USE_THREAD = 1
-# USE_THREAD = 0
+USE_THREAD = 0
+
+# If you want to build a single-threaded OpenBLAS, but expect to call this
+# from several concurrent threads in some other program, comment this in for
+# thread safety. (This is done automatically for USE_THREAD=1 , and should not
+# be necessary when USE_OPENMP=1)
+# USE_LOCKING = 1
# If you're going to use this library with OpenMP, please comment it in.
# This flag is always set for POWER8. Don't set USE_OPENMP = 0 if you're targeting POWER8.
COMMON_PROF = -pg
# Build Debug version
-# DEBUG = 1
+DEBUG = 1
# Set maximum stack allocation.
# The default value is 2048. 0 disable stack allocation a may reduce GER and GEMV
endif
endif
+ifeq ($(SMP), 1)
+USE_LOCKING =
+endif
+
ifndef NEED_PIC
NEED_PIC = 1
endif
CCOMMON_OPT += -DMAX_STACK_ALLOC=$(MAX_STACK_ALLOC)
endif
+ifdef USE_LOCKING
+ifneq ($(USE_LOCKING), 0)
+CCOMMON_OPT += -DUSE_LOCKING
+endif
+endif
+
#
# Architecture dependent settings
#
FCOMMON_OPT += -Wall
# make single-threaded LAPACK calls thread-safe #1847
FCOMMON_OPT += -frecursive
+# work around ABI changes in gfortran 9 that break calls from C code
+FCOMMON_OPT += -fno-optimize-sibling-calls
#Don't include -lgfortran, when NO_LAPACK=1 or lsbcc
ifneq ($(NO_LAPACK), 1)
EXTRALIB += -lgfortran
#include <time.h>
#include <unistd.h>
#include <math.h>
-#ifdef SMP
+#if defined(SMP) || defined(USE_LOCKING)
#include <pthread.h>
#endif
#endif
#error "You can't specify both LOCK operation!"
#endif
-#ifdef SMP
+#if defined(SMP) || defined(USE_LOCKING)
#define USE_PTHREAD_LOCK
#undef USE_PTHREAD_SPINLOCK
#endif