Files
blis/test/3m4m/Makefile
Field G. Van Zee add16b0e54 Added 3m4m test driver subdir of 'test'.
Details:
- Added a modified test driver for [cz]gemm that will test all 3m/4m
  as well as assembly-based and OpenBLAS implementations of gemm
  in single and multithreaded modes.
2014-10-17 11:49:24 -05:00

369 lines
11 KiB
Makefile

#!/bin/bash
#
# BLIS
# An object-based framework for developing high-performance BLAS-like
# libraries.
#
# Copyright (C) 2014, 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
# met:
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - Neither the name of The University of Texas at Austin nor the names
# of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
#
# Makefile
#
# Field G. Van Zee
#
# Makefile for standalone BLIS test drivers.
#
#
# --- Makefile PHONY target definitions ----------------------------------------
#
.PHONY: all \
blis blis-mt openblas openblas-mt atlas mkl \
clean cleanx
#
# --- 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
else
CONFIG_MK_PRESENT := no
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 ----------------------------------------
#
# 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
#
# --- 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 := /opt/apps/intel/13/composer_xe_2013.2.146/mkl/lib/intel64
# OpenBLAS
OPENBLAS_LIB := $(BLAS_LIB_PATH)/libopenblas.a
OPENBLASP_LIB := $(BLAS_LIB_PATH)/libopenblasp.a
# ATLAS
ATLAS_LIB := $(BLAS_LIB_PATH)/libf77blas.a \
$(BLAS_LIB_PATH)/libatlas.a
# MKL
MKL_LIB := -L$(MKL_LIB_PATH) \
-lmkl_sequential \
-lmkl_core \
-lmkl_intel_lp64
#
# --- General build definitions ------------------------------------------------
#
TEST_SRC_PATH := .
TEST_OBJ_PATH := .
# Gather all local object files.
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
# Add installed and local header paths to CFLAGS
CFLAGS += -I$(BLIS_INC_PATH) -I$(TEST_SRC_PATH)
LINKER := $(CC)
LDFLAGS := #-L/home/00146/field/gnu/gcc-4.8.2/lib64
LDFLAGS += -lgfortran -lm -lpthread -fopenmp
# Datatype
DT_C := -DDT_C
DT_Z := -DDT_Z
# Which library?
BLI_DEF := -DBLIS
BLA_DEF := -DBLAS
# Complex implementation type
D4M1 := -D_4M1
D4MHW := -D_4MHW
D3M1 := -D_3M1
D3MHW := -D_3MHW
# Implementation string
STR_OBL := -DSTR=\"openblas\"
STR_ASM := -DSTR=\"asm\"
STR_4M1 := -DSTR=\"4m1\"
STR_4MHW := -DSTR=\"4mhw\"
STR_3M1 := -DSTR=\"3m1\"
STR_3MHW := -DSTR=\"3mhw\"
# Single or multithreaded string
STR_ST := -DTHR_STR=\"st\"
STR_MT := -DTHR_STR=\"mt\"
# Problem size specification
PDEF_ST := -DP_BEGIN=40 \
-DP_END=2000 \
-DP_INC=40
PDEF_MT := -DP_BEGIN=200 \
-DP_END=10000 \
-DP_INC=200
#
# --- Targets/rules ------------------------------------------------------------
#
# Complete list of possible targets when defining 'all':
#
# blis openblas atlas mkl mac essl
#
#all: blis openblas atlas mkl
all: blis blis-mt openblas openblas-mt
blis: \
test_cgemm_asm_blis_st.x \
test_zgemm_asm_blis_st.x \
test_cgemm_4m1_blis_st.x \
test_zgemm_4m1_blis_st.x \
test_cgemm_4mhw_blis_st.x \
test_zgemm_4mhw_blis_st.x \
test_cgemm_3m1_blis_st.x \
test_zgemm_3m1_blis_st.x \
test_cgemm_3mhw_blis_st.x \
test_zgemm_3mhw_blis_st.x
blis-mt: \
test_cgemm_asm_blis_mt.x \
test_zgemm_asm_blis_mt.x \
test_cgemm_4m1_blis_mt.x \
test_zgemm_4m1_blis_mt.x \
test_cgemm_4mhw_blis_mt.x \
test_zgemm_4mhw_blis_mt.x \
test_cgemm_3m1_blis_mt.x \
test_zgemm_3m1_blis_mt.x \
test_cgemm_3mhw_blis_mt.x \
test_zgemm_3mhw_blis_mt.x
openblas: \
test_cgemm_openblas_st.x \
test_zgemm_openblas_st.x
openblas-mt: \
test_cgemm_openblas_mt.x \
test_zgemm_openblas_mt.x
#atlas: \
# test_gemm_atlas.x
#mkl: \
# test_gemm_mkl.x
# --Object file rules --
$(TEST_OBJ_PATH)/%.o: $(TEST_SRC_PATH)/%.c
$(CC) $(CFLAGS) -c $< -o $@
# openblas
test_z%_openblas_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLA_DEF) $(STR_OBL) $(STR_ST) -c $< -o $@
test_c%_openblas_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLA_DEF) $(STR_OBL) $(STR_ST) -c $< -o $@
test_z%_openblas_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLA_DEF) $(STR_OBL) $(STR_MT) -c $< -o $@
test_c%_openblas_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLA_DEF) $(STR_OBL) $(STR_MT) -c $< -o $@
# blis asm
test_z%_asm_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLI_DEF) $(STR_ASM) $(STR_ST) -c $< -o $@
test_c%_asm_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLI_DEF) $(STR_ASM) $(STR_ST) -c $< -o $@
test_z%_asm_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLI_DEF) $(STR_ASM) $(STR_MT) -c $< -o $@
test_c%_asm_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLI_DEF) $(STR_ASM) $(STR_MT) -c $< -o $@
# blis 4m1
test_z%_4m1_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLI_DEF) $(D4M1) $(STR_4M1) $(STR_ST) -c $< -o $@
test_c%_4m1_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLI_DEF) $(D4M1) $(STR_4M1) $(STR_ST) -c $< -o $@
test_z%_4m1_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLI_DEF) $(D4M1) $(STR_4M1) $(STR_MT) -c $< -o $@
test_c%_4m1_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLI_DEF) $(D4M1) $(STR_4M1) $(STR_MT) -c $< -o $@
# blis 4mhw
test_z%_4mhw_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLI_DEF) $(D4MHW) $(STR_4MHW) $(STR_ST) -c $< -o $@
test_c%_4mhw_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLI_DEF) $(D4MHW) $(STR_4MHW) $(STR_ST) -c $< -o $@
test_z%_4mhw_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLI_DEF) $(D4MHW) $(STR_4MHW) $(STR_MT) -c $< -o $@
test_c%_4mhw_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLI_DEF) $(D4MHW) $(STR_4MHW) $(STR_MT) -c $< -o $@
# blis 3m1
test_z%_3m1_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLI_DEF) $(D3M1) $(STR_3M1) $(STR_ST) -c $< -o $@
test_c%_3m1_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLI_DEF) $(D3M1) $(STR_3M1) $(STR_ST) -c $< -o $@
test_z%_3m1_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLI_DEF) $(D3M1) $(STR_3M1) $(STR_MT) -c $< -o $@
test_c%_3m1_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLI_DEF) $(D3M1) $(STR_3M1) $(STR_MT) -c $< -o $@
# blis 3mhw
test_z%_3mhw_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_Z) $(BLI_DEF) $(D3MHW) $(STR_3MHW) $(STR_ST) -c $< -o $@
test_c%_3mhw_blis_st.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_ST) $(DT_C) $(BLI_DEF) $(D3MHW) $(STR_3MHW) $(STR_ST) -c $< -o $@
test_z%_3mhw_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_Z) $(BLI_DEF) $(D3MHW) $(STR_3MHW) $(STR_MT) -c $< -o $@
test_c%_3mhw_blis_mt.o: test_%.c
$(CC) $(CFLAGS) $(PDEF_MT) $(DT_C) $(BLI_DEF) $(D3MHW) $(STR_3MHW) $(STR_MT) -c $< -o $@
# -- Executable file rules --
# NOTE: For the BLAS test drivers, we place the BLAS libraries before BLIS
# on the link command line in case BLIS was configured with the BLAS
# compatibility layer. This prevents BLIS from inadvertently getting called
# for the BLAS routines we are trying to test with.
test_%_openblas_st.x: test_%_openblas_st.o $(BLIS_LIB)
$(LINKER) $< $(OPENBLAS_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_openblas_mt.x: test_%_openblas_mt.o $(BLIS_LIB)
$(LINKER) $< $(OPENBLASP_LIB) $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_blis_st.x: test_%_blis_st.o $(BLIS_LIB)
$(LINKER) $< $(BLIS_LIB) $(LDFLAGS) -o $@
test_%_blis_mt.x: test_%_blis_mt.o $(BLIS_LIB)
$(LINKER) $< $(BLIS_LIB) $(LDFLAGS) -o $@
# -- Clean rules --
clean: cleanx
cleanx:
- $(RM_F) *.o *.x