From 8aad7e87a0cec5de5ea6295154fbd907368da80d Mon Sep 17 00:00:00 2001 From: Rafael Ravedutti Date: Mon, 16 Jan 2023 23:05:21 +0100 Subject: [PATCH] Use ISA for GCC flags and change binary and build directory names Signed-off-by: Rafael Ravedutti --- Makefile | 10 +++++----- include_GCC.mk | 24 ++++++++++++++++++++---- include_ICC.mk | 8 ++++---- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index ff04e3c..83a25ad 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ #CONFIGURE BUILD SYSTEM -TARGET = MDBench-$(TAG)-$(OPT_SCHEME) -BUILD_DIR = ./$(TAG)-$(OPT_SCHEME) +IDENTIFIER = $(OPT_SCHEME)-$(TAG)-$(ISA)-$(DATA_TYPE) +TARGET = MDBench-$(IDENTIFIER) +BUILD_DIR = ./build-$(IDENTIFIER) SRC_DIR = ./$(OPT_SCHEME) ASM_DIR = ./asm COMMON_DIR = ./common @@ -155,9 +156,8 @@ clean: cleanall: $(info ===> CLEAN) - @rm -rf ICC-lammps ICX-lammps GCC-lammps CLANG-lammps NVCC-lammps - @rm -rf ICC-gromacs ICX-gromacs GCC-gromacs CLANG-gromacs NVCC-gromacs - @rm -rf MDBench-GCC* MDBench-ICC* MDBench-ICX* MDBench-CLANG* MDBench-NVCC* + @rm -rf build-* + @rm -rf MDBench-* @rm -f tags distclean: clean diff --git a/include_GCC.mk b/include_GCC.mk index 24491f8..90771bc 100644 --- a/include_GCC.mk +++ b/include_GCC.mk @@ -6,13 +6,29 @@ ANSI_CFLAGS += -std=c99 ANSI_CFLAGS += -pedantic ANSI_CFLAGS += -Wextra -#CFLAGS = -O0 -g -std=c99 -fargument-noalias +ifeq ($(ISA),AVX512) +CFLAGS = -Ofast -mavx512f -mavx512vl -mavx512bw -mavx512dq -mavx512cd -ffast-math -funroll-loops # -fopenmp #CFLAGS = -O3 -march=cascadelake -ffast-math -funroll-loops # -fopenmp -CFLAGS = -Ofast -march=native -ffast-math -funroll-loops # -fopenmp +endif + +ifeq ($(ISA),AVX2) #CFLAGS = -Ofast -march=native -mavx2 -ffast-math -funroll-loops # -fopenmp -#CFLAGS = -Ofast -march=native -ffast-math -funroll-loops # -fopenmp -#CFLAGS = -O3 -march=native -ffast-math -funroll-loops # -fopenmp #CFLAGS = -O3 -march=znver1 -ffast-math -funroll-loops # -fopenmp +#CFLAGS = -Ofast -mavx2 -ffast-math -funroll-loops # -fopenmp +CFLAGS = -Ofast -mavx2 -mfma -ffast-math -funroll-loops # -fopenmp +endif + +ifeq ($(ISA),AVX) +CFLAGS = -Ofast -mavx -ffast-math -funroll-loops # -fopenmp +endif + +ifeq ($(ISA),SSE) +CFLAGS = -Ofast -msse4.2 -ffast-math -funroll-loops # -fopenmp +endif + +#CFLAGS = -O0 -g -std=c99 -fargument-noalias +#CFLAGS = -Ofast -march=native -ffast-math -funroll-loops # -fopenmp +#CFLAGS = -O3 -march=native -ffast-math -funroll-loops # -fopenmp ASFLAGS = #-masm=intel LFLAGS = DEFINES = -D_GNU_SOURCE -DNO_ZMM_INTRIN diff --git a/include_ICC.mk b/include_ICC.mk index f6c60b2..485d9d7 100644 --- a/include_ICC.mk +++ b/include_ICC.mk @@ -4,21 +4,21 @@ LINKER = $(CC) OPENMP = #-qopenmp PROFILE = #-profile-functions -g -pg -ifeq($(ISA),AVX512) +ifeq ($(ISA),AVX512) OPTS = -Ofast -xCORE-AVX512 -qopt-zmm-usage=high $(PROFILE) endif -ifeq($(ISA),AVX2) +ifeq ($(ISA),AVX2) OPTS = -Ofast -xCORE-AVX2 $(PROFILE) #OPTS = -Ofast -xAVX2 $(PROFILE) #OPTS = -Ofast -march=core-avx2 $(PROFILE) endif -ifeq($(ISA),AVX) +ifeq ($(ISA),AVX) OPTS = -Ofast -xAVX $(PROFILE) endif -ifeq($(ISA),SSE) +ifeq ($(ISA),SSE) OPTS = -Ofast -xSSE4.2 $(PROFILE) endif