diff --git a/Makefile b/Makefile index 6248250be..f1916f7c0 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,18 @@ uninstall-libs uninstall-lib-symlinks uninstall-headers \ uninstall-old-libs uninstall-lib-symlinks uninstall-old-headers +# +# --- Determine makefile fragment location ------------------------------------- +# + +# Comments: +# - We don't need to define DIST_PATH, LIB_PATH, INC_PATH, or SHARE_PATH since +# the defaults in common.mk (and config.mk) are designed to work with the +# top-level Makefile. +#DIST_PATH := . +#LIB_PATH = ./lib/$(CONFIG_NAME) +#INC_PATH = ./include/$(CONFIG_NAME) +#SHARE_PATH := . # @@ -72,10 +84,6 @@ # Define the name of the common makefile. COMMON_MK_FILE := common.mk -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(COMMON_MK_FILE) - # Include the configuration file. -include $(COMMON_MK_FILE) @@ -143,9 +151,14 @@ MK_LIBS_SYML := $(strip $(MK_LIBS_SYML)) # --- Define install directory for headers --- -# Set the include installation directory subdirectory name. +# Set the path to the subdirectory of the include installation directory. MK_INCL_DIR_INST := $(INSTALL_INCDIR)/blis +# --- Define install directory for public makefile fragments --- + +# Set the path to the subdirectory of the share installation directory. +MK_SHARE_DIR_INST := $(INSTALL_SHAREDIR)/blis + # @@ -231,6 +244,16 @@ endif +# +# --- public makefile fragment definitions ------------------------------------- +# + +# Define a list of makefile fragments to install. +FRAGS_TO_INSTALL := $(CONFIG_MK_FILE) \ + $(COMMON_MK_FILE) + + + # # --- BLAS test drivers definitions -------------------------------------------- # @@ -284,7 +307,7 @@ BLAT_CFLAGS := -Wno-maybe-uninitialized -Wno-parentheses \ -I. -DHAVE_BLIS_H # The location of the script that checks the BLAS test output. -BLASTEST_CHECK := $(DIST_PATH)/$(BUILD_DIR)/check-blastest.sh +BLASTEST_CHECK_PATH := $(DIST_PATH)/$(BLASTEST_DIR)/$(BLASTEST_CHECK) # @@ -316,7 +339,7 @@ MK_TESTSUITE_OBJS := $(sort \ TESTSUITE_BIN := test_$(LIBBLIS).x # The location of the script that checks the BLIS testsuite output. -TESTSUITE_CHECK := $(DIST_PATH)/$(BUILD_DIR)/check-blistest.sh +TESTSUITE_CHECK_PATH := $(DIST_PATH)/$(TESTSUITE_DIR)/$(TESTSUITE_CHECK) @@ -368,9 +391,9 @@ test: checkblis checkblas check: checkblis-fast checkblas -install: libs install-libs install-lib-symlinks install-headers +install: libs install-libs install-lib-symlinks install-headers install-share -uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers +uninstall: uninstall-libs uninstall-lib-symlinks uninstall-headers uninstall-share uninstall-old: uninstall-old-libs uninstall-old-symlinks uninstall-old-headers @@ -636,19 +659,19 @@ blastest-run: $(BLASTEST_DRV_BINS_R) # f2c object file rule. $(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_F2C_SRC_PATH)/%.c ifeq ($(ENABLE_VERBOSE),yes) - $(CC) $(CFLAGS) $(BLAT_CFLAGS) -c $< -o $@ + $(CC) $(call get-frame-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@ else @echo "Compiling $@" - @$(CC) $(CFLAGS) $(BLAT_CFLAGS) -c $< -o $@ + @$(CC) $(call get-frame-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@ endif # driver object file rule. $(BASE_OBJ_BLASTEST_PATH)/%.o: $(BLASTEST_DRV_SRC_PATH)/%.c ifeq ($(ENABLE_VERBOSE),yes) - $(CC) $(CFLAGS) $(BLAT_CFLAGS) -c $< -o $@ + $(CC) $(call get-frame-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@ else @echo "Compiling $@" - @$(CC) $(CFLAGS) $(BLAT_CFLAGS) -c $< -o $@ + @$(CC) $(call get-frame-cflags-for,$(CONFIG_NAME)) $(BLAT_CFLAGS) -c $< -o $@ endif # libf2c library archive rule. @@ -710,9 +733,9 @@ $(foreach name, $(BLASTEST_DRV3_BASES), $(eval $(call make-run-blat23-rule,$(nam # Check the results of the BLAS test suite drivers. checkblas: blastest-run ifeq ($(ENABLE_VERBOSE),yes) - - $(BLASTEST_CHECK) + - $(BLASTEST_CHECK_PATH) else - @- $(BLASTEST_CHECK) + @- $(BLASTEST_CHECK_PATH) endif # --- BLIS test suite rules --- @@ -775,17 +798,17 @@ endif # Check the results of the BLIS testsuite. checkblis: testsuite-run ifeq ($(ENABLE_VERBOSE),yes) - - $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) + - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE) else - @- $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) + @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE) endif # Check the results of the BLIS testsuite (fast). checkblis-fast: testsuite-run-fast ifeq ($(ENABLE_VERBOSE),yes) - - $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) + - $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE) else - @- $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) + @- $(TESTSUITE_CHECK_PATH) $(TESTSUITE_OUT_FILE) endif # --- Install header rules --- @@ -803,6 +826,28 @@ else endif +# --- Install share rules --- + +install-share: check-env $(MK_SHARE_DIR_INST) + +$(MK_SHARE_DIR_INST): $(FRAGS_TO_INSTALL) $(CONFIG_MK_FILE) +ifeq ($(ENABLE_VERBOSE),yes) + $(MKDIR) $(@) + $(INSTALL) -m 0644 $(FRAGS_TO_INSTALL) $(@) + $(MKDIR) -p $(@)/$(CONFIG_DIR)/$(CONFIG_NAME) + $(INSTALL) -m 0644 $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) \ + $(@)/$(CONFIG_DIR)/$(CONFIG_NAME) +else + @$(MKDIR) $(@) + @echo "Installing $(notdir $(FRAGS_TO_INSTALL)) into $(@)/" + @$(INSTALL) -m 0644 $(FRAGS_TO_INSTALL) $(@) + @$(MKDIR) -p $(@)/$(CONFIG_DIR)/$(CONFIG_NAME) + @echo "Installing $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) into $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)" + @$(INSTALL) -m 0644 $(CONFIG_DIR)/$(CONFIG_NAME)/$(MAKE_DEFS_FILE) \ + $(@)/$(CONFIG_DIR)/$(CONFIG_NAME)/ +endif + + # --- Install library rules --- install-libs: check-env $(MK_LIBS_INST) @@ -1098,6 +1143,14 @@ else @- $(RM_RF) $(MK_INCL_DIR_INST) endif +uninstall-share: check-env +ifeq ($(ENABLE_VERBOSE),yes) + - $(RM_RF) $(MK_SHARE_DIR_INST) +else + @echo "Uninstalling directory '$(notdir $(MK_SHARE_DIR_INST))' from $(dir $(MK_SHARE_DIR_INST))." + @- $(RM_RF) $(MK_SHARE_DIR_INST) +endif + # --- Uninstall old rules --- uninstall-old-libs: $(UNINSTALL_OLD_LIBS) check-env diff --git a/blastest/Makefile b/blastest/Makefile index 05e893991..56aa01ca8 100644 --- a/blastest/Makefile +++ b/blastest/Makefile @@ -37,7 +37,7 @@ # # Field G. Van Zee # -# Makefile for BLIS testsuite. +# Makefile for BLAS test drivers. # # @@ -52,13 +52,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := .. -BUILD_PATH := .. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := .. +LIB_PATH = ../lib/$(CONFIG_NAME) +INC_PATH = ../include/$(CONFIG_NAME) +SHARE_PATH := .. +endif @@ -66,65 +76,8 @@ BUILD_PATH := .. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif - - - -# -# --- Optional overrides ------------------------------------------------------- -# - -# Uncomment and modify these definitions if you wish to override the values -# present in the current BLIS configuration's makefile definitions file -# (ie: config//make_defs.mk). -# CC := gcc -# LINKER := $(CC) -# CFLAGS := -g -O2 -Wall -Wno-comment -# LDFLAGS := -# INSTALL_PREFIX := $(HOME)/blis - - - -# -# --- BLAS and LAPACK implementations ------------------------------------------ -# - -# BLIS library and header path. This is simply wherever it was installed. -#BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -#BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis - -# BLIS library. -#BLIS_LIB_PATH := $(BUILD_PATH)/$(LIB_DIR)/$(CONFIG_NAME) -#BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a - -# BLAS library path(s). This is where the BLAS libraries reside. -#BLAS_LIB_PATH := $(HOME)/flame/lib - -# OpenBLAS, ATLAS, and MKL libraries. -#BLAS_LIB := $(LIB_PATH)/libblas.a -#BLAS_LIB := $(LIB_PATH)/libgoto.a -#BLAS_LIB := $(LIB_PATH)/libgoto2.a -#OPENBLAS_LIB := $(BLAS_LIB_PATH)/libopenblas.a -#ATLAS_LIB := $(BLAS_LIB_PATH)/libf77blas.a \ -# $(BLAS_LIB_PATH)/libatlas.a -#MKL_LIB := -L/opt/intel/mkl/10.2.2.025/lib/em64t/ \ -# -lmkl_sequential -lmkl_core -lmkl_intel_lp64 +-include $(SHARE_PATH)/common.mk @@ -166,19 +119,27 @@ DRIVER2_BASES := $(filter %2,$(DRIVER_BASES)) DRIVER3_BASES := $(filter %3,$(DRIVER_BASES)) # The location of the script that checks the BLAS test output. -BLASTEST_CHECK := $(DIST_PATH)/$(BUILD_DIR)/check-blastest.sh +#BLASTEST_CHECK := $(DIST_PATH)/$(BUILD_DIR)/check-blastest.sh + +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) # Use the CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) # Suppress warnings about uninitialized functions, add local header # paths and the path to blis.h to CFLAGS. -CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses \ +CFLAGS += -Wno-maybe-uninitialized -Wno-parentheses -Wfatal-errors \ -I$(F2C_PATH) \ - -I$(BUILD_PATH) -DHAVE_BLIS_H + -I$(INC_PATH) -DHAVE_BLIS_H # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) + +# Override the location of the check-blastest.sh script. +#BLASTEST_CHECK := ./check-blastest.sh @@ -195,26 +156,6 @@ f2c: check-env $(F2C_LIB) bin: check-env $(DRIVER_BINS) -# --- Environment check rules --- - -check-env: check-env-make-defs check-env-fragments check-env-mk - -check-env-mk: -ifeq ($(CONFIG_MK_PRESENT),no) - $(error Cannot proceed: config.mk not detected! Run configure first) -endif - -check-env-fragments: check-env-mk -ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no) - $(error Cannot proceed: makefile fragments not detected! Run configure first) -endif - -check-env-make-defs: check-env-fragments -ifeq ($(MAKE_DEFS_MK_PRESENT),no) - $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) -endif - - # --Object file rules -- $(TEST_OBJ_PATH)/%.o: $(F2C_PATH)/%.c diff --git a/build/check-blastest.sh b/blastest/check-blastest.sh similarity index 97% rename from build/check-blastest.sh rename to blastest/check-blastest.sh index cb42a6c0d..0546550a4 100755 --- a/build/check-blastest.sh +++ b/blastest/check-blastest.sh @@ -4,7 +4,7 @@ # An object-based framework for developing high-performance BLAS-like # libraries. # -# Copyright (C) 2015, The University of Texas at Austin +# Copyright (C) 2018, The University of Texas at Austin # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git a/blastest/f2c/f2c_types.h b/blastest/f2c/f2c_types.h index dab00647e..5ba18c1a5 100644 --- a/blastest/f2c/f2c_types.h +++ b/blastest/f2c/f2c_types.h @@ -34,7 +34,8 @@ use or performance of this software. #ifdef HAVE_BLIS_H #include - #include "bli_config.h" + #define BLIS_VIA_BLASTEST + #include "blis.h" #endif #ifdef __cplusplus diff --git a/build/config.mk.in b/build/config.mk.in index b3b927580..4b06d9d5c 100644 --- a/build/config.mk.in +++ b/build/config.mk.in @@ -70,11 +70,13 @@ KCONFIG_MAP := @kconfig_map@ # The operating system name, which should be either 'Linux' or 'Darwin'. OS_NAME := @os_name@ -# The directory path to the top level of the source distribution. -# NOTE: We allow the includer to override this value by setting DIST_PATH -# prior to including this file. This is employed, for example, when -# common.mk (and therefore config.mk) is included by the Makefile local -# to the 'testsuite' directory, or the 'test' directory containing +# The directory path to the top level of the source distribution. When +# building in-tree, this path is ".". When building out-of-tree, this path +# is path used to identify the location of configure. We also allow the +# includer of config.mk to override this value by setting DIST_PATH prior +# to including this file. This override option is employed, for example, +# when common.mk (and therefore config.mk) is included by the Makefile +# local to the 'testsuite' directory, or the 'test' directory containing # individual test drivers. ifeq ($(strip $(DIST_PATH)),) DIST_PATH := @dist_path@ @@ -104,12 +106,13 @@ DEBUG_TYPE := @debug_type@ # The requested threading model. THREADING_MODEL := @threading_model@ -# The install libdir and includedir values from configure tell us where to -# install the libraries and header files, respectively. Notice that we -# support the use of DESTDIR so that advanced users may install to a -# temporary location. +# The install libdir, includedir, and shareddir values from configure tell +# us where to install the libraries, header files, and public makefile +# fragments, respectively. Notice that we support the use of DESTDIR so that +# advanced users may install to a temporary location. INSTALL_LIBDIR := $(DESTDIR)@install_libdir@ INSTALL_INCDIR := $(DESTDIR)@install_incdir@ +INSTALL_SHAREDIR := $(DESTDIR)@install_sharedir@ # Whether to output verbose command-line feedback as the Makefile is # processed. diff --git a/common.mk b/common.mk index 157bcbb8d..a334e7668 100644 --- a/common.mk +++ b/common.mk @@ -101,7 +101,7 @@ get-noopt-cflags-for = $(strip $(CFLAGS_PRESET) \ $(call load-var-for,CLANGFLAGS,$(1)) \ $(call load-var-for,CPPROCFLAGS,$(1)) \ $(CTHREADFLAGS) \ - $(INCLUDE_PATHS) $(VERS_DEF) \ + $(CINCFLAGS) $(VERS_DEF) \ ) get-noopt-cxxflags-for = $(strip $(CFLAGS_PRESET) \ @@ -112,7 +112,7 @@ get-noopt-cxxflags-for = $(strip $(CFLAGS_PRESET) \ $(call load-var-for,CXXLANGFLAGS,$(1)) \ $(call load-var-for,CPPROCFLAGS,$(1)) \ $(CTHREADFLAGS) \ - $(INCLUDE_PATHS) $(VERS_DEF) \ + $(CINCFLAGS) $(VERS_DEF) \ ) get-refinit-cflags-for = $(strip $(call load-var-for,COPTFLAGS,$(1)) \ @@ -146,10 +146,10 @@ get-kernel-cflags-for = $(strip $(call load-var-for,CKOPTFLAGS,$(1)) \ # config_list == config_name if --enable-sandbox is given.) get-sandbox-c99flags-for = $(call load-var-for,COPTFLAGS,$(1)) \ $(call get-noopt-cflags-for,$(1)) \ - $(SANDBOX_INCLUDE_PATHS) + $(CSBOXINCFLAGS) get-sandbox-cxxflags-for = $(call load-var-for,COPTFLAGS,$(1)) \ $(call get-noopt-cxxflags-for,$(1)) \ - $(SANDBOX_INCLUDE_PATHS) + $(CSBOXINCFLAGS) get-noopt-text = "(CFLAGS for no optimization)" get-refinit-text-for = "('$(1)' CFLAGS for ref. kernel init)" @@ -177,16 +177,34 @@ files-that-dont-contain = $(strip $(foreach f, $(1), $(if $(findstring $(2),$(f) # --- Include makefile configuration file -------------------------------------- # -# The path to the directory in which BLIS was built. -ifeq ($(strip $(BUILD_PATH)),) -BUILD_PATH := . +# Use the current directory as the default path to the root directory for +# makefile fragments (and the configuration family's make_defs.mk), but +# allow the includer to override this value if it needs to point to an +# installation directory. +ifeq ($(strip $(SHARE_PATH)),) +SHARE_PATH := . endif # Define the name of the configuration file. CONFIG_MK_FILE := config.mk +# Identify the base path for the root directory for makefile fragments (and +# the configuration family's make_defs.mk). We define this path in terms of +# SHARE_PATH, which gets a default value above (which is what happens for the +# top-level Makefile). If SHARE_PATH is specified by the Makefile prior to +# including common.mk, that path is used instead. This allows Makefiles for +# example code and test drivers to reference an installed prefix directory +# for situations when the build directory no longer exists. +BASE_SHARE_PATH := $(SHARE_PATH) + # Include the configuration file. --include $(BUILD_PATH)/$(CONFIG_MK_FILE) +-include $(BASE_SHARE_PATH)/$(CONFIG_MK_FILE) + + + +# +# --- Handle 'make clean' and friends without config.mk ------------------------ +# # Detect whether we actually got the configuration file. If we didn't, then # it is likely that the user has not yet generated it (via configure). @@ -213,12 +231,14 @@ DIST_PATH := . # because the statements that define UNINSTALL_LIBS and UNINSTALL_HEADERS, # when evaluated, result in running 'find' on the root directory--definitely # something we would like to avoid. -INSTALL_LIBDIR := $(HOME)/blis/lib -INSTALL_INCDIR := $(HOME)/blis/include +INSTALL_LIBDIR := $(HOME)/blis/lib +INSTALL_INCDIR := $(HOME)/blis/include +INSTALL_SHAREDIR := $(HOME)/blis/share endif + # # --- Primary makefile variable definitions ------------------------------------ # @@ -271,6 +291,11 @@ ALL_HDR_SUFS := $(sort $(FRAME_HDR_SUFS) \ ALL_H99_SUFS := $(sort $(FRAME_HDR_SUFS) \ $(SANDBOX_H99_SUFS) ) +# The names of scripts that check output from the BLAS test drivers and +# BLIS test suite. +BLASTEST_CHECK := check-blastest.sh +TESTSUITE_CHECK := check-blistest.sh + # The names of the testsuite input/configuration files. TESTSUITE_CONF_GEN := input.general TESTSUITE_CONF_OPS := input.operations @@ -296,11 +321,11 @@ SANDBOX_PATH := $(DIST_PATH)/$(SANDBOX_DIR) # Construct paths to the makefile fragments for the four primary directories # of source code: the config directory, general framework code, reference # kernel code, and optimized kernel code. -CONFIG_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(CONFIG_DIR) -FRAME_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(FRAME_DIR) -REFKERN_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(REFKERN_DIR) -KERNELS_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(KERNELS_DIR) -SANDBOX_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(SANDBOX_DIR) +CONFIG_FRAG_PATH := ./obj/$(CONFIG_NAME)/$(CONFIG_DIR) +FRAME_FRAG_PATH := ./obj/$(CONFIG_NAME)/$(FRAME_DIR) +REFKERN_FRAG_PATH := ./obj/$(CONFIG_NAME)/$(REFKERN_DIR) +KERNELS_FRAG_PATH := ./obj/$(CONFIG_NAME)/$(KERNELS_DIR) +SANDBOX_FRAG_PATH := ./obj/$(CONFIG_NAME)/$(SANDBOX_DIR) @@ -308,12 +333,24 @@ SANDBOX_FRAG_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME)/$(SANDBOX_DIR) # --- Library name and local paths --------------------------------------------- # +# Use lib/CONFIG_NAME as the default path to the local header files, but +# allow the includer to override this value if it needs to point to an +# installation directory. +ifeq ($(strip $(LIB_PATH)),) +LIB_PATH := $(LIB_DIR)/$(CONFIG_NAME) +endif + +# Identify the base path for the intermediate library directory. We define +# this path in terms of LIB_PATH, which gets a default value above (which is +# what happens for the top-level Makefile). If LIB_PATH is specified by the +# Makefile prior to including common.mk, that path is used instead. This +# allows Makefiles for example code and test drivers to reference an installed +# prefix directory for situations when the build directory no longer exists. +BASE_LIB_PATH := $(LIB_PATH) + # The base name of the BLIS library that we will build. LIBBLIS := libblis -# Construct the base path for the library. -BASE_LIB_PATH := ./$(LIB_DIR)/$(CONFIG_NAME) - # The shared (dynamic) library file suffix is different for Linux and OS X. ifeq ($(OS_NAME),Darwin) SHLIB_EXT := dylib @@ -415,9 +452,11 @@ endif # Decide which library to link to for things like the testsuite and BLIS test # drivers. We default to the static library, unless only the shared library was # enabled, in which case we use the shared library. +LIBBLIS_L := $(LIBBLIS_A) LIBBLIS_LINK := $(LIBBLIS_A_PATH) ifeq ($(MK_ENABLE_SHARED),yes) ifeq ($(MK_ENABLE_STATIC),no) +LIBBLIS_L := $(LIBBLIS_SO) LIBBLIS_LINK := $(LIBBLIS_SO_PATH) LDFLAGS += -Wl,-rpath,$(BASE_LIB_PATH) endif @@ -432,7 +471,7 @@ endif # makefile definitions. MAKE_DEFS_FILE := make_defs.mk -# Assembly a list of all configuration family members, including the +# Assemble a list of all configuration family members, including the # configuration family name itself. Note that sort() will remove duplicates # for situations where CONFIG_NAME is present in CONFIG_LIST, such as would # be the case for singleton families. @@ -442,7 +481,11 @@ CONFIG_LIST_FAM := $(sort $(strip $(CONFIG_LIST) $(CONFIG_NAME))) # resides in a separate configuration sub-directory. We use CONFIG_LIST_FAM # since we might need the makefile definitions associated with the # configuration family (if it is an umbrella family). -CONFIG_PATHS := $(addprefix $(CONFIG_PATH)/, $(CONFIG_LIST_FAM)) +# NOTE: We use the prefix $(BASE_SHARE_PATH)/$(CONFIG_DIR)/ instead of +# $(CONFIG_PATH) so that make_defs.mk can be found when it is installed, +# provided the caller defined SHARE_PATH to that install directory. +CONFIG_PATHS := $(addprefix $(BASE_SHARE_PATH)/$(CONFIG_DIR)/, \ + $(CONFIG_LIST_FAM)) MAKE_DEFS_MK_PATHS := $(addsuffix /$(MAKE_DEFS_FILE), $(CONFIG_PATHS)) # Initialize the list of included (found) configurations to empty. @@ -628,8 +671,8 @@ CONFIG_PATHS := $(addprefix $(CONFIG_FRAG_PATH)/, $(CONFIG_LIST_FAM)) # This variable is used by the include statements as they recursively include # one another. For the 'config' directory, we initialize it to that directory # in preparation to include the fragments in the configuration sub-directory. -PARENT_PATH := $(CONFIG_FRAG_PATH) PARENT_SRC_PATH := $(CONFIG_PATH) +PARENT_PATH := $(CONFIG_FRAG_PATH) # Recursively include the makefile fragments in each of the sub-configuration # directories. @@ -644,8 +687,8 @@ KERNEL_PATHS := $(addprefix $(KERNELS_FRAG_PATH)/, $(KERNEL_LIST)) # This variable is used by the include statements as they recursively include # one another. For the 'kernels' directory, we initialize it to that directory # in preparation to include the fragments in the configuration sub-directory. -PARENT_PATH := $(KERNELS_FRAG_PATH) PARENT_SRC_PATH := $(KERNELS_PATH) +PARENT_PATH := $(KERNELS_FRAG_PATH) # Recursively include the makefile fragments in each of the kernels sub- # directories. @@ -658,8 +701,8 @@ PARENT_SRC_PATH := $(KERNELS_PATH) # one another. For the framework and reference kernel source trees (ie: the # 'frame' and 'ref_kernels' directories), we initialize it to the top-level # directory since that is its parent. -PARENT_PATH := $(BUILD_PATH)/obj/$(CONFIG_NAME) PARENT_SRC_PATH := $(DIST_PATH) +PARENT_PATH := $(OBJ_DIR)/$(CONFIG_NAME) # Recursively include all the makefile fragments in the directories for the # reference kernels and portable framework. @@ -677,8 +720,8 @@ SANDBOX_PATHS := $(addprefix $(SANDBOX_FRAG_PATH)/, $(SANDBOX)) # This variable is used by the include statements as they recursively include # one another. For the 'sandbox' directory, we initialize it to that directory # in preparation to include the fragments in the configuration sub-directory. -PARENT_PATH := $(SANDBOX_FRAG_PATH) PARENT_SRC_PATH := $(SANDBOX_PATH) +PARENT_PATH := $(SANDBOX_FRAG_PATH) # Recursively include the makefile fragments in the sandbox sub-directory. -include $(addsuffix /$(FRAGMENT_MK), $(SANDBOX_PATHS)) @@ -734,20 +777,26 @@ SANDBOX_HXX_FILES := $(call get-filepaths,$(SANDBOX_DIR_PATHS),$(SANDBOX_HXX_SUF SANDBOX_HDR_DIRPATHS := $(call get-dirpaths,$(SANDBOX_DIR_PATHS),$(ALL_HDR_SUFS)) -# Add -I to each header path so we can specify our include search paths to the -# C compiler. -# NOTE: We no longer need every header path in the source tree since we -# now #include the monolithic/flattened blis.h instead, and thus this -# line is commented out. -#INCLUDE_PATHS := $(strip $(patsubst %, -I%, $(ALL_HDR_DIRPATHS))) # # --- blis.h header definitions ------------------------------------------------ # -# Construct the base path for the intermediate include directory. -BASE_INC_PATH := $(BUILD_PATH)/$(INCLUDE_DIR)/$(CONFIG_NAME) +# Use include/CONFIG_NAME as the default path to the local header files, but +# allow the includer to override this value if it needs to point to an +# installation directory. +ifeq ($(strip $(INC_PATH)),) +INC_PATH := $(INCLUDE_DIR)/$(CONFIG_NAME) +endif + +# Identify the base path for the intermediate include directory. We define +# this path in terms of INC_PATH, which gets a default value above (which is +# what happens for the top-level Makefile). If INC_PATH is specified by the +# Makefile prior to including common.mk, that path is used instead. This +# allows Makefiles for example code and test drivers to reference an installed +# prefix directory for situations when the build directory no longer exists. +BASE_INC_PATH := $(INC_PATH) # Isolate the path to blis.h by filtering the file from the list of framework # header files. @@ -780,8 +829,10 @@ CBLAS_H_FLAT := $(BASE_INC_PATH)/$(CBLAS_H) # Obtain a list of header files #included inside of the bli_cntx_ref.c file. # Paths to these files will be needed when compiling with the monolithic # header. +ifeq ($(strip $(SHARE_PATH)),.) REF_KER_SRC := $(DIST_PATH)/$(REFKERN_DIR)/bli_cntx_ref.c REF_KER_HEADERS := $(shell $(GREP) "\#include" $(REF_KER_SRC) | sed -e "s/\#include [\"<]\([a-zA-Z0-9\_\.\/\-]*\)[\">].*/\1/g" | $(GREP) -v $(BLIS_H)) +endif # Match each header found above with the path to that header, and then strip # leading, trailing, and internal whitespace. @@ -795,11 +846,13 @@ REF_KER_I_PATHS := $(strip $(patsubst %, -I%, $(REF_KER_H_PATHS))) REF_KER_I_PATHS += -I$(DIST_PATH)/frame/include # Prefix the paths above with the base include path. -INCLUDE_PATHS := -I$(BASE_INC_PATH) $(REF_KER_I_PATHS) +# NOTE: We no longer need every header path in the source tree since we +# now #include the monolithic/flattened blis.h instead. +CINCFLAGS := -I$(BASE_INC_PATH) $(REF_KER_I_PATHS) # Obtain a list of header paths in the configured sandbox. Then add -I to each # header path. -SANDBOX_INCLUDE_PATHS := $(strip $(patsubst %, -I%, $(SANDBOX_HDR_DIRPATHS))) +CSBOXINCFLAGS := $(strip $(patsubst %, -I%, $(SANDBOX_HDR_DIRPATHS))) # diff --git a/configure b/configure index d611bea60..67e27b59d 100755 --- a/configure +++ b/configure @@ -73,9 +73,11 @@ print_usage() echo " -p PREFIX, --prefix=PREFIX" echo " " echo " The path to which make will install all build products." - echo " If given, this option implicitly sets LIBDIR to" - echo " PREFIX/lib and INCDIR to PREFIX/include (see below); if" - echo " not given, PREFIX defaults to \$(HOME)/blis. If PREFIX" + echo " If given, this option implies the following options:" + echo " --libdir=PREFIX/lib" + echo " --incdir=PREFIX/include" + echo " --sharedir=PREFIX/share" + echo " If not given, PREFIX defaults to \$(HOME)/blis. If PREFIX" echo " refers to a directory that does not exist, it will be" echo " created." echo " " @@ -95,6 +97,19 @@ print_usage() echo " defaults to PREFIX/include. If INCDIR refers to a" echo " directory that does not exist, it will be created." echo " " + echo " --sharedir=SHAREDIR" + echo " " + echo " The path to which make will makefile fragments containing" + echo " make variables determined by configure (e.g. CC, CFLAGS," + echo " and LDFLAGS). These files allow certain BLIS makefiles," + echo " such as those in the examples or testsuite directories, to" + echo " operate on an installed copy of BLIS rather than a local" + echo " (and possibly uninstalled) copy. If given, SHAREDIR will" + echo " override the corresponding directory implied by --prefix;" + echo " if not given, SHAREDIR defaults to PREFIX/share. If" + echo " SHAREDIR refers to a directory that does not exist, it" + echo " will be created." + echo " " echo " -d DEBUG, --enable-debug[=DEBUG]" echo " " echo " Enable debugging symbols in the library. If argument" @@ -1054,7 +1069,7 @@ blacklist_cleanup() echoerr_unsupportedcc() { - echoerr "*** Unsupported compiler version: ${cc_vendor} ${cc_version}." + echoerr "${script_name}: *** Unsupported compiler version: ${cc_vendor} ${cc_version}." exit 1 } @@ -1541,6 +1556,10 @@ main() install_incdir_user='' incdir_flag='' + # The user-given install sharedir and a flag indicating it was given. + install_sharedir_user='' + sharedir_flag='' + # The preset value of CFLAGS and LDFLAGS (ie: compiler and linker flags # to use in addition to those determined by the build system). cflags_preset='' @@ -1625,6 +1644,10 @@ main() incdir_flag=1 install_incdir_user=${OPTARG#*=} ;; + sharedir=*) + sharedir_flag=1 + install_sharedir_user=${OPTARG#*=} + ;; enable-debug) debug_flag=1 debug_type=noopt @@ -1790,7 +1813,7 @@ main() # If we didn't find any working C compilers, we print an error message. if [ -z "${found_cc}" ]; then - echo "${script_name}: Could not find working C compiler! Cannot continue." + echo "${script_name}: *** Could not find working C compiler! Cannot continue." exit 1 fi @@ -1853,6 +1876,7 @@ main() echo "${script_name}: could not open '${registry_file}' file; cannot continue." echo "${script_name}: BLIS distribution appears to be incomplete." + echo "${script_name}: *** Please verify source distribution." exit 1 fi @@ -2177,6 +2201,7 @@ main() # install prefix that was determined above. install_libdir=${install_prefix_user}/lib install_incdir=${install_prefix_user}/include + install_sharedir=${install_prefix_user}/share # Set the install libdir, if it was specified. Note that this will override # the default libdir implied by the install prefix, even if both options @@ -2192,16 +2217,27 @@ main() # override the default includedir implied by the install prefix, even if # both options were given. if [ -n "${incdir_flag}" ]; then - echo "${script_name}: detected --includedir='${install_incdir}'." + echo "${script_name}: detected --includedir='${install_incdir_user}'." install_incdir=${install_incdir_user} else echo "${script_name}: no install includedir option given; defaulting to PREFIX/include." fi + # Set the install sharedir, if it was specified. Note that this will + # override the default sharedir implied by the install prefix, even if + # both options were given. + if [ -n "${sharedir_flag}" ]; then + echo "${script_name}: detected --sharedir='${install_sharedir_user}'." + install_sharedir=${install_sharedir_user} + else + echo "${script_name}: no install sharedir option given; defaulting to PREFIX/share." + fi + # Echo the installation directories that we settled on. echo "${script_name}: final installation directories:" echo "${script_name}: libdir: ${install_libdir}" echo "${script_name}: includedir: ${install_incdir}" + echo "${script_name}: sharedir: ${install_sharedir}" # Check if CFLAGS is non-empty. if [ -n "${CFLAGS}" ]; then @@ -2262,7 +2298,7 @@ main() echo "${script_name}: building BLIS as a shared library (static library disabled)." else echo "${script_name}: Both static and shared libraries were disabled." - echo "${script_name}: Please enable one (or both) to continue." + echo "${script_name}: *** Please enable one (or both) to continue." exit 1 fi @@ -2291,7 +2327,7 @@ main() [ "x${threading_model}" = "xnone" ]; then echo "${script_name}: threading is disabled." else - echo "Unsupported threading model: ${threading_model}." + echo "${script_name}: *** Unsupported threading model: ${threading_model}." exit 1 fi @@ -2371,6 +2407,7 @@ main() if [ ! -d "${sandbox_fullpath}" ]; then echo "${script_name}: requested sandbox sub-directory does not exist! Cannot continue." + echo "${script_name}: *** Please verify sandbox existence and name." exit 1 fi @@ -2387,6 +2424,7 @@ main() # characters here so that the sed commands below do the right thing. install_libdir_esc=$(echo "${install_libdir}" | sed 's/\//\\\//g') install_incdir_esc=$(echo "${install_incdir}" | sed 's/\//\\\//g') + install_sharedir_esc=$(echo "${install_sharedir}" | sed 's/\//\\\//g') dist_path_esc=$(echo "${dist_path}" | sed 's/\//\\\//g') cc_esc=$(echo "${found_cc}" | sed 's/\//\\\//g') cxx_esc=$(echo "${found_cxx}" | sed 's/\//\\\//g') @@ -2442,8 +2480,10 @@ main() # directory and thus we must create a symbolic link. if [ ! -f "${dist_path}/${dummy_file}" ]; then configured_oot="yes" + #echo "${script_name}: detected out-of-tree build directory." else configured_oot="no" + #echo "${script_name}: detected in-tree build directory." fi # Remove the dummy file. @@ -2476,6 +2516,7 @@ main() | sed -e "s/@threading_model@/${threading_model}/g" \ | sed -e "s/@install_libdir@/${install_libdir_esc}/g" \ | sed -e "s/@install_incdir@/${install_incdir_esc}/g" \ + | sed -e "s/@install_sharedir@/${install_sharedir_esc}/g" \ | sed -e "s/@enable_verbose@/${enable_verbose}/g" \ | sed -e "s/@configured_oot@/${configured_oot}/g" \ | sed -e "s/@enable_arg_max_hack@/${enable_arg_max_hack}/g" \ @@ -2744,30 +2785,55 @@ main() # properly handle out-of-tree builds. if [ "${configured_oot}" = "yes" ]; then - # If 'Makefile' does not already exist in the current directory, - # create a symbolic link to it. If one does exist, we us -f to - # force creation of a new link. + # If 'Makefile' symlink does not already exist in the current + # directory, create a symbolic link to it. If one does exist, we + # use -f to force creation of a new link. if [ ! -e "./Makefile" ]; then echo "${script_name}: creating symbolic link to Makefile." ln -s "${dist_path}/Makefile" - else + elif [ -h "./Makefile" ]; then echo "${script_name}: symbolic link to Makefile already exists; forcing creation of new link." ln -sf "${dist_path}/Makefile" + else + echo "${script_name}: Non-symbolic link file or directory 'Makefile' blocks creation of symlink." + echo "${script_name}: *** Please remove this entity and re-run configure." + exit 1 fi - # If 'common.mk' does not already exist in the current directory, - # create a symbolic link to it. If one does exist, we us -f to - # force creation of a new link. + # If 'common.mk' symlink does not already exist in the current + # directory, create a symbolic link to it. If one does exist, we + # use -f to force creation of a new link. if [ ! -e "./common.mk" ]; then echo "${script_name}: creating symbolic link to common.mk." ln -s "${dist_path}/common.mk" - else + elif [ -h "./common.mk" ]; then echo "${script_name}: symbolic link to common.mk already exists; forcing creation of new link." ln -sf "${dist_path}/common.mk" + else + echo "${script_name}: Non-symbolic link file or directory 'common.mk' blocks creation of symlink." + echo "${script_name}: *** Please remove this entity and re-run configure." + exit 1 + fi + + # If 'config' symlink does not already exist in the current + # directory, create a symbolic link to it. If one does exist, we + # use -f to force creation of a new link. + if [ ! -e "./config" ]; then + + echo "${script_name}: creating symbolic link to 'config' directory." + ln -s "${dist_path}/config" + + elif [ -h "./config" ]; then + echo "${script_name}: symbolic link to 'config' directory already exists; forcing creation of new link." + ln -sf "${dist_path}/config" + else + echo "${script_name}: Non-symbolic link file or directory 'config' blocks creation of symlink." + echo "${script_name}: *** Please remove this entity and re-run configure." + exit 1 fi echo "${script_name}: configured to build outside of source distribution." diff --git a/docs/Testsuite.md b/docs/Testsuite.md index b6682622f..621fd4b1a 100644 --- a/docs/Testsuite.md +++ b/docs/Testsuite.md @@ -35,18 +35,11 @@ As you would expect, the test suite's source code lives in `src` and the object ## Compiling -Before running the test suite, you must first configure, compile, and install a BLIS library. For directions on how to build and install a BLIS library, please see the [Build System](BuildSystem.md) guide. +Before running the test suite, you must first configure and compile BLIS. (Installing BLIS is not necessary to run the test suite, though it is supported.) For directions on how to build and install a BLIS library, please see the [Build System](BuildSystem.md) guide. Once BLIS is installed, you are ready to compile the test suite. -**Note:** The `Makefile` includes the same `make_defs.mk` file that was used by the top-level `Makefile` when building BLIS. This is meant to serve as a convenience so you don't have to specify things like the C compiler or compiler flags a second time. If you do wish to tweak these parameters, you may override the values included from `make_defs.mk` by editing the local `Makefile` within the `testsuite` directory. Scroll down to the section labeled "Optional overrides" and uncomment/edit values as needed. - -Unless special circumstances apply in your situation (such as the optional overrides mentioned above), the only value you may have to modify in `testsuite/Makefile` (if any) is the linker library flags variable, `LDFLAGS`. You may need to modify it to include the path to your standard C libraries, such as `libm` (oftentimes communicated to the linker via `-lm`): -``` -LDFLAGS := -L/path/to/system/libs -lm -``` - -When you are ready to compile, simply run `make`. Running `make` will result in output similar to: +When you are ready to compile, simply run `make` from within the `testsuite` directory. Running `make` will result in output similar to: : ``` $ make @@ -71,6 +64,21 @@ $ ls Makefile input.general input.operations obj src test_libblis.x ``` +### Compiling/linking aginst an installed copy of BLIS + +By default, the `Makefile` in the `testsuite` directory is programmed to look in +`../include//` for `blis.h` and `../lib//` for the BLIS library. However, some users may wish to run the testsuite after installing BLIS and deleting the entire source tree. In this situation, it is necessary to point `make` to the location of your BLIS installation (i.e., the installation prefix). If you would like to compile with an installed header and link against an installed library, you have two options: +1. First, you may set the envrionment variable `BLIS_INSTALL_PATH` to the install prefix used when BLIS was installed, and then run `make`. In this example, we assume that BLIS was installed after running the `configure` script with the `--prefix=/usr/local` option. + ``` + $ export BLIS_INSTALL_PATH=/usr/local + $ make + ``` +2. Alternatively, you may set the `make` variable `BLIS_INSTALL_PATH` on the command line as you execute `make`: + ``` + $ make BLIS_INSTALL_PATH=/usr/local + ``` +Both options result in the same outcome: `make` looks for the BLIS installation in `BLIS_INSTALL_PATH` when building the test suite. + ## Setting test parameters The BLIS test suite reads two input files, `input.general` and `input.operations`, to determine which tests to run and how those tests are run. Each file is contains comments and thus you may find them intuitive to use without formal instructions. However, for completeness and as a reference-of-last-resort, we describe each file and its contents in detail. @@ -81,7 +89,7 @@ The `input.general` input file, as its name suggests, contains parameters that c ``` # ---------------------------------------------------------------------- # -# input.general +# input.general # BLIS test suite # # This file contains input values that control how BLIS operations are @@ -130,7 +138,7 @@ _**Number of repeats.**_ This is the number of times an operation is run for eac _**Matrix storage scheme.**_ This string encodes all of the matrix storage schemes that are tested (for operations that contain matrix operands). There are three valid values: `'c'` for column storage, `'r'` for row storage, and `'g'` for general stride storage. You may choose one storage scheme, or combine more than one. The order of the characters determines the order in which the corresponding storage schemes are tested. -_**Vector storage scheme.**_ Similar to the matrix storage scheme string, this string determines which vector storage schemes are tested (for operations that contain vector operands). There are four valid values: `'c'` for column vectors with unit stride, `'r'` for row vectors with unit stride, `'j'` for column vectors with non-unit stride, and `'i'` for row vectors with non-unit stride. You may choose any one storage scheme, or combine more than one. The ordering behaves similarly to that of the matrix storage scheme string. Using `cj` will test both unit and non-unit vector strides, and since row and column vectors are logically equivalent, this should provide complete test coverage for operations with vector operands. +_**Vector storage scheme.**_ Similar to the matrix storage scheme string, this string determines which vector storage schemes are tested (for operations that contain vector operands). There are four valid values: `'c'` for column vectors with unit stride, `'r'` for row vectors with unit stride, `'j'` for column vectors with non-unit stride, and `'i'` for row vectors with non-unit stride. You may choose any one storage scheme, or combine more than one. The ordering behaves similarly to that of the matrix storage scheme string. Using `cj` will test both unit and non-unit vector strides, and since row and column vectors are logically equivalent, this should provide complete test coverage for operations with vector operands. _**Test all combinations of storage schemes?**_ Enabling this option causes all combinations of storage schemes to be tested. For example, if the option is disabled, a matrix storage scheme string of `cr` would cause the `gemm` test module to test execution where all matrix operands are column-stored, and then where all matrix operands are row-stored. Enabling this option with the same matrix storage string (`cr`) would cause the test suite to test `gemm` under all eight scenarios where the three `gemm` matrix operands are either column-stored or row-stored. @@ -298,7 +306,7 @@ Running zblat3.x < 'input/zblat3.in' (output to 'out.zblat3') ``` The results can quickly be checked via a script in the top-level `build` directory: ``` -$ ../build/check-blastest.sh +$ ../build/check-blastest.sh All BLAS tests passed! ``` This is the message we expect when everything works as expected. diff --git a/examples/oapi/Makefile b/examples/oapi/Makefile index 08964e479..bc98ebc9f 100644 --- a/examples/oapi/Makefile +++ b/examples/oapi/Makefile @@ -37,7 +37,7 @@ # # Field G. Van Zee # -# Makefile for BLIS testsuite. +# Makefile for BLIS object API example code. # # @@ -49,13 +49,35 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../.. -BUILD_PATH := ../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../.. +LIB_PATH = ../../lib/$(CONFIG_NAME) +INC_PATH = ../../include/$(CONFIG_NAME) +SHARE_PATH := ../.. +endif + +#ifneq ($(strip $(BLIS_LIB_PATH)),) +#LIB_PATH := $(BLIS_LIB_PATH) +#endif +# +#ifneq ($(strip $(BLIS_INC_PATH)),) +#INC_PATH := $(BLIS_INC_PATH) +#endif +# +#ifneq ($(strip $(BLIS_SHARE_PATH)),) +#SHARE_PATH := $(BLIS_SHARE_PATH) +#endif @@ -63,23 +85,8 @@ BUILD_PATH := ../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -#ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -#COMMON_MK_PRESENT := yes -#else -#COMMON_MK_PRESENT := no -#endif +-include $(SHARE_PATH)/common.mk @@ -95,6 +102,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the "framework" CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -102,7 +114,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Binary executable name. TEST_BINS := 00obj_basic.x \ @@ -131,23 +143,18 @@ bin: $(TEST_BINS) # --- Environment check rules --- -# -#check-env: check-env-make-defs check-env-fragments check-env-mk -# -#check-env-mk: -#ifeq ($(CONFIG_MK_PRESENT),no) -# $(error Cannot proceed: config.mk not detected! Run configure first) -#endif -# -#check-env-fragments: check-env-mk -#ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no) -# $(error Cannot proceed: makefile fragments not detected! Run configure first) -#endif -# -#check-env-make-defs: check-env-fragments -#ifeq ($(MAKE_DEFS_MK_PRESENT),no) -# $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) -#endif + +check-env: check-env-make-defs check-env-fragments check-env-config-mk + +check-env-config-mk: +ifeq ($(CONFIG_MK_PRESENT),no) + $(error Cannot proceed: config.mk not detected! Run configure first) +endif + +check-env-make-defs: check-env-fragments +ifeq ($(MAKE_DEFS_MK_PRESENT),no) + $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) +endif # --Object file rules -- diff --git a/examples/oapi/README b/examples/oapi/README index adf7ded9d..5823b2945 100644 --- a/examples/oapi/README +++ b/examples/oapi/README @@ -11,10 +11,19 @@ starts in '00'). You can build all of the examples by simply running 'make' from this directory. (You can also run 'make clean'.) The makefile assumes that you've already configured and built (but not necessarily installed) BLIS -two directories up, in "../..". Once the executable files have been built, -we recommend reading the code in one terminal window alongside the -executable output in another. This will help you see the effects of each -section of code. +two directories up, in "../..". If you have already installed BLIS to +some permanent directory, you may refer to that installation by setting +the environment variable BLIS_INSTALL_PATH prior to running make: + + export BLIS_INSTALL_PATH=/usr/local; make + +or by setting the same variable as part of the make command: + + make BLIS_INSTALL_PATH=/usr/local + +Once the executable files have been built, we recommend reading the code in +one terminal window alongside the executable output in another. This will +help you see the effects of each section of code. This tutorial is not exhaustive or complete; several object API functions were omitted (mostly for brevity's sake) and thus more examples could be diff --git a/examples/tapi/Makefile b/examples/tapi/Makefile index e79fa1ea1..1c4c89ae2 100644 --- a/examples/tapi/Makefile +++ b/examples/tapi/Makefile @@ -37,7 +37,7 @@ # # Field G. Van Zee # -# Makefile for BLIS testsuite. +# Makefile for BLIS typed API example code. # # @@ -49,13 +49,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../.. -BUILD_PATH := ../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../.. +LIB_PATH = ../../lib/$(CONFIG_NAME) +INC_PATH = ../../include/$(CONFIG_NAME) +SHARE_PATH := ../.. +endif @@ -63,23 +73,8 @@ BUILD_PATH := ../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -#ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -#COMMON_MK_PRESENT := yes -#else -#COMMON_MK_PRESENT := no -#endif +-include $(SHARE_PATH)/common.mk @@ -95,6 +90,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the "framework" CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -102,7 +102,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Binary executable name. TEST_BINS := 00level1v.x \ @@ -126,23 +126,18 @@ bin: $(TEST_BINS) # --- Environment check rules --- -# -#check-env: check-env-make-defs check-env-fragments check-env-mk -# -#check-env-mk: -#ifeq ($(CONFIG_MK_PRESENT),no) -# $(error Cannot proceed: config.mk not detected! Run configure first) -#endif -# -#check-env-fragments: check-env-mk -#ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no) -# $(error Cannot proceed: makefile fragments not detected! Run configure first) -#endif -# -#check-env-make-defs: check-env-fragments -#ifeq ($(MAKE_DEFS_MK_PRESENT),no) -# $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) -#endif + +check-env: check-env-make-defs check-env-fragments check-env-config-mk + +check-env-config-mk: +ifeq ($(CONFIG_MK_PRESENT),no) + $(error Cannot proceed: config.mk not detected! Run configure first) +endif + +check-env-make-defs: check-env-fragments +ifeq ($(MAKE_DEFS_MK_PRESENT),no) + $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) +endif # --Object file rules -- diff --git a/examples/tapi/README b/examples/tapi/README index 0200c283a..ad0978782 100644 --- a/examples/tapi/README +++ b/examples/tapi/README @@ -11,10 +11,19 @@ starts in '00'). You can build all of the examples by simply running 'make' from this directory. (You can also run 'make clean'.) The makefile assumes that you've already configured and built (but not necessarily installed) BLIS -two directories up, in "../..". Once the executable files have been built, -we recommend reading the code in one terminal window alongside the -executable output in another. This will help you see the effects of each -section of code. +two directories up, in "../..". If you have already installed BLIS to +some permanent directory, you may refer to that installation by setting +the environment variable BLIS_INSTALL_PATH prior to running make: + + export BLIS_INSTALL_PATH=/usr/local; make + +or by setting the same variable as part of the make command: + + make BLIS_INSTALL_PATH=/usr/local + +Once the executable files have been built, we recommend reading the code in +one terminal window alongside the executable output in another. This will +help you see the effects of each section of code. This tutorial is not exhaustive or complete; many typed API functions were omitted (mostly for brevity's sake) and thus more examples could be diff --git a/frame/compat/bli_blas.h b/frame/compat/bli_blas.h index 3f2d4662e..6aa0759a0 100644 --- a/frame/compat/bli_blas.h +++ b/frame/compat/bli_blas.h @@ -32,16 +32,17 @@ */ +// If the CBLAS compatibility layer was enabled while the BLAS layer +// was not enabled, we must enable it here. #ifdef BLIS_ENABLE_CBLAS - -// If the BLAS compatibility layer was not explicitly enabled, we must -// enable it here. #ifndef BLIS_ENABLE_BLAS #define BLIS_ENABLE_BLAS #endif - #endif // BLIS_ENABLE_CBLAS +// Skip prototyping all of the BLAS if the BLAS test drivers are being +// compiled. +#ifndef BLIS_VIA_BLASTEST #ifdef BLIS_ENABLE_BLAS @@ -175,3 +176,4 @@ #endif // BLIS_ENABLE_BLAS +#endif // BLIS_VIA_BLASTEST diff --git a/frame/include/bli_f2c.h b/frame/include/bli_f2c.h index 24a10c59e..ec1b94762 100644 --- a/frame/include/bli_f2c.h +++ b/frame/include/bli_f2c.h @@ -41,13 +41,15 @@ typedef unsigned long long ulongint; // system-dependent #ifdef f2c_i2 // for -i2 -typedef short flag; -typedef short ftnlen; -typedef short ftnint; +//typedef short flag; +//typedef short ftnlen; +typedef bla_integer ftnlen; +//typedef short ftnint; #else -typedef long int flag; -typedef long int ftnlen; -typedef long int ftnint; +//typedef long int flag; +//typedef long int ftnlen; +typedef bla_integer ftnlen; +//typedef long int ftnint; #endif #ifndef VOID diff --git a/mpi_test/Makefile b/mpi_test/Makefile index 2d2df10b7..ed904cbb8 100644 --- a/mpi_test/Makefile +++ b/mpi_test/Makefile @@ -50,66 +50,29 @@ -# -# --- Makefile initialization -------------------------------------------------- -# - -# Define the name of the configuration file. -CONFIG_MK_FILE := config.mk - -# Define the name of the file containing build and architecture-specific -# makefile definitions. -MAKE_DEFS_FILE := make_defs.mk - -# Locations of important files. -ROOT_PATH := .. -CONFIG_DIR := config - - - -# -# --- Include makefile configuration file -------------------------------------- -# - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -CONFIG_MK_PATH := $(ROOT_PATH)/$(CONFIG_MK_FILE) - -# Include the configuration file. --include $(CONFIG_MK_PATH) - -# Detect whether we actually got the configuration file. If we didn't, then -# it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(CONFIG_MK_INCLUDED)),yes) -CONFIG_MK_PRESENT := yes +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis else -CONFIG_MK_PRESENT := no +DIST_PATH := .. +LIB_PATH = ../lib/$(CONFIG_NAME) +INC_PATH = ../include/$(CONFIG_NAME) +SHARE_PATH := .. endif -# Now we have access to CONFIG_NAME, which tells us which sub-directory of the -# config directory to use as our configuration. -CONFIG_PATH := $(ROOT_PATH)/$(CONFIG_DIR)/$(CONFIG_NAME) - # -# --- Include makefile definitions file ---------------------------------------- +# --- Include common makefile definitions -------------------------------------- # -# Construct the path to the makefile definitions file residing inside of -# the configuration sub-directory. -MAKE_DEFS_MK_PATH := $(CONFIG_PATH)/$(MAKE_DEFS_FILE) - -# Include the makefile definitions file. --include $(MAKE_DEFS_MK_PATH) - -# Detect whether we actually got the make definitios file. If we didn't, then -# it is likely that the configuration is invalid (or incomplete). -ifeq ($(strip $(MAKE_DEFS_MK_INCLUDED)),yes) -MAKE_DEFS_MK_PRESENT := yes -else -MAKE_DEFS_MK_PRESENT := no -endif +# Include the common makefile fragment. +-include $(SHARE_PATH)/common.mk @@ -117,13 +80,6 @@ endif # --- BLAS and LAPACK implementations ------------------------------------------ # -# BLIS library and header path. This is simply wherever it was installed. -BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis - -# BLIS library. -BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a - # BLAS library path(s). This is where the BLAS libraries reside. BLAS_LIB_PATH := $(HOME)/flame/lib MKL_LIB_PATH := $(HOME)/intel/mkl/lib/intel64/ @@ -166,15 +122,19 @@ TEST_OBJS := $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c)) -# Override CFLAGS from make_defs.mk here, if desired. -#CFLAGS := -g -O2 -march=native +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) -# Add installed and local header paths to CFLAGS -CFLAGS += -I$(BLIS_INC_PATH) -I$(TEST_SRC_PATH) +# Use the "framework" CFLAGS for the configuration family. +CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) -LINKER := $(CC) -#LDFLAGS := -L/home/00146/field/gnu/gcc-4.8.2/lib64 -#LDFLAGS += -lgfortran -lm -lpthread +# Add local header paths to CFLAGS +CFLAGS += -I$(TEST_SRC_PATH) + +# Locate the libblis library to which we will link. +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) @@ -295,23 +255,23 @@ test_%_blis.o: test_%.c # compatibility layer. This prevents BLIS from inadvertently getting called # for the BLAS routines we are trying to test with. -test_%_openblas.x: test_%_openblas.o $(BLIS_LIB) - $(LINKER) $< $(OPENBLAS_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_openblas.x: test_%_openblas.o $(LIBBLIS_LINK) + $(LINKER) $< $(OPENBLAS_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ -test_%_atlas.x: test_%_atlas.o $(BLIS_LIB) - $(LINKER) $< $(ATLAS_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_atlas.x: test_%_atlas.o $(LIBBLIS_LINK) + $(LINKER) $< $(ATLAS_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ -test_%_mkl.x: test_%_mkl.o $(BLIS_LIB) - $(LINKER) $< $(MKL_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_mkl.x: test_%_mkl.o $(LIBBLIS_LINK) + $(LINKER) $< $(MKL_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ -test_%_essl.x: test_%_essl.o $(BLIS_LIB) - $(LINKER) $< $(ESSL_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_essl.x: test_%_essl.o $(LIBBLIS_LINK) + $(LINKER) $< $(ESSL_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ -test_%_mac.x: test_%_mac.o $(BLIS_LIB) - $(LINKER) $< $(MAC_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_mac.x: test_%_mac.o $(LIBBLIS_LINK) + $(LINKER) $< $(MAC_LIB) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ -test_%_blis.x: test_%_blis.o $(BLIS_LIB) - $(LINKER) $< $(BLIS_LIB) $(LDFLAGS) -o $@ +test_%_blis.x: test_%_blis.o $(LIBBLIS_LINK) + $(LINKER) $< $(LIBBLIS_LINK) $(LDFLAGS) -o $@ # -- Clean rules -- diff --git a/test/3m4m/Makefile b/test/3m4m/Makefile index ca0ac7721..151a13ee6 100644 --- a/test/3m4m/Makefile +++ b/test/3m4m/Makefile @@ -52,13 +52,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../.. -BUILD_PATH := ../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../.. +LIB_PATH = ../../lib/$(CONFIG_NAME) +INC_PATH = ../../include/$(CONFIG_NAME) +SHARE_PATH := ../.. +endif @@ -66,23 +76,8 @@ BUILD_PATH := ../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif +-include $(SHARE_PATH)/common.mk @@ -92,7 +87,7 @@ endif # BLIS library and header path. This is simply wherever it was installed. #BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis +#BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis # BLIS library. #BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a @@ -154,6 +149,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the "framework" CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -161,7 +161,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Datatype diff --git a/test/Makefile b/test/Makefile index 78830b5a7..454440fd8 100644 --- a/test/Makefile +++ b/test/Makefile @@ -52,13 +52,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := .. -BUILD_PATH := .. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := .. +LIB_PATH = ../lib/$(CONFIG_NAME) +INC_PATH = ../include/$(CONFIG_NAME) +SHARE_PATH := .. +endif @@ -66,23 +76,8 @@ BUILD_PATH := .. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif +-include $(SHARE_PATH)/common.mk @@ -92,7 +87,7 @@ endif # BLIS library and header path. This is simply wherever it was installed. #BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis +#BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis # BLIS library. #BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a @@ -143,6 +138,11 @@ TEST_OBJS := $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c)) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -150,7 +150,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) diff --git a/test/exec_sizes/Makefile b/test/exec_sizes/Makefile index 3db90554c..e05b81b88 100644 --- a/test/exec_sizes/Makefile +++ b/test/exec_sizes/Makefile @@ -51,13 +51,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../.. -BUILD_PATH := ../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../.. +LIB_PATH = ../../lib/$(CONFIG_NAME) +INC_PATH = ../../include/$(CONFIG_NAME) +SHARE_PATH := ../.. +endif @@ -65,23 +75,8 @@ BUILD_PATH := ../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif +-include $(SHARE_PATH)/common.mk @@ -91,7 +86,7 @@ endif # BLIS library and header path. This is simply wherever it was installed. #BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis +#BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis # BLIS library. #BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a @@ -136,6 +131,11 @@ TEST_OBJ_PATH := . ## Gather all local source files. TEST_SIZES_SRC := test_size.c +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -143,7 +143,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) diff --git a/test/studies/skx/Makefile b/test/studies/skx/Makefile index c978c6427..d669cf1ec 100644 --- a/test/studies/skx/Makefile +++ b/test/studies/skx/Makefile @@ -57,14 +57,20 @@ -# -# --- Distribution path override ----------------------------------------------- -# - -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../../.. -BUILD_PATH := ../../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../../.. +LIB_PATH = ../../../lib/$(CONFIG_NAME) +INC_PATH = ../../../include/$(CONFIG_NAME) +SHARE_PATH := ../../.. +endif @@ -72,23 +78,8 @@ BUILD_PATH := ../../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif +-include $(SHARE_PATH)/common.mk @@ -165,6 +156,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the "framework" CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -172,7 +168,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -g -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Datatype diff --git a/test/thread_ranges/Makefile b/test/thread_ranges/Makefile index 02dd00365..66533543f 100644 --- a/test/thread_ranges/Makefile +++ b/test/thread_ranges/Makefile @@ -51,13 +51,23 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := ../.. -BUILD_PATH := ../.. +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := ../.. +LIB_PATH = ../../lib/$(CONFIG_NAME) +INC_PATH = ../../include/$(CONFIG_NAME) +SHARE_PATH := ../.. +endif @@ -65,36 +75,8 @@ BUILD_PATH := ../.. # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif - - - -# -# --- BLAS and LAPACK implementations ------------------------------------------ -# - -# BLIS library and header path. This is simply wherever it was installed. -#BLIS_LIB_PATH := $(INSTALL_PREFIX)/lib -BLIS_INC_PATH := $(INSTALL_PREFIX)/include/blis - -# BLIS library. -#BLIS_LIB := $(BLIS_LIB_PATH)/libblis.a +-include $(SHARE_PATH)/common.mk @@ -110,6 +92,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -117,7 +104,7 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Datatype diff --git a/testsuite/Makefile b/testsuite/Makefile index 649d4f2ce..a4115a5fc 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -51,37 +51,31 @@ # -# --- Distribution path override ----------------------------------------------- +# --- Determine makefile fragment location ------------------------------------- # -# Override the default DIST_PATH and BUILD_PATH values so that make can find -# the source distribution and build location. -DIST_PATH := .. -BUILD_PATH := .. - +# Comments: +# - DIST_PATH is assumed to not exist if BLIS_INSTALL_PATH is given. +# - We must use recursively expanded assignment for LIB_PATH and INC_PATH in +# the second case because CONFIG_NAME is not yet set. +ifneq ($(strip $(BLIS_INSTALL_PATH)),) +LIB_PATH := $(BLIS_INSTALL_PATH)/lib +INC_PATH := $(BLIS_INSTALL_PATH)/include/blis +SHARE_PATH := $(BLIS_INSTALL_PATH)/share/blis +else +DIST_PATH := .. +LIB_PATH = ../lib/$(CONFIG_NAME) +INC_PATH = ../include/$(CONFIG_NAME) +SHARE_PATH := .. +endif # # --- Include common makefile definitions -------------------------------------- # -# Define the name of the common makefile fragment. -COMMON_MK_FILE := common.mk - -# Construct the path to the makefile configuration file that was generated by -# the configure script. -COMMON_MK_PATH := $(DIST_PATH)/$(COMMON_MK_FILE) - # Include the common makefile fragment. --include $(COMMON_MK_PATH) - -# Detect whether we actually got the common makefile fragment. If we didn't, -# then it is likely that the user has not yet generated it (via configure). -ifeq ($(strip $(COMMON_MK_INCLUDED)),yes) -COMMON_MK_PRESENT := yes -else -COMMON_MK_PRESENT := no -endif +-include $(SHARE_PATH)/common.mk @@ -97,6 +91,11 @@ TEST_OBJS := $(sort $(patsubst $(TEST_SRC_PATH)/%.c, \ $(TEST_OBJ_PATH)/%.o, \ $(wildcard $(TEST_SRC_PATH)/*.c))) +# Override the value of CINCFLAGS so that the value of CFLAGS returned by +# get-frame-cflags-for() is not cluttered up with include paths needed only +# while building BLIS. +CINCFLAGS := -I$(INC_PATH) + # Use the "framework" CFLAGS for the configuration family. CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) @@ -104,10 +103,10 @@ CFLAGS := $(call get-frame-cflags-for,$(CONFIG_NAME)) CFLAGS += -I$(TEST_SRC_PATH) # Locate the libblis library to which we will link. -LIBBLIS_LINK := $(BUILD_PATH)/$(LIBBLIS_LINK) +LIBBLIS_LINK := $(LIB_PATH)/$(LIBBLIS_L) # Binary executable name. -TEST_BIN := test_libblis.x +TESTSUITE_BIN := test_libblis.x @@ -119,23 +118,18 @@ TEST_BIN := test_libblis.x all: check-env bin -bin: check-env $(TEST_BIN) +bin: check-env $(TESTSUITE_BIN) # --- Environment check rules --- -check-env: check-env-make-defs check-env-fragments check-env-mk +check-env: check-env-make-defs check-env-fragments check-env-config-mk -check-env-mk: +check-env-config-mk: ifeq ($(CONFIG_MK_PRESENT),no) $(error Cannot proceed: config.mk not detected! Run configure first) endif -check-env-fragments: check-env-mk -ifeq ($(MAKEFILE_FRAGMENTS_PRESENT),no) - $(error Cannot proceed: makefile fragments not detected! Run configure first) -endif - check-env-make-defs: check-env-fragments ifeq ($(MAKE_DEFS_MK_PRESENT),no) $(error Cannot proceed: make_defs.mk not detected! Invalid configuration) @@ -155,7 +149,7 @@ endif # -- Executable file rules -- -$(TEST_BIN): $(TEST_OBJS) $(LIBBLIS_LINK) +$(TESTSUITE_BIN): $(TEST_OBJS) $(LIBBLIS_LINK) ifeq ($(ENABLE_VERBOSE),yes) $(LINKER) $(TEST_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ else @@ -163,13 +157,28 @@ else @$(LINKER) $(TEST_OBJS) $(LIBBLIS_LINK) $(LDFLAGS) -o $@ endif -# -- Test run rules -- -run: $(TEST_BIN) - ./$(TEST_BIN) +# -- Test run/check rules -- + +run: $(TESTSUITE_BIN) +ifeq ($(ENABLE_VERBOSE),yes) + ./$(TESTSUITE_BIN) > $(TESTSUITE_OUT_FILE) + +else + @echo "Running $(TESTSUITE_BIN) with output redirected to '$(TESTSUITE_OUT_FILE)'" + @./$(TESTSUITE_BIN) > $(TESTSUITE_OUT_FILE) +endif + +check: run +ifeq ($(ENABLE_VERBOSE),yes) + - $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) +else + @- $(TESTSUITE_CHECK) $(TESTSUITE_OUT_FILE) +endif + # -- Clean rules -- clean: - - $(RM_F) $(TEST_OBJS) $(TEST_BIN) + - $(RM_F) $(TEST_OBJS) $(TESTSUITE_BIN) diff --git a/build/check-blistest.sh b/testsuite/check-blistest.sh similarity index 97% rename from build/check-blistest.sh rename to testsuite/check-blistest.sh index 76daeb256..c434da0f7 100755 --- a/build/check-blistest.sh +++ b/testsuite/check-blistest.sh @@ -4,7 +4,7 @@ # An object-based framework for developing high-performance BLAS-like # libraries. # -# Copyright (C) 2015, The University of Texas at Austin +# Copyright (C) 2018, The University of Texas at Austin # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are diff --git a/travis/do_sde.sh b/travis/do_sde.sh index 3c13d6be1..6ec9febe5 100755 --- a/travis/do_sde.sh +++ b/travis/do_sde.sh @@ -34,7 +34,7 @@ for ARCH in penryn sandybridge haswell skx knl piledriver steamroller excavator else $SDE -cpuid_in $DIST_PATH/travis/cpuid/$ARCH.def -- ./test_libblis.x > output.testsuite fi - $DIST_PATH/build/check-blistest.sh ./output.testsuite + $DIST_PATH/testsuite/check-blistest.sh ./output.testsuite TMP=`grep "active sub-configuration" output.testsuite` CONFIG=${TMP##* } if [ "$CONFIG" != "$ARCH" ]; then diff --git a/travis/do_testsuite.sh b/travis/do_testsuite.sh index 0fa8341ec..9de91e888 100755 --- a/travis/do_testsuite.sh +++ b/travis/do_testsuite.sh @@ -9,7 +9,7 @@ export BLIS_IR_NT=1 export BLIS_JR_NT=1 make testblis -$DIST_PATH/build/check-blistest.sh ./output.testsuite +$DIST_PATH/testsuite/check-blistest.sh ./output.testsuite make testblas -$DIST_PATH/build/check-blastest.sh +$DIST_PATH/blastest/check-blastest.sh