mirror of
https://github.com/amd/blis.git
synced 2026-04-20 07:38:53 +00:00
Avoid compiling BLAS/CBLAS files when disabled.
Details: - Updated the top-level Makefile, build/config.mk.in template, and configure script so that object files corresponding to source files belonging to the BLAS compatibility layer are not compiled (or archived) when the compatibility layer is disabled. (Same for CBLAS.) Thanks to Devin Matthews for suggesting this optimization. - Slight change to the way configure handles internal variables. Instead of converting (overwriting) some, such as enable_blas2blis and enable_cblas, from a "yes" or "no" to a "1" or "0" value, the latter are now stored in new variables that live alongside the originals (with the suffix "_01"). This is convenient since some values need to be sed-substituted into the config.mk.in template, which requires "yes" or "no", while some need to be written to the bli_config.h.in template, which requires "0" or "1".
This commit is contained in:
13
Makefile
13
Makefile
@@ -312,6 +312,19 @@ MK_BLIS_CONFIG_OBJS += $(patsubst $(CONFIG_PATH)/%.c, $(BASE_OBJ_CONFIG_PATH)/%
|
||||
MK_ALL_BLIS_OBJS := $(MK_BLIS_CONFIG_OBJS) \
|
||||
$(MK_BLIS_FRAME_OBJS)
|
||||
|
||||
# Optionally filter out the BLAS and CBLAS compatibility layer object files.
|
||||
# This is not actually necessary, since each affected file is guarded by C
|
||||
# preprocessor macros, but it but prevents "empty" object files from being
|
||||
# added into the library (and reduces compilation time).
|
||||
BASE_OBJ_BLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat
|
||||
BASE_OBJ_CBLAS_PATH := $(BASE_OBJ_FRAME_PATH)/compat/cblas
|
||||
ifeq ($(BLIS_ENABLE_CBLAS),no)
|
||||
MK_ALL_BLIS_OBJS := $(filter-out $(BASE_OBJ_CBLAS_PATH)/%.o, $(MK_ALL_BLIS_OBJS) )
|
||||
endif
|
||||
ifeq ($(BLIS_ENABLE_BLAS2BLIS),no)
|
||||
MK_ALL_BLIS_OBJS := $(filter-out $(BASE_OBJ_BLAS_PATH)/%.o, $(MK_ALL_BLIS_OBJS) )
|
||||
endif
|
||||
|
||||
|
||||
|
||||
#
|
||||
|
||||
@@ -64,5 +64,9 @@ BLIS_ENABLE_VERBOSE_MAKE_OUTPUT := @enable_verbose@
|
||||
BLIS_ENABLE_STATIC_BUILD := @enable_static@
|
||||
BLIS_ENABLE_DYNAMIC_BUILD := @enable_dynamic@
|
||||
|
||||
# The status of BLAS and CBLAS compatibility layers
|
||||
BLIS_ENABLE_BLAS2BLIS := @enable_blas2blis@
|
||||
BLIS_ENABLE_CBLAS := @enable_cblas@
|
||||
|
||||
# end of ifndef CONFIG_MK_INCLUDED conditional block
|
||||
endif
|
||||
|
||||
32
configure
vendored
32
configure
vendored
@@ -486,16 +486,20 @@ main()
|
||||
|
||||
|
||||
# Check the threading model flag.
|
||||
enable_openmp=0
|
||||
enable_pthreads=0
|
||||
enable_openmp='no'
|
||||
enable_openmp_01=0
|
||||
enable_pthreads='no'
|
||||
enable_pthreads_01=0
|
||||
if [ "x${threading_model}" = "xauto" ]; then
|
||||
echo "${script_name}: determining the threading model automatically."
|
||||
elif [ "x${threading_model}" = "xomp" ]; then
|
||||
echo "${script_name}: using OpenMP for threading."
|
||||
enable_openmp=1
|
||||
enable_openmp='yes'
|
||||
enable_openmp_01=1
|
||||
elif [ "x${threading_model}" = "xpthreads" ]; then
|
||||
echo "${script_name}: using Pthreads for threading."
|
||||
enable_pthreads=1
|
||||
enable_pthreads='yes'
|
||||
enable_pthreads_01=1
|
||||
elif [ "x${threading_model}" = "xno" ]; then
|
||||
echo "${script_name}: threading is disabled."
|
||||
else
|
||||
@@ -507,19 +511,19 @@ main()
|
||||
# Convert 'yes' and 'no' flags to booleans.
|
||||
if [ "x${enable_cblas}" = "xyes" ]; then
|
||||
echo "${script_name}: the CBLAS compatibility layer is enabled."
|
||||
enable_cblas=1
|
||||
enable_cblas_01=1
|
||||
# Force BLAS layer when CBLAS is enabled
|
||||
enable_blas='yes'
|
||||
enable_blas2blis='yes'
|
||||
else
|
||||
echo "${script_name}: the CBLAS compatibility layer is disabled."
|
||||
enable_cblas=0
|
||||
enable_cblas_01=0
|
||||
fi
|
||||
if [ "x${enable_blas2blis}" = "xyes" ]; then
|
||||
echo "${script_name}: the BLAS compatibility layer is enabled."
|
||||
enable_blas2blis=1
|
||||
enable_blas2blis_01=1
|
||||
else
|
||||
echo "${script_name}: the BLAS compatibility layer is disabled."
|
||||
enable_blas2blis=0
|
||||
enable_blas2blis_01=0
|
||||
fi
|
||||
|
||||
|
||||
@@ -561,6 +565,8 @@ main()
|
||||
| sed "s/@enable_static@/${enable_static}/g" \
|
||||
| sed "s/@enable_dynamic@/${enable_shared}/g" \
|
||||
| sed "s/@threading_model@/${threading_model}/g" \
|
||||
| sed "s/@enable_blas2blis@/${enable_blas2blis}/g" \
|
||||
| sed "s/@enable_cblas@/${enable_cblas}/g" \
|
||||
> "${config_mk_out_path}"
|
||||
|
||||
|
||||
@@ -568,12 +574,12 @@ main()
|
||||
# to bli_config_h_out.
|
||||
echo "${script_name}: creating ${bli_config_h_out_path} from ${bli_config_h_in_path}"
|
||||
cat "${bli_config_h_in_path}" \
|
||||
| sed "s/@enable_openmp@/${enable_openmp}/g" \
|
||||
| sed "s/@enable_pthreads@/${enable_pthreads}/g" \
|
||||
| sed "s/@enable_openmp@/${enable_openmp_01}/g" \
|
||||
| sed "s/@enable_pthreads@/${enable_pthreads_01}/g" \
|
||||
| sed "s/@int_type_size@/${int_type_size}/g" \
|
||||
| sed "s/@blas2blis_int_type_size@/${blas2blis_int_type_size}/g" \
|
||||
| sed "s/@enable_blas2blis@/${enable_blas2blis}/g" \
|
||||
| sed "s/@enable_cblas@/${enable_cblas}/g" \
|
||||
| sed "s/@enable_blas2blis@/${enable_blas2blis_01}/g" \
|
||||
| sed "s/@enable_cblas@/${enable_cblas_01}/g" \
|
||||
> "${bli_config_h_out_path}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user