2020-08-11 16:34:22 +02:00
|
|
|
#CONFIGURE BUILD SYSTEM
|
2022-01-17 14:16:39 +01:00
|
|
|
TARGET = MDBench-$(TAG)-$(OPT_SCHEME)
|
2022-02-25 14:40:33 +01:00
|
|
|
BUILD_DIR = ./$(TAG)-$(OPT_SCHEME)
|
2022-01-17 14:16:39 +01:00
|
|
|
SRC_DIR = ./$(OPT_SCHEME)
|
2021-06-11 09:38:34 +02:00
|
|
|
ASM_DIR = ./asm
|
2022-08-17 17:20:57 +02:00
|
|
|
COMMON_DIR = ./common
|
2022-08-09 18:53:53 +02:00
|
|
|
CUDA_DIR = ./$(SRC_DIR)/cuda
|
2020-08-11 16:34:22 +02:00
|
|
|
MAKE_DIR = ./
|
|
|
|
Q ?= @
|
|
|
|
|
|
|
|
#DO NOT EDIT BELOW
|
2021-03-24 08:43:44 +01:00
|
|
|
include $(MAKE_DIR)/config.mk
|
2020-08-11 16:34:22 +02:00
|
|
|
include $(MAKE_DIR)/include_$(TAG).mk
|
2021-06-11 09:38:34 +02:00
|
|
|
include $(MAKE_DIR)/include_LIKWID.mk
|
2022-03-09 02:25:39 +01:00
|
|
|
include $(MAKE_DIR)/include_ISA.mk
|
2022-03-02 23:12:04 +01:00
|
|
|
include $(MAKE_DIR)/include_GROMACS.mk
|
2022-08-17 17:20:57 +02:00
|
|
|
INCLUDES += -I./$(SRC_DIR)/includes -I./$(COMMON_DIR)/includes
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-03-24 08:43:44 +01:00
|
|
|
ifeq ($(strip $(DATA_LAYOUT)),AOS)
|
2022-08-09 18:53:53 +02:00
|
|
|
DEFINES += -DAOS
|
2021-03-24 08:43:44 +01:00
|
|
|
endif
|
|
|
|
ifeq ($(strip $(DATA_TYPE)),SP)
|
2022-08-09 18:53:53 +02:00
|
|
|
DEFINES += -DPRECISION=1
|
2021-03-24 08:43:44 +01:00
|
|
|
else
|
2022-08-09 18:53:53 +02:00
|
|
|
DEFINES += -DPRECISION=2
|
2021-03-24 08:43:44 +01:00
|
|
|
endif
|
|
|
|
|
2021-08-09 21:37:18 +02:00
|
|
|
ifneq ($(ASM_SYNTAX), ATT)
|
|
|
|
ASFLAGS += -masm=intel
|
|
|
|
endif
|
|
|
|
|
2021-06-16 00:56:00 +02:00
|
|
|
ifeq ($(strip $(EXPLICIT_TYPES)),true)
|
2021-05-20 00:08:10 +02:00
|
|
|
DEFINES += -DEXPLICIT_TYPES
|
|
|
|
endif
|
|
|
|
|
2021-06-16 00:56:00 +02:00
|
|
|
ifeq ($(strip $(MEM_TRACER)),true)
|
|
|
|
DEFINES += -DMEM_TRACER
|
|
|
|
endif
|
|
|
|
|
2021-07-09 23:49:14 +02:00
|
|
|
ifeq ($(strip $(INDEX_TRACER)),true)
|
|
|
|
DEFINES += -DINDEX_TRACER
|
|
|
|
endif
|
|
|
|
|
2021-10-12 15:04:08 +02:00
|
|
|
ifeq ($(strip $(COMPUTE_STATS)),true)
|
|
|
|
DEFINES += -DCOMPUTE_STATS
|
|
|
|
endif
|
|
|
|
|
2022-03-02 23:12:04 +01:00
|
|
|
ifeq ($(strip $(XTC_OUTPUT)),true)
|
|
|
|
DEFINES += -DXTC_OUTPUT
|
|
|
|
endif
|
|
|
|
|
2022-02-02 18:00:44 +01:00
|
|
|
ifeq ($(strip $(USE_REFERENCE_VERSION)),true)
|
|
|
|
DEFINES += -DUSE_REFERENCE_VERSION
|
|
|
|
endif
|
|
|
|
|
2022-04-04 21:52:40 +02:00
|
|
|
ifeq ($(strip $(HALF_NEIGHBOR_LISTS_CHECK_CJ)),true)
|
|
|
|
DEFINES += -DHALF_NEIGHBOR_LISTS_CHECK_CJ
|
|
|
|
endif
|
|
|
|
|
2022-02-02 21:54:18 +01:00
|
|
|
ifeq ($(strip $(DEBUG)),true)
|
|
|
|
DEFINES += -DDEBUG
|
|
|
|
endif
|
|
|
|
|
2021-07-09 23:49:14 +02:00
|
|
|
ifneq ($(VECTOR_WIDTH),)
|
|
|
|
DEFINES += -DVECTOR_WIDTH=$(VECTOR_WIDTH)
|
|
|
|
endif
|
|
|
|
|
2022-08-16 18:36:47 +02:00
|
|
|
ifeq ($(strip $(MASK_REGISTERS)),true)
|
|
|
|
DEFINES += -DMASK_REGISTERS
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(SIMD_KERNEL_AVAILABLE)),true)
|
|
|
|
DEFINES += -DSIMD_KERNEL_AVAILABLE
|
2022-03-02 23:12:04 +01:00
|
|
|
endif
|
|
|
|
|
2022-03-15 02:40:56 +01:00
|
|
|
ifeq ($(strip $(AVX512)),true)
|
|
|
|
DEFINES += -DAVX512
|
|
|
|
endif
|
|
|
|
|
2022-04-01 15:57:54 +02:00
|
|
|
ifeq ($(strip $(ENABLE_OMP_SIMD)),true)
|
|
|
|
DEFINES += -DENABLE_OMP_SIMD
|
|
|
|
endif
|
|
|
|
|
2022-04-05 02:57:23 +02:00
|
|
|
ifeq ($(strip $(USE_SIMD_KERNEL)),true)
|
|
|
|
DEFINES += -DUSE_SIMD_KERNEL
|
|
|
|
endif
|
|
|
|
|
2022-08-09 18:53:53 +02:00
|
|
|
VPATH = $(SRC_DIR) $(ASM_DIR) $(CUDA_DIR)
|
2020-08-11 16:34:22 +02:00
|
|
|
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
|
2021-06-11 09:38:34 +02:00
|
|
|
OVERWRITE:= $(patsubst $(ASM_DIR)/%-new.s, $(BUILD_DIR)/%.o,$(wildcard $(ASM_DIR)/*-new.s))
|
|
|
|
OBJ = $(filter-out $(BUILD_DIR)/main% $(OVERWRITE),$(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c)))
|
|
|
|
OBJ += $(patsubst $(ASM_DIR)/%.s, $(BUILD_DIR)/%.o,$(wildcard $(ASM_DIR)/*.s))
|
2022-08-17 17:20:57 +02:00
|
|
|
OBJ += $(patsubst $(COMMON_DIR)/%.c, $(BUILD_DIR)/%-common.o,$(wildcard $(COMMON_DIR)/*.c))
|
2022-08-09 18:53:53 +02:00
|
|
|
ifeq ($(strip $(TAG)),NVCC)
|
|
|
|
OBJ += $(patsubst $(CUDA_DIR)/%.cu, $(BUILD_DIR)/%-cuda.o,$(wildcard $(CUDA_DIR)/*.cu))
|
|
|
|
endif
|
2021-03-24 08:43:44 +01:00
|
|
|
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
# $(warning $(OBJ))
|
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
ifneq ($(VARIANT),)
|
|
|
|
.DEFAULT_GOAL := ${TARGET}-$(VARIANT)
|
2021-06-16 00:56:00 +02:00
|
|
|
DEFINES += -DVARIANT=$(VARIANT)
|
2021-04-12 08:24:27 +02:00
|
|
|
endif
|
2021-03-30 01:54:56 +02:00
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
${TARGET}: $(BUILD_DIR) $(OBJ) $(SRC_DIR)/main.c
|
|
|
|
@echo "===> LINKING $(TARGET)"
|
|
|
|
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET) $(SRC_DIR)/main.c $(OBJ) $(LIBS)
|
2021-03-30 01:54:56 +02:00
|
|
|
|
2021-04-12 08:24:27 +02:00
|
|
|
${TARGET}-%: $(BUILD_DIR) $(OBJ) $(SRC_DIR)/main-%.c
|
|
|
|
@echo "===> LINKING $(TARGET)-$* "
|
|
|
|
$(Q)${LINKER} $(CPPFLAGS) ${LFLAGS} -o $(TARGET)-$* $(SRC_DIR)/main-$*.c $(OBJ) $(LIBS)
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.c
|
|
|
|
$(info ===> COMPILE $@)
|
2020-08-11 16:34:22 +02:00
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
2021-06-11 09:38:34 +02:00
|
|
|
$(Q)$(CC) $(CPPFLAGS) -MT $@ -MM $< > $(BUILD_DIR)/$*.d
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2022-08-17 17:20:57 +02:00
|
|
|
$(BUILD_DIR)/%-common.o: $(COMMON_DIR)/%.c
|
|
|
|
$(info ===> COMPILE $@)
|
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
$(Q)$(CC) $(CPPFLAGS) -MT $@ -MM $< > $(BUILD_DIR)/$*.d
|
|
|
|
|
2022-08-09 18:53:53 +02:00
|
|
|
$(BUILD_DIR)/%-cuda.o: %.cu
|
|
|
|
$(info ===> COMPILE $@)
|
|
|
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
|
|
|
$(Q)$(CC) $(CPPFLAGS) -MT $@ -MM $< > $(BUILD_DIR)/$*.d
|
|
|
|
|
2020-08-11 16:34:22 +02:00
|
|
|
$(BUILD_DIR)/%.s: %.c
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> GENERATE ASM $@)
|
2021-08-09 21:37:18 +02:00
|
|
|
$(Q)$(CC) -S $(ASFLAGS) $(CPPFLAGS) $(CFLAGS) $< -o $@
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
$(BUILD_DIR)/%.o: %.s
|
|
|
|
$(info ===> ASSEMBLE $@)
|
2021-08-10 01:19:26 +02:00
|
|
|
$(Q)$(AS) $< -o $@
|
2020-08-11 16:34:22 +02:00
|
|
|
|
2021-06-11 09:38:34 +02:00
|
|
|
.PHONY: clean distclean tags info asm
|
2020-08-11 16:34:22 +02:00
|
|
|
|
|
|
|
clean:
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> CLEAN)
|
2020-08-11 16:34:22 +02:00
|
|
|
@rm -rf $(BUILD_DIR)
|
|
|
|
@rm -f tags
|
|
|
|
|
|
|
|
distclean: clean
|
2021-06-11 09:38:34 +02:00
|
|
|
$(info ===> DIST CLEAN)
|
2021-04-15 14:55:02 +02:00
|
|
|
@rm -f $(TARGET)*
|
2020-08-11 16:34:22 +02:00
|
|
|
@rm -f tags
|
2021-06-11 09:38:34 +02:00
|
|
|
|
|
|
|
info:
|
|
|
|
$(info $(CFLAGS))
|
|
|
|
$(Q)$(CC) $(VERSION)
|
|
|
|
|
|
|
|
asm: $(BUILD_DIR) $(ASM)
|
|
|
|
|
|
|
|
tags:
|
|
|
|
$(info ===> GENERATE TAGS)
|
|
|
|
$(Q)ctags -R
|
|
|
|
|
|
|
|
$(BUILD_DIR):
|
|
|
|
@mkdir $(BUILD_DIR)
|
|
|
|
|
|
|
|
-include $(OBJ:.o=.d)
|