33###################################################################################################
44set (Fortran_COMPILER_VERSION_MIN 19)
55
6- if (OPENMP)
7- set (OPENMP_FLAGS "-fiopenmp" )
8- endif ()
9-
10- if (OPTIMIZATION STREQUAL "OFF" OR OPTIMIZATION STREQUAL "DEBUG" )
11- set (OPTIMIZATION_FLAGS "-O0" )
12- elseif (OPTIMIZATION STREQUAL "DEFENSIVE" )
13- set (OPTIMIZATION_FLAGS "-O2" )
14- elseif (OPTIMIZATION STREQUAL "AGGRESSIVE" )
15- set (OPTIMIZATION_FLAGS "-O3 -fp-model strict -xHost -align array64byte" ) # -ipo/-flto give linker error
16- endif ()
17-
18- # set (STANDARD_CHECK "-stand f23 -standard-semantics -assume nostd_mod_proc_name")
6+ if (OPENMP)
7+ set (OPENMP_FLAGS "-fiopenmp" )
8+ endif ()
9+
10+ if (OPTIMIZATION STREQUAL "OFF" OR OPTIMIZATION STREQUAL "DEBUG" )
11+ set (OPTIMIZATION_FLAGS "-O0" )
12+ elseif (OPTIMIZATION STREQUAL "DEFENSIVE" )
13+ set (OPTIMIZATION_FLAGS "-O2" )
14+ elseif (OPTIMIZATION STREQUAL "AGGRESSIVE" )
15+ set (OPTIMIZATION_FLAGS "-O3 -fp-model strict -xHost -align array64byte" ) # -ipo/-flto give linker error
16+ endif ()
17+
18+ # set(STANDARD_CHECK "-stand f23 -standard-semantics -assume nostd_mod_proc_name")
1919# -assume std_mod_proc_name (included in -standard-semantics) causes problems if other modules
2020# (PETSc, HDF5) are not compiled with this option
2121# https://community.intel.com/t5/Intel-Fortran-Compiler/building-and-linking-against-a-Fortran-dynamic-library-on-Linux/td-p/1178514
2222# -standard-semantics causes a bizzare increase in runtime on matesting (Intel(R) Xeon(R) CPU X5670)
2323# so use only -fpscomp logicals.
2424# https://fortran-lang.discourse.group/t/performance-drop-when-using-intel-oneapi-with-standard-sematics-option/9944/5
25- set (STANDARD_CHECK "-stand f23 -fpscomp logicals" )
25+ set (STANDARD_CHECK "-stand f23 -fpscomp logicals" )
2626
2727# Link against shared Intel libraries instead of static ones:
28- set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel" )
28+ set (LINKER_FLAGS "${LINKER_FLAGS} -shared-intel" )
2929# enforce use of ifx for MPI wrapper:
30- set (LINKER_FLAGS "${LINKER_FLAGS} -fc=ifx" )
30+ set (LINKER_FLAGS "${LINKER_FLAGS} -fc=ifx" )
3131
3232#------------------------------------------------------------------------------------------------
3333# Fine tuning compilation options
3434#------------------------------------------------------------------------------------------------
3535# disable flush underflow to zero, will be set if -O[1,2,3]:
36- set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz" )
36+ set (COMPILE_FLAGS "${COMPILE_FLAGS} -no-ftz" )
3737
3838# disable warnings ...
39- set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable" )
39+ set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable" )
4040# ... the text exceeds right hand column allowed on the line (enforced by pre-receive hook)
41- set (COMPILE_FLAGS "${COMPILE_FLAGS} 5268" )
41+ set (COMPILE_FLAGS "${COMPILE_FLAGS} 5268" )
4242# ... about deprecated forall (has nice syntax and most likely a performance advantage)
43- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,7624" )
43+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,7624" )
4444
4545# enable warnings ...
46- set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn" )
46+ set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn" )
4747# ... any undeclared names (alternative name: -implicitnone)
48- set (COMPILE_FLAGS "${COMPILE_FLAGS} declarations" )
48+ set (COMPILE_FLAGS "${COMPILE_FLAGS} declarations" )
4949# ... warning messages and informational messages are issued by the compiler
50- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,general" )
50+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,general" )
5151# ... questionable programming practices
52- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,usage" )
52+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,usage" )
5353# ... checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks
54- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,interfaces" )
54+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,interfaces" )
5555# ... %LOC is stripped from an actual argument
56- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,ignore_loc" )
56+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,ignore_loc" )
5757# ... data that is not naturally aligned
58- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,alignments" )
58+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,alignments" )
5959# ... declared variables that are never used
60- set (COMPILE_FLAGS "${COMPILE_FLAGS} ,unused" )
60+ set (COMPILE_FLAGS "${COMPILE_FLAGS} ,unused" )
6161
6262# Additional options
6363# -warn: enables warnings, where
@@ -71,53 +71,53 @@ set (COMPILE_FLAGS "${COMPILE_FLAGS},unused")
7171# Runtime debugging
7272#------------------------------------------------------------------------------------------------
7373# Generate symbolic debugging information in the object file
74- set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )
74+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )
7575
7676# Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time
77- set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback" )
77+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback" )
7878
7979# Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/
80- set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces" )
80+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces" )
8181
8282# Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state
83- # set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check") not available on ifx 2025.0.4
83+ # set(DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check") not available on ifx 2025.0.4
8484
8585# Trap uninitalized variables
86- set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict" )
86+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict" )
8787
8888# Check at runtime ...
89- set (DEBUG_FLAGS "${DEBUG_FLAGS} -check" )
89+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -check" )
9090# ... if an array index is too small (<1) or too large!
91- set (DEBUG_FLAGS "${DEBUG_FLAGS} bounds" )
91+ set (DEBUG_FLAGS "${DEBUG_FLAGS} bounds" )
9292# ... for the data type of an item being formatted for output.
93- set (DEBUG_FLAGS "${DEBUG_FLAGS} ,format" )
93+ set (DEBUG_FLAGS "${DEBUG_FLAGS} ,format" )
9494# ... for the fit of data items within a designated format descriptor field.
95- set (DEBUG_FLAGS "${DEBUG_FLAGS} ,output_conversion" )
95+ set (DEBUG_FLAGS "${DEBUG_FLAGS} ,output_conversion" )
9696# ... for certain disassociated or uninitialized pointers or unallocated allocatable objects.
97- set (DEBUG_FLAGS "${DEBUG_FLAGS} ,pointers" )
97+ set (DEBUG_FLAGS "${DEBUG_FLAGS} ,pointers" )
9898# ... for uninitialized variables.
99- set (DEBUG_FLAGS "${DEBUG_FLAGS} ,nouninit" ) # https://fortran-lang.discourse.group/t/issue-with-stdlib-and-intel-oneapi-fortran-compiler-ifx-2024-0/7049/4
99+ set (DEBUG_FLAGS "${DEBUG_FLAGS} ,nouninit" ) # https://fortran-lang.discourse.group/t/issue-with-stdlib-and-intel-oneapi-fortran-compiler-ifx-2024-0/7049/4
100100# ... capture all floating-point exceptions, need to overwrite -no-ftz
101- set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0 -ftz" )
101+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all=0 -ftz" )
102102
103103# Initialize logical to false, integer to -huge, float+complex to signaling NaN
104- set (DEBUG_FLAGS "${DEBUG_FLAGS} -init=arrays,zero,minus_huge,snan" )
104+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -init=arrays,zero,minus_huge,snan" )
105105
106106# disable due to compiler bug https://community.intel.com/t5/Intel-Fortran-Compiler/false-positive-stand-f18-and-IEEE-SELECTED-REAL-KIND/m-p/1227336
107107# enables warnings ...
108- #set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn")
108+ #set(DEBUG_FLAGS "${DEBUG_FLAGS} -warn")
109109# ... warnings are changed to errors
110- #set (DEBUG_FLAGS "${DEBUG_FLAGS} errors")
110+ #set(DEBUG_FLAGS "${DEBUG_FLAGS} errors")
111111# ... warnings about Fortran standard violations are changed to errors
112- #set (DEBUG_FLAGS "${DEBUG_FLAGS},stderrors")
112+ #set(DEBUG_FLAGS "${DEBUG_FLAGS},stderrors")
113113
114114# generate debug information for parameters
115- set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all" )
115+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all" )
116116
117117# generate complete debugging information
118118# Additional options
119119# -heap-arrays: Should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
120120# -check: Checks at runtime, where
121121# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
122122# stack:
123- set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug all" )
123+ set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug all" )
0 commit comments