Skip to content

Commit e396ec8

Browse files
authored
Allow building support for only a subset of variable types
1 parent 68e6823 commit e396ec8

File tree

5 files changed

+182
-63
lines changed

5 files changed

+182
-63
lines changed

CMakeLists.txt

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ option(NO_AFFINITY "Disable support for CPU affinity masks to avoid binding proc
2929
else()
3030
set(NO_AFFINITY 1)
3131
endif()
32-
option(CPP_THREAD_SAFETY_TEST "Run a massively parallel DGEMM test to confirm thread safety of the library (requires OpenMP and about 1.3GB of RAM)" OFF)
33-
option(CPP_THREAD_SAFETY_GEMV "Run a massively parallel DGEMV test to confirm thread safety of the library (requires OpenMP)" OFF)
32+
option(BUILD_SINGLE "Single precision" OFF)
33+
option(BUILD_DOUBLE "Double precision" OFF)
34+
option(BUILD_COMPLEX "Single precision" OFF)
35+
option(BUILD_COMPLEX16 "Single precision" OFF)
3436

3537
# Add a prefix or suffix to all exported symbol names in the shared library.
3638
# Avoids conflicts with other BLAS libraries, especially when using
@@ -108,28 +110,33 @@ endif()
108110

109111
set(FLOAT_TYPES "")
110112
if (BUILD_SINGLE)
111-
message(STATUS "Building Single Precision")
112-
list(APPEND FLOAT_TYPES "SINGLE") # defines nothing
113+
message(STATUS "Building Songle Precision")
114+
list(APPEND FLOAT_TYPES "SINGLE")
115+
# set(CCOMMON_OPT "${CCOMMON_OPT} -DBUILD_SINGLE=1")
113116
endif ()
114117

115118
if (BUILD_DOUBLE)
116119
message(STATUS "Building Double Precision")
117-
list(APPEND FLOAT_TYPES "DOUBLE") # defines DOUBLE
120+
list(APPEND FLOAT_TYPES "DOUBLE")
121+
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_DOUBLE=1")
118122
endif ()
119123

120124
if (BUILD_COMPLEX)
121125
message(STATUS "Building Complex Precision")
122-
list(APPEND FLOAT_TYPES "COMPLEX") # defines COMPLEX
123-
endif ()
126+
list(APPEND FLOAT_TYPES "COMPLEX")
127+
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_COMPLEX=1")
128+
endif ()
124129

125130
if (BUILD_COMPLEX16)
126131
message(STATUS "Building Double Complex Precision")
127-
list(APPEND FLOAT_TYPES "ZCOMPLEX") # defines COMPLEX and DOUBLE
132+
list(APPEND FLOAT_TYPES "ZCOMPLEX")
133+
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_COMPLEX16=1")
128134
endif ()
129135

130136
if (BUILD_HALF)
131137
message(STATUS "Building Half Precision")
132-
list(APPEND FLOAT_TYPES "HALF") # defines nothing
138+
list(APPEND FLOAT_TYPES "HALF")
139+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_HALF")
133140
endif ()
134141

135142
if (NOT DEFINED CORE OR "${CORE}" STREQUAL "UNKNOWN")
@@ -236,9 +243,6 @@ if (NOT MSVC AND NOT NOFORTRAN)
236243
add_subdirectory(ctest)
237244
endif()
238245
add_subdirectory(lapack-netlib/TESTING)
239-
if (CPP_THREAD_SAFETY_TEST OR CPP_THREAD_SAFETY_GEMV)
240-
add_subdirectory(cpp_thread_test)
241-
endif()
242246
endif()
243247

244248
set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES

Makefile

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ ifneq ($(NO_CBLAS), 1)
146146
ifeq ($(CPP_THREAD_SAFETY_TEST), 1)
147147
$(MAKE) -C cpp_thread_test all
148148
endif
149-
ifeq ($(CPP_THREAD_SAFETY_GEMV), 1)
150-
$(MAKE) -C cpp_thread_test dgemv_tester
151-
endif
152149
endif
153150
endif
154151

@@ -304,6 +301,18 @@ else
304301
endif
305302
ifeq ($(BUILD_LAPACK_DEPRECATED), 1)
306303
-@echo "BUILD_DEPRECATED = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
304+
endif
305+
ifeq ($(BUILD_SINGLE), 1)
306+
-@echo "BUILD_SINGLE = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
307+
endif
308+
ifeq ($(BUILD_DOUBLE), 1)
309+
-@echo "BUILD_DOUBLE = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
310+
endif
311+
ifeq ($(BUILD_COMPLEX), 1)
312+
-@echo "BUILD_COMPLEX = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
313+
endif
314+
ifeq ($(BUILD_COMPLEX16), 1)
315+
-@echo "BUILD_COMPLEX16 = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
307316
endif
308317
-@echo "LAPACKE_WITH_TMG = 1" >> $(NETLIB_LAPACK_DIR)/make.inc
309318
-@cat make.inc >> $(NETLIB_LAPACK_DIR)/make.inc

Makefile.rule

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -272,33 +272,17 @@ COMMON_PROF = -pg
272272
# work at all.
273273
#
274274
# CPP_THREAD_SAFETY_TEST = 1
275-
#
276-
# use this to run only the less memory-hungry GEMV test
277-
# CPP_THREAD_SAFETY_GEMV = 1
278275

279276

280277
# If you want to enable the experimental BFLOAT16 support
281278
# BUILD_HALF = 1
282-
283-
284-
# Set the thread number threshold beyond which the job array for the threaded level3 BLAS
285-
# will be allocated on the heap rather than the stack. (This array alone requires
286-
# NUM_THREADS*NUM_THREADS*128 bytes of memory so should not pose a problem at low cpu
287-
# counts, but obviously it is not the only item that ends up on the stack.
288-
# The default value of 32 ensures that the overall requirement is compatible
289-
# with the default 1MB stacksize imposed by having the Java VM loaded without use
290-
# of its -Xss parameter.
291-
# The value of 160 formerly used from about version 0.2.7 until 0.3.10 is easily compatible
292-
# with the common Linux stacksize of 8MB but will cause crashes with unwary use of the java
293-
# VM e.g. in Octave or with the java-based libhdfs in numpy or scipy code
294-
# BLAS3_MEM_ALLOC_THRESHOLD = 160
295-
296-
297-
298-
# the below is not yet configurable, use cmake if you need to build only select types
299-
BUILD_SINGLE = 1
300-
BUILD_DOUBLE = 1
301-
BUILD_COMPLEX = 1
302-
BUILD_COMPLEX16 = 1
279+
#
280+
# Select if you need to build only select types
281+
# BUILD_SINGLE = 1
282+
# BUILD_DOUBLE = 1
283+
# BUILD_COMPLEX = 1
284+
# BUILD_COMPLEX16 = 1
285+
#
286+
#
303287
# End of user configuration
304288
#

Makefile.tail

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ COMMONOBJS_P = $(COMMONOBJS:.$(SUFFIX)=.$(PSUFFIX))
1111

1212
HPLOBJS_P = $(HPLOBJS:.$(SUFFIX)=.$(PSUFFIX))
1313

14-
BLASOBJS = $(SHEXTOBJS) $(SHBLASOBJS) $(SBLASOBJS) $(DBLASOBJS) $(CBLASOBJS) $(ZBLASOBJS)
15-
BLASOBJS_P = $(SHEXTOBJS_P) $(SHBLASOBJS_P) $(SBLASOBJS_P) $(DBLASOBJS_P) $(CBLASOBJS_P) $(ZBLASOBJS_P)
14+
BLASOBJS = $(SHEXTOBJS) $(SHBLASOBJS) $(SBLASOBJS) $(DBLASOBJS) $(CBLASOBJS) $(ZBLASOBJS) $(CBAUXOBJS)
15+
BLASOBJS_P = $(SHEXTOBJS_P) $(SHBLASOBJS_P) $(SBLASOBJS_P) $(DBLASOBJS_P) $(CBLASOBJS_P) $(ZBLASOBJS_P) $(CBAUXOBJS_P)
1616

1717
ifdef EXPRECISION
1818
BLASOBJS += $(QBLASOBJS) $(XBLASOBJS)

0 commit comments

Comments
 (0)