Streamline build system

This commit is contained in:
Jan Eitzinger 2021-03-24 08:43:44 +01:00
parent 4b481bb407
commit d026028439
7 changed files with 29 additions and 28 deletions

View File

@ -1,22 +1,28 @@
TAG = GCC
#CONFIGURE BUILD SYSTEM
TARGET = MDBench-$(TAG)
BUILD_DIR = ./$(TAG)
SRC_DIR = ./src
MAKE_DIR = ./
FLAGS = -DAOS
Q ?= @
#DO NOT EDIT BELOW
include $(MAKE_DIR)/config.mk
include $(MAKE_DIR)/include_$(TAG).mk
INCLUDES += -I./src/includes
ifeq ($(strip $(DATA_LAYOUT)),AOS)
DEFINES += -DAOS
endif
ifeq ($(strip $(DATA_TYPE)),SP)
DEFINES += -DPRECISION=1
else
DEFINES += -DPRECISION=2
endif
VPATH = $(SRC_DIR)
ASM = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.s,$(wildcard $(SRC_DIR)/*.c))
OBJ = $(patsubst $(SRC_DIR)/%.c, $(BUILD_DIR)/%.o,$(wildcard $(SRC_DIR)/*.c))
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(INCLUDES) ${FLAGS}
CPPFLAGS := $(CPPFLAGS) $(DEFINES) $(OPTIONS) $(INCLUDES)
${TARGET}: $(BUILD_DIR) $(OBJ)
@echo "===> LINKING $(TARGET)"

View File

@ -4,9 +4,10 @@ A simple, sequential C implementation of the [Mantevo miniMD](https://github.co
## Build
1. Open the `Makefile` and edit the `TAG` value according to the tool chain used. Currently supported is GCC, CLANG (LLVM), and ICC (Intel).
2. Open and adapt the compiler flags in `<include_<TOOLCHAIN>.mk`, e.g. in `include_ICC.mk` for the Intel tool chain.
3. Build the binary calling `make`.
1. Open `config.mk` and edit the `TAG` value according to the tool chain used. Currently supported is GCC, CLANG (LLVM), and ICC (Intel).
2. Change `DATA_LAYOUT` and `DATA_TYPE` if desired in config.mk.
3. Open and adapt the compiler flags in `<include_<TOOLCHAIN>.mk`, e.g. in `include_ICC.mk` for the Intel tool chain.
4. Build the binary calling `make`.
You can clean intermediate build results with `make clean`, and all build results with `make distclean`.
You have to call `make clean` before `make` if you changed the build settings.

7
config.mk Normal file
View File

@ -0,0 +1,7 @@
# Supported: GCC, CLANG, ICC
TAG ?= GCC
DATA_TYPE ?= SP#SP or DP
DATA_LAYOUT ?= AOS#AOS or SOA
#Feature options
OPTIONS += -DALIGNMENT=64

View File

@ -1,5 +1,4 @@
CC = cc
CXX = gcc
LINKER = $(CC)
ANSI_CFLAGS = -ansi
@ -9,9 +8,7 @@ ANSI_CFLAGS += -Wextra
CFLAGS = -Ofast $(ANSI_CFLAGS) -g #-Xpreprocessor -fopenmp -g
ASFLAGS = -masm=intel
CXXFLAGS = $(CFLAGS)
FCFLAGS =
LFLAGS =
DEFINES = -D_GNU_SOURCE -DALIGNMENT=64 -DPRECISION=2
DEFINES = -D_GNU_SOURCE
INCLUDES =
LIBS = #-lomp
LIBS = -lm #-lomp

View File

@ -1,7 +1,5 @@
CC = gcc
CXX = g++
FC = gfortran
LINKER = $(CXX)
LINKER = $(CC)
ANSI_CFLAGS = -ansi
ANSI_CFLAGS += -std=c99
@ -10,10 +8,8 @@ ANSI_CFLAGS += -Wextra
CFLAGS = -O0 -g -std=c99 -fargument-noalias
# CFLAGS = -O3 -march=znver1 -ffast-math -funroll-loops -fopenmp
CXXFLAGS = $(CFLAGS)
ASFLAGS = -masm=intel
FCFLAGS =
LFLAGS =
DEFINES = -D_GNU_SOURCE -DALIGNMENT=64 -DPRECISION=2
DEFINES = -D_GNU_SOURCE
INCLUDES =
LIBS =
LIBS = -lm

View File

@ -1,5 +1,4 @@
CC = icc
CXX = icpc
LINKER = $(CC)
OPENMP = #-qopenmp
@ -11,10 +10,8 @@ PROFILE = #-profile-functions -g -pg
#OPTS = -fast -no-vec $(PROFILE)
OPTS = -fast -xHost $(PROFILE)
CFLAGS = $(PROFILE) -restrict $(OPENMP) $(OPTS)
CXXFLAGS = $(CFLAGS)
ASFLAGS = -masm=intel
FCFLAGS =
LFLAGS = $(PROFILE) $(OPTS) $(OPENMP)
DEFINES = -D_GNU_SOURCE -DALIGNMENT=64 # -DLIKWID_PERFMON -DPRECISION=1
DEFINES = -D_GNU_SOURCE # -DALIGNMENT=64 -DLIKWID_PERFMON -DPRECISION=1
INCLUDES = #$(LIKWID_INC)
LIBS = #$(LIKWID_LIB) -llikwid
LIBS = -lm #$(LIKWID_LIB) -llikwid

View File

@ -23,9 +23,6 @@
#ifndef __PARAMETER_H_
#define __PARAMETER_H_
#ifndef PRECISION
#define PRECISION 2
#endif
#if PRECISION == 1
#define MD_FLOAT float
#else