Commit 1d32efed authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: combine wmake rules for KNL architecture as a compile option

- instead of

      WM_COMPILER=GccKNL WM_COMPILE_OPTION=Opt

      -> linux64GccKNLDPInt32Opt

  now specify

      WM_COMPILER=Gcc  WM_COMPILE_OPTION=OptKNL

      -> linux64GccDPInt32OptKNL

This makes it easier (and more obvious) for adding different tweaks
without needing to generate too many files.
Eg,

    cd wmake/rules/linux64Gcc

    cp cOpt   cOptBdw
    cp c++Opt c++OptBdw

    edit these two files and then use WM_COMPILE_OPTION=OptBdw

CONFIG: provide some default c/c++ flags in General compiler rules

- can make is easier when deriving new compile options, and ensures
  that '-02' is enabled as an initial default.
parent 7bcf3dc9
......@@ -68,8 +68,8 @@ projectDir="$HOME/OpenFOAM/OpenFOAM-$WM_PROJECT_VERSION"
export WM_COMPILER_TYPE=system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] | GccKNL |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | IccKNL | Cray | Arm
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | Cray | Arm
export WM_COMPILER=Gcc
# [WM_ARCH_OPTION] - Memory addressing:
......@@ -86,8 +86,10 @@ export WM_PRECISION_OPTION=DP
# = 32 | 64
export WM_LABEL_SIZE=32
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# [WM_COMPILE_OPTION] - Optimised, debug, profiling, other:
# = Opt | Debug | Prof
# Other is processor or packaging specific, for example
# = OptKNL
export WM_COMPILE_OPTION=Opt
# [WM_MPLIB] - MPI implementation:
......
......@@ -70,8 +70,8 @@ set projectDir=`lsof +p $$ |& \
setenv WM_COMPILER_TYPE system
# [WM_COMPILER] - Compiler:
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] | GccKNL |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | IccKNL | Cray | Arm
# = Gcc | Gcc4[8-9] | Gcc5[1-5] | Gcc6[1-4] | Gcc7[1-3] | Gcc8[12] |
# Clang | Clang3[7-9] | Clang[4-6]0 | Icc | Cray | Arm
setenv WM_COMPILER Gcc
# [WM_ARCH_OPTION] - Memory addressing:
......@@ -88,8 +88,10 @@ setenv WM_PRECISION_OPTION DP
# = 32 | 64
setenv WM_LABEL_SIZE 32
# [WM_COMPILE_OPTION] - Optimised, debug, profiling:
# [WM_COMPILE_OPTION] - Optimised, debug, profiling, other:
# = Opt | Debug | Prof
# Other is processor or packaging specific, for example
# = OptKNL
setenv WM_COMPILE_OPTION Opt
# [WM_MPLIB] - MPI implementation:
......
SUFFIXES += .c
cc = clang
cDBUG =
cOPT = -O2
cWARN = -Wall
......@@ -2,6 +2,8 @@ SUFFIXES += .C .cc .cpp .cxx
CC = clang++ -std=c++11
c++DBUG =
c++OPT = -O2
ptFLAGS = -DNoRepository -ftemplate-depth-100
# - Standard warnings
......
SUFFIXES += .c
cc = gcc
cDBUG =
cOPT = -O2
cWARN = -Wall
......@@ -2,6 +2,8 @@ SUFFIXES += .C .cc .cpp .cxx
CC = g++ -std=c++11
c++DBUG =
c++OPT = -O2
ptFLAGS = -DNoRepository -ftemplate-depth-100
# - Standard warnings
......
SUFFIXES += .c
cc = icc
cDBUG =
cOPT = -O2
cWARN =
......@@ -2,6 +2,8 @@ SUFFIXES += .C .cc .cpp .cxx
CC = icpc -std=c++11
c++DBUG =
c++OPT = -O2
ptFLAGS = -DNoRepository
# - Standard warnings
......
SUFFIXES += .c
include $(GENERAL_RULES)/Clang/c
cc = clang -m64 -Ddarwin -ftrapping-math
cWARN = -Wall
include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
......
SUFFIXES += .c
include $(GENERAL_RULES)/Clang/c
cc = clang -m64
cWARN = -Wall
include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
  • @Mattijs - What are your thoughts about the handling of c/c++ compile-type flags?

    I was thinking that we could rename the existing files (eg, c++Opt) to something like c++Flags_Opt. After which we could then use a silent include to conditionally load them. Eg,

    sinclude $(DEFAULT_RULES)/c++Flags_$(WM_COMPILE_OPTION)

    This would make like a bit easier for people like @ivanspisso who are trying out different processor options for Broadwell etc. The current naming structure with cOpt and c++Opt means that he needs to generate an additional c version for each variant in order to satisfy the include.

    I wouldn't feel very confident about simply changing the current include to and sinclude:

    sinclude $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)

    I'm not sure if make (GNU or otherwise) is intelligent enough to avoid self-recursive includes, but I'd prefer not to rely on it.

Please register or sign in to reply
cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
......
SUFFIXES += .c
include $(GENERAL_RULES)/Gcc/c
cc = gcc -m64
cWARN = -Wall
include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
......
c++DBUG =
c++OPT = -O3
c++OPT = -march=knl -O3
ROUNDING_MATH = -frounding-math
SUFFIXES += .c
cc = gcc -m64 -march=knl
cWARN = -Wall
include $(DEFAULT_RULES)/c$(WM_COMPILE_OPTION)
cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC
ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $< -o $@
LINK_LIBS = $(cDBUG)
LINKLIBSO = $(cc) -shared
LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs
include $(GENERAL_RULES)/Gcc/c++
CC = g++ -std=c++11 -m64 -march=knl
include $(DEFAULT_RULES)/c++$(WM_COMPILE_OPTION)
c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC
Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@
cxxtoo = $(Ctoo)
cctoo = $(Ctoo)
cpptoo = $(Ctoo)
LINK_LIBS = $(c++DBUG)
LINKLIBSO = $(CC) $(c++FLAGS) -shared -Xlinker --add-needed -Xlinker --no-as-needed
LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed -Xlinker --no-as-needed
c++DBUG = -ggdb3 -DFULLDEBUG
c++OPT = -O0 -fdefault-inline
cDBUG = -ggdb -DFULLDEBUG
cOPT = -O1 -fdefault-inline -finline-functions
CPP = cpp -traditional-cpp $(GFLAGS)
PROJECT_LIBS = -l$(WM_PROJECT) -ldl
include $(GENERAL_RULES)/standard
include $(GENERAL_RULES)/Gcc/openmp
include $(DEFAULT_RULES)/c
include $(DEFAULT_RULES)/c++
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment