From 67f4babcebc97c7d92ba54e3c8308783c5813b0d Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 2 Oct 2012 13:09:23 +0000 Subject: [PATCH] Add support for the Intel C++ Compiler git-svn-id: https://svn.dealii.org/branches/branch_cmake@26924 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/TODO.CMAKE | 2 + deal.II/cmake/compiler.m4 | 483 ------------------ deal.II/cmake/setup_compiler_flags.cmake | 4 +- deal.II/cmake/setup_compiler_flags_gnu.cmake | 29 +- .../cmake/setup_compiler_flags_intel.cmake | 101 +++- deal.II/include/deal.II/lac/block_indices.h | 2 +- 6 files changed, 112 insertions(+), 509 deletions(-) delete mode 100644 deal.II/cmake/compiler.m4 diff --git a/deal.II/TODO.CMAKE b/deal.II/TODO.CMAKE index 822f3446d3..840eeb6882 100644 --- a/deal.II/TODO.CMAKE +++ b/deal.II/TODO.CMAKE @@ -40,6 +40,8 @@ Major: Minor: +* Evaluate this Intel and MPI issue + * Fixup the TODOs in source/lac/sparse_dircect.cc source/base/path_find.cc diff --git a/deal.II/cmake/compiler.m4 b/deal.II/cmake/compiler.m4 deleted file mode 100644 index be6c186632..0000000000 --- a/deal.II/cmake/compiler.m4 +++ /dev/null @@ -1,483 +0,0 @@ -Shall we still support DEC OSF? *mhm* :-] - - - - - dnl On DEC OSF, including both stdio.h and unistd.h causes a warning - dnl from the preprocessor that cuserid is redefined as a preprocessor - dnl variable. Suppress this if necessary by switching off warnings - dnl from the preprocessor - *dec-osf*) - AC_MSG_CHECKING(for preprocessor warning with cuserid) - CXXFLAGS="$CXXFLAGSG -Werror" - AC_TRY_COMPILE( - [ -# include -# include - ], - [;], - [ - AC_MSG_RESULT(no) - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -Wp,-w" - CXXFLAGSO="$CXXFLAGSO -Wp,-w" - ]) - ;; - esac - - - dnl ------------------------------------------------------------- - dnl Depending on what compiler we use, set the flag necessary to - dnl obtain debug output. We will usually use -ggdb, but on DEC Alpha - dnl OSF1, this leads to stabs symbols that are too long for the system - dnl assembler. We will therefore check whether the assembler can handle - dnl these symbols by a rather perverse function with many templates, - dnl and if the assembler can't handle them, then use -gstabs - dnl instead. This reduces debugging possibilities, but no other - dnl way is known at present. - dnl - dnl For all compilers other than gcc, use -g instead and don't check. - dnl - dnl Usage: DEAL_II_SET_CXX_DEBUG_FLAG - dnl - dnl ------------------------------------------------------------- - AC_DEFUN(DEAL_II_SET_CXX_DEBUG_FLAG, dnl - [ - if test "$GXX" = yes ; then - case "$target" in - dnl On Alpha, use the special treatment - alpha*-osf*) - AC_MSG_CHECKING(whether -ggdb works for long symbols) - CXXFLAGS="-ggdb $CXXFLAGSG" - AC_TRY_COMPILE( - [ - # include - # include - using namespace std; - - typedef map > > T; - - bool f(T& t1, const T* t2) { - t1["s"] = map >(); - map > > - ::const_iterator i2=t1.begin(); - map > > - ::const_iterator i1=t2->begin(); - return (i1==i2); - } - ], - [ - ; - ], - [ - CXXFLAGSG="-ggdb $CXXFLAGSG" - AC_MSG_RESULT(yes) - ], - [ - CXXFLAGSG="-gstabs $CXXFLAGSG" - AC_MSG_RESULT(no -- using -gstabs instead) - ]) - ;; - - - - - - - - - - - - - - - - case "$GXX_VERSION" in - ibm_xlc) - dnl Set flags for IBM's xlC compiler. As of version 11.1, it still - dnl doesn't grok all of deal.II, but it's getting closer. The - dnl -qxflag=EnableIssue214PartialOrdering flag is necessary to - dnl resolve code like this that we have in the MemoryConsumption - dnl namespace: - dnl ---------------------------------------------- - dnl template void f (T* const); - dnl template void f (const T &); - dnl - dnl void g() { - dnl int *p; - dnl f(p); - dnl } - dnl ---------------------------------------------- - dnl - dnl Similarly, -qxflag=IgnoreCVOnTopOfFunctionTypes is necessary for - dnl ---------------------------------------------- - dnl struct S {}; - dnl S & foo (const S&); - dnl - dnl struct X { - dnl template - dnl void f (const T &t) const; - dnl }; - dnl - dnl void - dnl print_summary () - dnl { - dnl X x; - dnl x.f (foo); - dnl } - dnl ---------------------------------------------- - dnl We have this kind of code with S=std::ostream, foo=std::endl - dnl and X=LogStream when we do things like - dnl deallog << std::endl; - CXXFLAGSG="$CXXFLAGSG -DDEBUG -check=bounds -info=all -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering -qxflag=IgnoreCVOnTopOfFunctionTypes" - CXXFLAGSO="$CXXFLAGSO -O2 -w -qansialias -qrtti=all -qsuppress=1540-2907 -qsuppress=1540-2909 -qxflag=EnableIssue214PartialOrdering -qxflag=IgnoreCVOnTopOfFunctionTypes" - CXXFLAGSPIC="-qpic" - LDFLAGSPIC="-qpic" - ;; - - MIPSpro*) - dnl Disable some compiler warnings, as they trigger some warnings in - dnl system and compiler include files - dnl cc-1429 CC: WARNING File = /usr/include/internal/stdlib_core.h, Line = 128 - dnl The type "long long" is nonstandard. - dnl cc-1066 CC: WARNING File = /usr/include/CC/stl_ctype.h, Line = 28 - dnl The indicated enumeration value is out of "int" range. - dnl cc-1485 CC: WARNING File = /usr/include/CC/iomanip, Line = 122 - dnl This form for taking the address of a member function is nonstandard. - CXXFLAGSG="$CXXFLAGSG -DDEBUG -D__sgi__ -no_auto_include -ansiW -woff 1429,1066,1485" - dnl Disable some compiler warnings, that warn about variables - dnl which are used in Assert templates but not in optimized mode - dnl cc-1174 CC: full_matrix.templates.h, Line = 1461 - dnl The variable "typical_diagonal_element" was declared but never referenced. - dnl cc-1552 CC: WARNING File = source/data_out_base.cc, Line = 3493 - dnl The variable "ierr" is set but never used. - CXXFLAGSO="$CXXFLAGSO -D__sgi__ -O2 -no_auto_include -woff 1174,1552" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-KPIC" - dnl Avoid output of prelinker (-quiet_prelink) - dnl Disable compiler warning: - dnl ld32: WARNING 131: Multiply defined weak symbol: - dnl (_M_acquire_lock__Q2_3std15_STL_mutex_lockGv) in auto_derivative_function.g.o - dnl and convergence_table.g.o (2nd definition ignored) - LDFLAGS="$LDFLAGS -quiet_prelink -woff 131" - dnl - dnl Always link with math library: The -lm option must be at the end of the - dnl linker command, therefore it cannot be included into LDFLAGS - DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL(-lm) - ;; - - ;; - - intel_icc*) - dnl Earlier icc versions used -Kxxx for flags. Later versions use - dnl the gcc convention -fxxx. Also, at least since icc11, the - dnl flag -inline_debug_info has been deprecated, so don't use - dnl it any more - dnl - dnl Exception handling is also standard in later versions, as is rtti - case "$GXX_VERSION" in - intel_icc5 | intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSG="$CXXFLAGSG -Kc++eh -Krtti -DDEBUG -inline_debug_info" - CXXFLAGSO="$CXXFLAGSO -Kc++eh -Krtti -O2 -unroll" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-KPIC" - ;; - - intel_icc*) - CXXFLAGSG="$CXXFLAGSG -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -O2 -unroll" - CXXFLAGSPIC="-fPIC" - LDFLAGS="$LDFLAGS -lstdc++ -lpthread" - LDFLAGSPIC="-fPIC" - ;; - esac - - dnl Disable some compiler warnings, as they often are wrong on - dnl our code: - dnl #11: ` unrecognized preprocessing directive" (we use - dnl #warning at one place) - dnl #175: `subscript out of range' (doesn't take into account that - dnl some code is only reachable for some dimensions) - dnl #327: `NULL reference is not allowed' (this happens when we - dnl write "*static_cast(0)" or some such thing, - dnl which we do to create invalid references) - dnl #424: `extra ";" ignored' - dnl #525: `type "DataOutBase::DataOutBase" is an inaccessible type - dnl (allowed for compatibility)' (I don't understand what the - dnl compiler means) - dnl #734: `X::X(const X&), required for copy that was eliminated, is - dnl inaccessible' - dnl (valid, but annoying and sometimes hard to work around) - dnl #858: `type qualifier on return type is meaningless' - dnl (on conversion operators to types that are already const) - dnl #1565: attributes are ignored on a class declaration that is not - dnl also a definition (this happens in BOOST in a number of - dnl places) - CXXFLAGSG="$CXXFLAGSG -w1 -wd175 -wd525 -wd327 -wd424 -wd11 -wd734 -wd858 -wd1565" - CXXFLAGSO="$CXXFLAGSO -w0 -wd424 -wd11" - - dnl To reduce output, use -opt_report_levelmin where possible, - dnl i.e. post icc5. from icc10 onwards, this flag is called - dnl -opt-report, and -vec-report controls output of the - dnl autovectorizer (to make things simpler, one of the two options - dnl wants a space between option and level, whereas the other does - dnl not) - dnl - dnl Since only the x86 and x86_64 compilers can vectorize, this - dnl flag needs to be suppressed on ia64 (itanium) - case "$GXX_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSO="$CXXFLAGSO -opt_report_levelmin" - ;; - *) - case "$target" in - *ia64*) - CXXFLAGSO="$CXXFLAGSO -opt-report 0" - ;; - *) - CXXFLAGSO="$CXXFLAGSO -opt-report 0 -vec-report0" - ;; - esac - ;; - esac - - dnl Some versions of icc on some platforms issue a lot of warnings - dnl about the unreliability of floating point comparisons. Check - dnl whether we can switch that off - DEAL_II_ICC_WD_1572 - - dnl We would really like to use -ansi -Xc, since that - dnl is _very_ picky about standard C++, and is thus very efficient - dnl in detecting slight standard violations, but these flags are - dnl also very efficient in crashing the compiler (it generates a - dnl segfault), at least with versions prior to 7.0. So only - dnl use these flags with versions we know are safe - dnl - dnl Second thing: icc7 allows using alias information for - dnl optimization. Use this. - if test "x$GXX_VERSION" = "xintel_icc7"; then - CXXFLAGSG="$CXXFLAGSG -Xc -ansi" - CXXFLAGSO="$CXXFLAGSO -ansi_alias" - dnl For icc8: - dnl avoid the annoying `LOOP WAS VECTORIZED' remarks - dnl use -vec_report0 for reducing output - else if test "x$GXX_VERSION" = "xintel_icc8" ; then - CXXFLAGSO="$CXXFLAGSO -ansi_alias -vec_report0" - fi fi - - dnl If we are on an x86 platform, add -tpp6 to optimization - dnl flags (for version <10), or the equivalent for later - dnl processors - case "$target" in - *x86_64*) - LDFLAGS="$LDFLAGS -lpthread" - ;; - - *86*) - case "$GXX_VERSION" in - intel_icc5) - ;; - intel_icc6 | intel_icc7 | intel_icc8 | intel_icc9) - CXXFLAGSO="$CXXFLAGSO -tpp6" - ;; - *) - CXXFLAGSO="$CXXFLAGSO -mcpu=pentium4" - ;; - esac - ;; - esac - - dnl Intel's MPI implementation based on ICC requires that - dnl mpi.h be included *before* things like or - dnl . How they envision this to work is beyond - dnl me because they may be indirectly included from other - dnl header files. Besides this, autoconf generates tests - dnl that don't follow this rule and so fail at ./configure - dnl time. There is nothing we can do about it. However, - dnl there is a workaround described here: - dnl http://software.intel.com/en-us/articles/intel-mpi-library-for-linux-running-list-of-known-issues/#A3 - dnl We switch this on if we use Intel's ICC + MPI - if test "x$DEAL_II_USE_MPI" = "xyes" ; then - CXXFLAGSG="$CXXFLAGSG -DMPICH_IGNORE_CXX_SEEK" - CXXFLAGSO="$CXXFLAGSO -DMPICH_IGNORE_CXX_SEEK" - fi - - dnl Finally, see if the compiler supports C++0x - DEAL_II_CHECK_CXX1X - ;; - - compaq_cxx) - dnl Disable some warning messages: - dnl #11: ` unrecognized preprocessing directive" (we use - dnl #warning at one place) - dnl #175: `subscript out of range' (detected when instantiating a - dnl template and looking at the indices of an array of - dnl template dependent size, this error is triggered in a - dnl branch that is not taken for the present space dimension) - dnl #236 and - dnl #237: `controlling expression is constant' (in while(true), or - dnl switch(dim)) - dnl #381: `extra ";" ignored' (at function or namespace closing - dnl brace) - dnl #487: `Inline function ... cannot be explicitly instantiated' - dnl (also reported when we instantiate the entire class) - dnl #1136:`conversion to integral type of smaller size could lose data' - dnl (occurs rather often in addition of int and x.size(), - dnl because the latter is size_t=long unsigned int on Alpha) - dnl #1156:`meaningless qualifiers not compatible with "..." and "..."' - dnl (cause unknown, happens when taking the address of a - dnl template member function) - dnl #111 and - dnl #1182:`statement either is unreachable or causes unreachable code' - dnl (happens in switch(dim) clauses for other dimensions than - dnl the present one) - dnl #450:`the type "long long" is nonstandard' - dnl BOOST uses long long, unfortunately - dnl - dnl Also disable the following error: - dnl #265: `class "..." is inaccessible' (happens when we try to - dnl initialize a static member variable in terms of another - dnl static member variable of the same class if the latter is - dnl not public and therefore not accessible at global scope in - dnl general. I nevertheless think that this is valid.) - dnl - dnl Besides this, choose the most standard conforming mode of the - dnl compiler, i.e. -model ansi and -std strict_ansi. Unfortunately, - dnl we have to also add the flag -implicit_local (generating implicit - dnl instantiations of template with the `weak' link flag) since - dnl otherwise not all templates are instantiated (also some from the - dnl standards library are missing). - - CXXFLAGSG="$CXXFLAGSG -model ansi -std strict_ansi -w1 -msg_display_number -timplicit_local -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -model ansi -std strict_ansi -w2 -msg_display_number -timplicit_local -fast" - - for i in 11 175 236 237 381 487 1136 1156 111 1182 265 450 ; do - CXXFLAGSG="$CXXFLAGSG -msg_disable $i" - CXXFLAGSO="$CXXFLAGSO -msg_disable $i" - done - - - dnl If we use -model ansi to compile the files, we also have to - dnl specify it for linking - LDFLAGS="$LDFLAGS -model ansi" - - dnl For some reason, cxx also forgets to add the math lib to the - dnl linker line, so we do that ourselves - LDFLAGS="$LDFLAGS -lm" - - CXXFLAGSPIC="-shared" - LDFLAGSPIC="" - ;; - - sun_workshop | sun_forte) - - CXXFLAGSG="$CXXFLAGSG -DDEBUG -w" - CXXFLAGSO="$CXXFLAGSO -w" - CXXFLAGSPIC="-KPIC" - LDFLAGSPIC="-G" - - dnl See if the flag -library=stlport4 is available, and if so use it - CXXFLAGS="$CXXFLAGSG -library=stlport4" - AC_MSG_CHECKING(whether -library=stlport4 works) - AC_TRY_COMPILE( - [ - ], - [ - ; - ], - [ - AC_MSG_RESULT(yes) - CXXFLAGSG="$CXXFLAGSG -library=stlport4" - CXXFLAGSO="$CXXFLAGSO -library=stlport4" - ], - [ - AC_MSG_RESULT(no) - ]) - ;; - - pgCC*) - dnl Suppress warnings: - dnl #68: "integer conversion resulted in a change of sign". This - dnl is what we get every time we use - dnl numbers::invalid_unsigned_int - dnl #111: "Statement unreachable": we use return statements - dnl occasionally after case-switches where you cannot - dnl fall though, but other compilers sometimes complain - dnl that the function might not return with a value, if - dnl it can't figure out that the function always uses - dnl one case. Also: a return statement after a failing - dnl assertion - dnl #128: a similar case -- code not reachable because there's - dnl a return that's active for a particular space dimension - dnl #155: no va_start() seen -- happens alwas in lines 138 and 891 - dnl and seems to be spurious - dnl #177: "function declared but not used": might happen with - dnl templates and conditional compilation - dnl #175: "out-of-bounds array indices": the same reason as - dnl for Compaq cxx - dnl #185: "dynamic initialization in unreachable code". similar to - dnl the case #128 above - dnl #236: "controlling expression is constant". this triggers - dnl somewhere in BOOST with BOOST_ASSERT. I have no idea - dnl what happens here - dnl #284: "NULL references not allowed" - dnl #497: "declaration of "dim" hides template parameter" (while - dnl theoretically useful, pgCC unfortunately gets this one - dnl wrong on legitimate code where no such parameter is - dnl hidden, see the email by ayaydemir on 9/3/2012) - CXXFLAGSG="$CXXFLAGSG -DDEBUG -g --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284 --diag_suppress 497" - CXXFLAGSO="$CXXFLAGSO -fast -O2 --display_error_number --diag_suppress 68 --diag_suppress 111 --diag_suppress 128 --diag_suppress 155 --diag_suppress 177 --diag_suppress 175 --diag_suppress 185 --diag_suppress 236 --diag_suppress 284 --diag_suppress 497" - CXXFLAGSPIC="-Kpic" - - dnl pgCC can't (as of writing this, with version 12.5 in mid-2012) compile a part of BOOST. - dnl Fortunately, BOOST provides a workaround by setting a specific preprocessor - dnl symbol that can be set. Do so. - CXXFLAGSG="$CXXFLAGSG -DBOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE" - CXXFLAGSO="$CXXFLAGSO -DBOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE" - ;; - - kai_cc) - CXXFLAGSG="$CXXFLAGSG --strict -D__KAI_STRICT --max_pending_instantiations 32 --display_error_number -g +K0 --no_implicit_typename" - CXXFLAGSO="$CXXFLAGSO +K3 -O2 --abstract_float --abstract_pointer -w --display_error_number --max_pending_instantiations 32 --display_error_number" - CXXFLAGSPIC="-fPIC" - ;; - - hp_aCC) - dnl ??? disable warning 655 (about all-inlined functions) which - dnl triggers for each and every of our DeclExceptionX calls ??? - CXXFLAGSG="$CXXFLAGSG -g1 -AA +p" - CXXFLAGSO="$CXXFLAGSO -z +O2 -AA" - CXXFLAGSPIC="+Z" - # for linking shared libs, -b is also necessary... - ;; - - borland_bcc) - CXXFLAGSG="$CXXFLAGSG -q -DDEBUG -w -w-use -w-amp -w-prc" - CXXFLAGSO="$CXXFLAGSO -q -O2" - CXXFLAGSPIC="" - LDFLAGSPIC="" - AC_MSG_ERROR(Attention! deal.II is not known to work with Borland C++! - If you intend to port it to Borland C++, please remove this message from aclocal.m4 and call autoconf and configure. If you do not understand this, you will NOT want to do it!) - ;; - - pathscale_cc) - CXXFLAGSG="$CXXFLAGSG -DDEBUG -g" - CXXFLAGSO="$CXXFLAGSO -O3" - ;; - - *) - CXXFLAGSG="$CXXFLAGSG -DDEBUG" - CXXFLAGSO="$CXXFLAGSO -O2" - AC_MSG_RESULT(Unknown C++ compiler - using generic options) - ;; - esac - fi -]) - - - diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index 6a9bbff932..6a9d3c8f72 100644 --- a/deal.II/cmake/setup_compiler_flags.cmake +++ b/deal.II/cmake/setup_compiler_flags.cmake @@ -83,9 +83,9 @@ IF(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) ENDIF() # - # Setup for ICC compiler: + # Setup for ICC (version >= 10) compiler: # - IF( CMAKE_CXX_COMPILER_ID MATCHES "Intel") + IF( CMAKE_CXX_COMPILER_ID MATCHES "Intel" ) INCLUDE(setup_compiler_flags_intel) SET(DEAL_II_KNOWN_COMPILER TRUE) ENDIF() diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index 96ffea7bb7..0d390947d9 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -19,6 +19,13 @@ # editing this file. # +IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4" ) + MESSAGE(WARNING "\n" + "You're using an old version of the GNU Compiler Collection (gcc/g++)!\n" + "It is strongly recommended to use at least version 3.4.\n" + ) +ENDIF() + ######################## # # @@ -28,8 +35,6 @@ # # Set the pic flag. -# TODO: On some systems, -fpic/PIC is implied, so don't set anything to -# avoid a warning. # ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") @@ -39,7 +44,6 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") # ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") - # # Set -pedantic if the compiler supports it. # @@ -55,7 +59,6 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wsynth") ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wsign-compare") ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wswitch") - # # Newer versions of gcc have a flag -Wunused-local-typedefs that, though in # principle a good idea, triggers a lot in BOOST in various places. @@ -95,24 +98,6 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") ENDIF() -IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") # TODO: Check for correct name - # - # TODO: Is this flag still necessary? Sounds pretty invasive... - # - # On Cygwin, when using shared libraries, there might occur - # difficulties when linking libraries for several dimensions, - # as some symbols are defined in all of them. This leads to a - # linker error. We force the linker to ignore multiple symbols, - # but of course this might lead to strange program behaviour if - # you accidentally defined one symbol multiple times... - # (added 2005/07/13, Ralf B. Schulz) - # (modified 2005/12/20, Ralf B. Schulz) - ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS - "-Xlinker --allow-multiple-definition" - ) -ENDIF() - - ############################## # # # For Release targets: # diff --git a/deal.II/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake index 91f5a73031..9f7247292f 100644 --- a/deal.II/cmake/setup_compiler_flags_intel.cmake +++ b/deal.II/cmake/setup_compiler_flags_intel.cmake @@ -13,6 +13,105 @@ ##### # -# *Yeah* +# 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 "10.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 10.\n" + ) +ENDIF() + + +######################## +# # +# General setup: # +# # +######################## + +# +# Set the pic flag. +# +ENABLE_IF_SUPPORTED(CMAKE_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(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") + +# +# Set ansi mode: +# +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-ansi") + +# +# Enable verbose warnings: +# +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-w2") + +# +# Disable some warnings that lead to a lot of false positives: +# +# -w175 subscript out of range +# -w177 declared but not referenced +# -w1478 deprecation warning +# +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd175") +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd177") +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1478") + + +############################## +# # +# For Release targets: # +# # +############################## + +IF (CMAKE_BUILD_TYPE MATCHES "Release") + # + # General optimization flags: + # + ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") + + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-loops") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-ansi-alias") # equiv. -fstrict-aliasing +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() + + +######################### +# # +# Set up C FLAGS: # +# # +######################### + +# +# For the moment we assume that CC and CXX are the same compiler and that +# we can set (almost) the same default flags for both: +# +SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) +SET(DEAL_II_C_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) +SET(DEAL_II_C_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) diff --git a/deal.II/include/deal.II/lac/block_indices.h b/deal.II/include/deal.II/lac/block_indices.h index a78d0eae0f..2f2c4cc4c5 100644 --- a/deal.II/include/deal.II/lac/block_indices.h +++ b/deal.II/include/deal.II/lac/block_indices.h @@ -396,7 +396,7 @@ std::pair BlockIndices::global_to_local (const unsigned int i) const { Assert (i 0, ExcLowrRange(i, 1)); + Assert (n_blocks > 0, ExcLowerRange(i, 1)); unsigned int block = n_blocks-1; while (i < start_indices[block]) -- 2.39.5