File: setup_compiler_flags_intel.cmake

package info (click to toggle)
deal.ii 9.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 181,876 kB
  • sloc: cpp: 265,739; ansic: 52,054; python: 1,507; perl: 645; sh: 506; xml: 437; makefile: 73
file content (209 lines) | stat: -rw-r--r-- 7,403 bytes parent folder | download
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
## ---------------------------------------------------------------------
##
## Copyright (C) 2012 - 2017 by the deal.II authors
##
## This file is part of the deal.II library.
##
## The deal.II library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE at
## the top level of the deal.II distribution.
##
## ---------------------------------------------------------------------

#
# General setup for the Intel C++ Compiler
#
# Please read the fat note in setup_compiler_flags.cmake prior to
# editing this file.
#

IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "15.0" )
  MESSAGE(WARNING "\n"
    "You're using an old version of the Intel C++ Compiler (icc/icpc)!\n"
    "It is strongly recommended to use at least version 15.\n"
    )
ENDIF()


########################
#                      #
#    General setup:    #
#                      #
########################

#
# Set the pic flag.
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-fpic")

#
# Check whether the -as-needed flag is available. If so set it to link
# the deal.II library with it.
#
ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed")

#
# Set ansi mode:
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-ansi")

#
# Enable verbose warnings:
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-w2")

#
# Disable remarks like "Inlining inhibited by limit max-size"
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-diag-disable=remark")

#
# Disable some warnings that lead to a lot of false positives:
#
#   -w21    type qualifiers are meaningless in this declaration
#   -w68    integer conversion resulted in a change of sign
#           (triggers a lot in functionparser)
#   -w175   subscript out of range
#   -w135   class template "dealii::FE_Q_Base<POLY, dim, spacedim>"
#           has no member "Implementation"
#           (the compiler is objectively wrong since the warning
#            triggers also on code of the form
#            class FE_Q_Base {
#              struct Implementation; // forward declaration
#              friend struct Implementation;
#            };)
#   -w177   declared but not referenced
#   -w191   type qualifier is meaningless on cast type
#           Warnings from this warn about code like this:
#              static_cast<T const * const>(p)
#           There are many places in boost that do this kind of stuff
#   -w193   zero used for undefined preprocessing identifier "..."
#           This happens when using undefined preprocessor names in
#           conditions such as
#             #if (abc && def)
#           instead of
#             #if (defined(abc) && defined(def))
#           The standard says that in such cases, the undefined symbol
#           is assumed to be zero. The warning is in principle
#           useful, but the pattern appears exceedingly often in the TBB
#   -w279   controlling expression is constant
#   -w327   NULL reference is not allowed
#           (the compiler is correct here in that statements like
#            *static_cast<int*>(0) are not allowed to initialize
#            references; however, it's the only useful way to do
#            so if you need an invalid value for a reference)
#   -w383   value copied to temporary, reference to temporary used
#   -w981   operands are evaluated in unspecified order
#   -w1418  external function definition with no prior declaration
#           (happens in boost)
#   -w1478  deprecation warning
#   -w1572  floating-point equality and inequality comparisons are unreliable
#   -w2259  non-pointer conversion from "double" to "float" may
#           lose significant bits
#   -w2536  type qualifiers are meaningless here
#   -w3415  the "always_inline" attribute is ignored on non-inline functions
#           incorrectly triggered by inline functions in tensor.h
#   -w15531 A portion of SIMD loop is serialized
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd21")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd68")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd135")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd175")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd177")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd191")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd193")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd279")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd327")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd383")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd981")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1418")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1478")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd1572")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd2259")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd2536")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd3415")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd15531")


#
# Also disable the following warnings that we frequently
# trigger writing dimension independent code:
#   -w111 statement is unreachable
#         Happens in code that is guarded by a check on 'dim'
#   -w128 loop is not reachable from preceding
#         Same as above
#   -w185 dynamic initialization in unreachable code
#         When initializing a local variable in code
#         that is executed only for one specific dimension
#   -w186 pointless comparison of unsigned integer with zero
#         The condition of for loops often depends on dim
#         and happens to evaluate to zero sometimes
#   -w280 selector expression is constant
#         When writing 'switch(dim)'
#
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd111")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd128")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd185")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd186")
ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-wd280")


IF(DEAL_II_STATIC_EXECUTABLE)
  #
  # To produce a static executable, we have to statically link intel's
  # support libraries:
  #
  ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static")
  ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static-intel")
  ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static-gcc")
  ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-pthread")
ELSE()
  #
  # Explicitly link intel support libraries dynamically:
  #
  ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-shared-intel")
ENDIF()


#############################
#                           #
#    For Release target:    #
#                           #
#############################

IF (CMAKE_BUILD_TYPE MATCHES "Release")
  #
  # General optimization flags:
  #

  ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2")

  # equivalent to -fno-strict-aliasing:
  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-no-ansi-alias")

  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-ip")

  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-loops")
ENDIF()


###########################
#                         #
#    For Debug target:    #
#                         #
###########################

IF (CMAKE_BUILD_TYPE MATCHES "Debug")
  LIST(APPEND DEAL_II_DEFINITIONS_DEBUG "DEBUG")
  LIST(APPEND DEAL_II_USER_DEFINITIONS_DEBUG "DEBUG")

  ADD_FLAGS(DEAL_II_CXX_FLAGS_DEBUG "-O0")

  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-g")
  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-gdwarf-2")
  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-grecord-gcc-switches")
ENDIF()