forked from flexi-framework/flexi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeListsMachine.txt
executable file
·175 lines (158 loc) · 8.76 KB
/
CMakeListsMachine.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# =========================================================================
# Detect machine environements
# =========================================================================
MARK_AS_ADVANCED(FORCE CMAKE_HOSTNAME)
SITE_NAME(CMAKE_HOSTNAME)
# HLRS HAWK / SuperMUC
IF ("${CMAKE_HOSTNAME}" MATCHES "login")
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
SET(CMAKE_Fortran_COMPILER mpif90) # mpif08 wrapper seems to have issue
MARK_AS_ADVANCED(FORCE C_PATH CXX_PATH Fortran_PATH)
# HAWK and SuperMUC name their login nodes identically, so use OS distribution to identify
find_program(LSB_RELEASE_EXEC lsb_release)
execute_process(COMMAND ${LSB_RELEASE_EXEC} -is OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE)
# HLRS HAWK
IF (LSB_RELEASE_ID_SHORT MATCHES "CentOS")
MESSAGE(STATUS "Compiling on Hawk")
# Overwrite compiler target architecture
IF (CMAKE_Fortran_COMPILER_ID MATCHES "GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
SET(FLEXI_INSTRUCTION "-march=znver2")
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
SET(FLEXI_INSTRUCTION "-xCORE-AVX2")
ENDIF()
# VDM inverse, replace lapack with analytical solution
IF (CMAKE_BUILD_TYPE MATCHES "Debug")
ADD_DEFINITIONS(-DVDM_ANALYTICAL)
ENDIF()
# Use AMD Optimized Lapack/BLAS
# SET(BLA_VENDOR "FLAME")
# SuperMUC
ELSEIF (LSB_RELEASE_ID_SHORT MATCHES "SUSE")
MESSAGE(STATUS "Compiling on SuperMUC")
# Overwrite compiler target architecture
IF (CMAKE_Fortran_COMPILER_ID MATCHES "GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
SET(FLEXI_INSTRUCTION "-march=skylake-avx512")
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
SET(FLEXI_INSTRUCTION "-xSKYLAKE-AVX512")
# Explicitely enable usage of AVX512 registers
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -qopt-zmm-usage=high")
ENDIF()
ENDIF()
# Set LUSTRE definition to account for filesystem and MPI implementation
ADD_DEFINITIONS(-DLUSTRE)
# IAG Prandtl
ELSEIF("${CMAKE_HOSTNAME}" MATCHES "^prandtl")
MESSAGE(STATUS "Compiling on Prandtl")
SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER c++)
SET(CMAKE_Fortran_COMPILER gfortran)
MARK_AS_ADVANCED(FORCE C_PATH CXX_PATH Fortran_PATH)
# Set LUSTRE definition to account for filesystem
ADD_DEFINITIONS(-DLUSTRE)
# IAG Grafik01/Grafik02
ELSEIF ("${CMAKE_HOSTNAME}" MATCHES "^grafik0")
MESSAGE(STATUS "Compiling on ${CMAKE_HOSTNAME}")
SET(CMAKE_C_COMPILER gcc)
SET(CMAKE_CXX_COMPILER c++)
SET(CMAKE_Fortran_COMPILER gfortran)
MARK_AS_ADVANCED(FORCE C_PATH CXX_PATH Fortran_PATH)
ELSEIF ("${CMAKE_HOSTNAME}" MATCHES "^ilahead1")
MESSAGE(STATUS "Compiling on ILA cluster")
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
SET(CMAKE_Fortran_COMPILER mpif90) # mpif08 wrapper seems to have issue
MARK_AS_ADVANCED(FORCE C_PATH CXX_PATH Fortran_PATH)
# Overwrite compiler target architecture
IF (CMAKE_Fortran_COMPILER_ID MATCHES "GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
SET(FLEXI_INSTRUCTION "-march=core-avx2")
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
SET(FLEXI_INSTRUCTION "-xCORE-AVX2")
ENDIF()
# Work around MPI-IO issue 4446 on machines mounting storage via NFS
ADD_DEFINITIONS(-DNFS)
ELSEIF ("${CMAKE_HOSTNAME}" MATCHES "^xenon")
MESSAGE(STATUS "Compiling on ILA student cluster")
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
SET(CMAKE_Fortran_COMPILER mpif90) # mpif08 wrapper seems to have issue
MARK_AS_ADVANCED(FORCE C_PATH CXX_PATH Fortran_PATH)
# Work around MPI-IO issue 4446 on machines mountng storage via NFS
ADD_DEFINITIONS(-DNFS)
ELSE()
# Set compiler target architecture
IF (CMAKE_Fortran_COMPILER_ID MATCHES "GNU" OR CMAKE_Fortran_COMPILER_ID MATCHES "Flang" )
SET(FLEXI_INSTRUCTION "-march=native")
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
SET(FLEXI_INSTRUCTION "-xHost")
ENDIF()
ENDIF()
# =========================================================================
# COMPILER FLAGS
# =========================================================================
ENABLE_LANGUAGE(Fortran C)
# FFLAGS depend on the compiler
GET_FILENAME_COMPONENT (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
# GNU Compiler Collection (GCC)
IF (CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
# set Flags (disable lto type warnings due to false positives with MATMUL, which is a known bug)
IF (NOT DEFINED C_FLAGS_INITIALIZED )
SET (C_FLAGS_INITIALIZED "yes" CACHE INTERNAL "Flag if compiler flags are already initialized" )
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fdefault-double-8 -fbackslash -ffree-line-length-0 -Wno-lto-type-mismatch -DGNU")
ENDIF()
SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -O3 ${FLEXI_INSTRUCTION} -finline-functions -fstack-arrays")
SET (CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS} -pg -O3 ${FLEXI_INSTRUCTION} -finline-functions -fstack-arrays")
SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -g -Og -ggdb3 -ffpe-trap=invalid -fbounds-check -finit-real=snan -fbacktrace -Wall")
SET (CMAKE_Fortran_FLAGS_SANITIZE "${CMAKE_Fortran_FLAGS} -g -Og -ggdb3 -ffpe-trap=invalid,zero,overflow -fbounds-check -finit-real=snan -fbacktrace -Wall -fsanitize=address,undefined,leak -fno-omit-frame-pointer -Wc-binding-type -Wuninitialized -pedantic")
# add flags only for compiling not linking!
SET (FLEXI_COMPILE_FLAGS "-xf95-cpp-input -fPIC")
# AMD Optimized LLVM/CLANG
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
# set Flags
IF (NOT DEFINED C_FLAGS_INITIALIZED )
SET (C_FLAGS_INITIALIZED "yes" CACHE INTERNAL "Flag if compiler flags are already initialized" )
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -std=f2008 -DFLANG")
ENDIF()
SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -O3 ${FLEXI_INSTRUCTION} -finline-functions ")
SET (CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS} -pg -O3 ${FLEXI_INSTRUCTION} -finline-functions ")
SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -g -O0 -ggdb3 -ffpe-trap=invalid -fbounds-check -finit-real=snan -fbacktrace -Wall")
# add flags only for compiling not linking!
SET (FLEXI_COMPILE_FLAGS "-xf95-cpp-input -fPIC")
# Intel Compiler
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Intel")
# set Flags
IF (NOT DEFINED C_FLAGS_INITIALIZED )
SET (C_FLAGS_INITIALIZED "yes" CACHE INTERNAL "Flag if compiler flags are already initialized" )
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -i4 -traceback -warn all -shared-intel -DINTEL")
ENDIF()
SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -O3 ${FLEXI_INSTRUCTION} -qopt-report0 -qopt-report-phase=vec -no-prec-div")
SET (CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS} -p -O3 ${FLEXI_INSTRUCTION} -qopt-report0 -qopt-report-phase=vec -no-prec-div")
SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -g -O0 -fpe0 -traceback -check all,noarg_temp_created,noformat,nooutput_conversion,pointer,uninit -init=snan -init=arrays")
# add flags only for compiling not linking!
SET (FLEXI_COMPILE_FLAGS "-fpp -allow nofpp_comments -assume bscc")
# Cray Compiler
ELSEIF (CMAKE_Fortran_COMPILER_ID MATCHES "Cray")
# set Flags
IF (NOT DEFINED C_FLAGS_INITIALIZED )
SET (C_FLAGS_INITIALIZED "yes" CACHE INTERNAL "Flag if compiler flags are already initialized" )
SET (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -f free -s real64 -em -DCRAY")
ENDIF()
SET (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -O2 -hfp3 -p . -rm")
SET (CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS} -O2 -hfp3 -h profile_generate -p . -rm")
SET (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -O0 -eD -rm")
# add flags only for compiling not linking!
SET (FLEXI_COMPILE_FLAGS "-F")
ELSE()
MESSAGE(SEND_ERROR "Unknown compiler")
ENDIF()
# Save the current compiler flags to the cache every time cmake configures the project.
MARK_AS_ADVANCED(FORCE CMAKE_Fortran_FLAGS)
MARK_AS_ADVANCED(FORCE CMAKE_Fortran_FLAGS_RELEASE)
MARK_AS_ADVANCED(FORCE CMAKE_Fortran_FLAGS_PROFILE)
MARK_AS_ADVANCED(FORCE CMAKE_Fortran_FLAGS_DEBUG)
MARK_AS_ADVANCED(FORCE CMAKE_Fortran_FLAGS_SANITIZE)
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}" CACHE STRING "Default compiler flags" FORCE)
SET(CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE}" CACHE STRING "Release compiler flags" FORCE)
SET(CMAKE_Fortran_FLAGS_PROFILE "${CMAKE_Fortran_FLAGS_PROFILE}" CACHE STRING "Profile compiler flags" FORCE)
SET(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG}" CACHE STRING "Debug compiler flags" FORCE)
SET(CMAKE_Fortran_FLAGS_SANITIZE "${CMAKE_Fortran_FLAGS_SANITIZE}" CACHE STRING "Sanitize compiler flags" FORCE)