Skip to content

Commit 7e325c1

Browse files
rem1776rem1776
authored andcommitted
update flags to match mkmf templates and multiple test fixes
1 parent d83abe7 commit 7e325c1

23 files changed

+204
-131
lines changed

CMAKE_INSTRUCTIONS.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,55 @@
11
\page cmake Building with CMake
22
# Instructions for building FMS with cmake
33

4-
## 1. Environment Variables
4+
## 1. Configuring the build
55

6-
### For GNU compilers on Linux with the bash shell:
6+
### Environment Variables
77

8+
#### For GNU compilers on Linux with the bash shell:
89
```
910
export FC=mpifort
1011
export CC=mpicc
1112
```
12-
13-
### For Intel Compilers on Linux with the bash shell:
14-
13+
#### For Intel Compilers on Linux with the bash shell:
1514
```
1615
export FC=mpiifort
1716
export CC=mpiicc
1817
```
18+
MPI compiler wrappers may be named different on your system, so its best to ensure the compiler commands work prior to being set.
1919

20-
### NetCDF is provided via the `nc-config` command:
20+
#### NetCDF is provided via the `nc-config` command:
2121
```
2222
export NetCDF_ROOT=`nc-config --prefix`
2323
```
2424

25-
### If building with yaml parser (-DWITH_YAML)
25+
#### If building with yaml parser (-DWITH_YAML)
2626
```
2727
export LIBYAML_ROOT=<your libyaml install directory>
2828
```
2929

30-
### Setting custom flags with the bash shell
31-
To override the default compiler flags:
30+
### Running CMake
31+
It's best to create a build directory inside of the FMS folder to avoid building on top of the source code.
32+
Once that is done, CMake can be ran to generate the necessary build files:
3233
```
33-
export FCFLAGS="<fortran flags>"
34-
export CFLAGS="<c flags>"
34+
mkdir build && cd build
35+
cmake [-DWITH_YAML=on] ..
3536
```
36-
In addition, the flag below must be included with the cmake command:
37+
38+
### Setting a Build Type
39+
CMake uses "build types" to set compiler flags. By default (.ie no -DCMAKE_BUILD_TYPE="Type" argument when cmake is run), it will use the "Release" build type which corresponds the the prod/opt flags used by the GFDL mkmf templates.
40+
41+
Similarly "Repro" and "Debug" also correspond to whatever options would be set by theircorresponding mkmf template files.
42+
43+
To reproduce the old behavior for the cmake build (2025.03 and prior), the "ReleaseUFS" and "DebugUFS" will use the same flags as before.
44+
45+
Please open an issue in the FMS repository if you have any issues or would like to request any changes to the current build type options.
46+
47+
### Setting custom flags
48+
To override the default compiler flags, you can set them via CMake arguments:
3749
```
38-
cmake <any other options> -DCMAKE_BUILD_TYPE=Debug ..
50+
cmake -DCMAKE_BUILD_TYPE="NoFlags" -DCMAKE_C_FLAGS="<c flags>" -DCMAKE_Fortran_FLAGS="<fortran flags>"
3951
```
52+
By using the "NoFlags" build type, only necessary compilation flags will be added besides what is set via the cmake arguments.
4053

4154
## 2. Build and install FMS with CMake
4255
`<prefix>` is the full install directory for FMS provided by user
@@ -45,20 +58,25 @@ cmake <any other options> -DCMAKE_BUILD_TYPE=Debug ..
4558
cd FMS
4659
mkdir -p build && cd build
4760
cmake -DCMAKE_INSTALL_PREFIX=<prefix> ..
48-
make -j4
61+
make -j
4962
make install
5063
```
5164

5265
### User configurable options:
53-
By default, FMS is built without `OpenMP`, in `single precision (r4)` and delivered in static library files.
66+
By default, FMS is built with `OpenMP` enabled and delivered in static library files.
67+
68+
FMS has mixed precision real support for most interfaces. By default, one library will be created,
69+
`libfms`, that is compiled with r8 defaults but also contains overloaded r4 routines.
5470

5571
The 64BIT and 32BIT precision options will build distinct libraries when enabled with the given default
56-
real size, libfms_r4 or libfms_r8.
72+
real size, libfms_r4 or libfms_r8. These option are provided for backwards compatibility, but are no longer
73+
supported by our development team, since mixed precision can now be used with a single library.
74+
Unit tests currently only work when no precision option is specified.
5775

5876
The following build options are available:
5977
```
60-
-DOPENMP "Build FMS with OpenMP support" DEFAULT: OFF
61-
-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: ON
78+
-DOPENMP "Build FMS with OpenMP support" DEFAULT: ON
79+
-D32BIT "Build 32-bit (r4) FMS library" DEFAULT: OFF
6280
-D64BIT "Build 64-bit (r8) FMS library" DEFAULT: OFF
6381
-DFPIC "Build with position independent code" DEFAULT: OFF
6482
-DSHARED_LIBS "Build shared/dynamic libraries" DEFAULT: OFF
@@ -74,10 +92,10 @@ The following build options are available:
7492

7593
## 3. Installation structure
7694

77-
When the above command finishes, the `<prefix>` will have an `include_r4` and a `lib` directory. The `lib ` directory will have these files:
95+
When the above command finishes, the `<prefix>` will have an `include` and a `lib` directory. The `lib ` directory will have these files:
7896

7997
```
80-
libfms_r4.a
98+
libfms.a
8199
cmake/fms/fms-targets.cmake
82100
cmake/fms/fms-targets-release.cmake
83101
cmake/fms/fms-config.cmake

CMakeLists.txt

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ project(FMS
3030

3131
include(GNUInstallDirs)
3232

33-
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel|DebugUFS)$")
33+
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel|DebugUFS|ReleaseUFS|NoFlags|Repro)$")
3434
message(STATUS "Setting build type to 'Release' as none was specified.")
3535
set(CMAKE_BUILD_TYPE
3636
"Release"
3737
CACHE STRING "Choose the type of build." FORCE)
38-
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "DebugUFS")
38+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "DebugUFS" "ReleaseUFS" "NoFlags" "Repro")
3939
endif()
4040

4141
if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|IntelLLVM)$")
@@ -52,15 +52,15 @@ endif()
5252
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
5353

5454
# Build options
55-
option(OPENMP "Build FMS with OpenMP support" OFF)
55+
option(OPENMP "Build FMS with OpenMP support" ON)
5656
option(32BIT "Build 32-bit (r4) FMS library" OFF)
5757
option(64BIT "Build 64-bit (r8) FMS library" OFF)
5858
option(FPIC "Build with position independent code" OFF)
5959
option(SHARED_LIBS "Build shared/dynamic libraries" OFF)
6060

6161
# Options for compiler definitions
6262
option(INTERNAL_FILE_NML "Enable compiler definition -DINTERNAL_FILE_NML" ON)
63-
option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" ON)
63+
option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION" OFF)
6464
option(PORTABLE_KINDS "Enable compiler definition -DPORTABLE_KINDS" OFF)
6565
option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF)
6666
option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF)
@@ -343,7 +343,7 @@ foreach(kind ${kinds})
343343
amip_interp/include)
344344
target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}")
345345
target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}")
346-
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}")
346+
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags})
347347
set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY
348348
${moduleDir})
349349
target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran
@@ -485,7 +485,7 @@ if(NOT kinds)
485485
amip_interp/include)
486486
target_compile_definitions(${libTgt}_f PRIVATE "${fms_defs}")
487487
target_compile_definitions(${libTgt}_f PRIVATE "${${kind}_defs}")
488-
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS "${${kind}_flags}")
488+
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags})
489489
set_target_properties(${libTgt}_f PROPERTIES Fortran_MODULE_DIRECTORY
490490
${moduleDir})
491491
target_link_libraries(${libTgt}_f PRIVATE NetCDF::NetCDF_Fortran
@@ -551,6 +551,7 @@ if(NOT kinds)
551551

552552
target_compile_definitions(${libTgt} PRIVATE "${fms_defs}")
553553
target_compile_definitions(${libTgt} PRIVATE "${${kind}_defs}")
554+
set_target_properties(${libTgt}_f PROPERTIES COMPILE_FLAGS ${${kind}_flags})
554555

555556
target_link_libraries(${libTgt} PUBLIC NetCDF::NetCDF_C
556557
NetCDF::NetCDF_Fortran
@@ -594,13 +595,14 @@ list(APPEND TEST_MODS_SRC
594595
test_fms/fms/test_fms.F90
595596
test_fms/fms2_io/argparse.F90
596597
test_fms/fms2_io/setup.F90
597-
# test_fms/mosaic2/write_files.F90
598+
test_fms/mosaic2/write_files.F90
598599
test_fms/mpp/compare_data_checksums.F90
599600
test_fms/mpp/compare_data_checksums_int.F90
600601
test_fms/mpp/fill_halo.F90
601602
test_fms/mpp/test_domains_utility_mod.F90
602603
test_fms/mpp/test_mpp_update_domains_int.F90
603604
test_fms/mpp/test_mpp_update_domains_real.F90
605+
test_fms/mpp/test_mpp_update_domains_ad.F90
604606
test_fms/mpp/test_system_clock.F90)
605607

606608
add_library(testLibs "${TEST_MODS_SRC}")
@@ -716,10 +718,8 @@ list(APPEND TEST_SRC_SINGLE_TARGET
716718
test_fms/mpp/test_mpp_sendrecv.F90
717719
test_fms/mpp/test_mpp_sum.F90
718720
test_fms/mpp/test_mpp_transmit.F90
721+
test_fms/mpp/test_mpp_update_domains.F90
719722
test_fms/mpp/test_mpp_update_domains_ad.F90
720-
test_fms/mpp/test_mpp_update_domains_int.F90
721-
test_fms/mpp/test_mpp_update_domains_main.F90
722-
test_fms/mpp/test_mpp_update_domains_real.F90
723723
test_fms/mpp/test_peset.F90
724724
test_fms/mpp/test_mpp_read_ascii_file.F90
725725
test_fms/mpp/test_read_input_nml.F90
@@ -774,7 +774,7 @@ foreach (testFile ${TEST_SRC_SINGLE_TARGET})
774774

775775
add_executable(${TName} ${testFile})
776776
target_compile_definitions(${TName} PRIVATE "${r8_defs}")
777-
set_target_properties(${TName} PROPERTIES COMPILE_FLAGS "${r8_flags}")
777+
set_target_properties(${TName} PROPERTIES COMPILE_FLAGS ${r8_flags})
778778
target_link_libraries(${TName} PUBLIC FMS::fms
779779
PRIVATE testLibs
780780
)
@@ -801,14 +801,16 @@ foreach (testFile ${TEST_SRC_MULTI_TARGET})
801801

802802
add_executable(${TName}_r8 ${testFile})
803803
target_compile_definitions(${TName}_r8 PRIVATE "${r8_defs}")
804-
set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS "${r8_flags}")
804+
set_target_properties(${TName}_r8 PROPERTIES COMPILE_FLAGS ${r8_flags})
805805
target_link_libraries(${TName}_r8 PUBLIC FMS::fms
806806
PRIVATE testLibs
807807
)
808808

809809
add_executable(${TName}_r4 ${testFile})
810810
target_compile_definitions(${TName}_r4 PRIVATE "${r4_defs}")
811-
set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS "${r4_flags}")
811+
# seems counterintuitive but r4 tests use r8 default
812+
# they specify kind values explicitly with the preprocessor where needed (TEST_FMS_KIND_)
813+
set_target_properties(${TName}_r4 PROPERTIES COMPILE_FLAGS ${r8_flags})
812814
target_link_libraries(${TName}_r4 PUBLIC FMS::fms
813815
PRIVATE testLibs
814816
)
@@ -837,10 +839,15 @@ foreach (testFile ${TEST_SRC_MULTI_TARGET})
837839
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/data_override/include
838840
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_fms/mosaic2
839841
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
842+
#set macros used to test mixed precision
840843
target_compile_definitions(${TName}_r8 PRIVATE TEST_FMS_KIND_=r8_kind)
841844
target_compile_definitions(${TName}_r4 PRIVATE TEST_FMS_KIND_=r4_kind)
842845
target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc)
843846
target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4)
847+
target_compile_definitions(${TName}_r8 PRIVATE FMS_TEST_BC_TYPE_=bc)
848+
target_compile_definitions(${TName}_r4 PRIVATE FMS_TEST_BC_TYPE_=bc_r4)
849+
target_compile_definitions(${TName}_r8 PRIVATE WRITE_FILES_MOD_=write_files_r8)
850+
target_compile_definitions(${TName}_r4 PRIVATE WRITE_FILES_MOD_=write_files_r4)
844851
endforeach ()
845852

846853
# gather all test scripts
@@ -862,7 +869,9 @@ foreach (testScript ${TEST_SCRIPTS})
862869
set_property(TEST ${testName} PROPERTY LABELS ${testDirName})
863870
# set an environment variable so the scripts know to skip tests that use libyaml
864871
if(NOT WITH_YAML)
865-
set_property(TEST ${testName} PROPERTY ENVIRONMENT skipflag=skip;parser_skip=skip;skip_yaml=yes)
872+
set_tests_properties(${testName} PROPERTIES
873+
ENVIRONMENT "skipflag=skip;parser_skip=skip;skip_yaml=yes"
874+
)
866875
endif()
867876
endforeach()
868877

cmake/compiler_flags_GNU_C.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# GNU C
2-
set(CMAKE_C_FLAGS_RELEASE "-O3")
3-
4-
set(CMAKE_C_FLAGS_DEBUGUFS "-O0 -g")
2+
set(CMAKE_C_FLAGS "")
3+
set(CMAKE_C_FLAGS_RELEASE "-O2")
4+
set(CMAKE_C_FLAGS_REPRO "-O2")
5+
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
56

67
set(CMAKE_C_LINK_FLAGS "")
8+
9+
# ufs flags
10+
set(CMAKE_C_FLAGS_RELEASEUFS "-O3")
11+
set(CMAKE_C_FLAGS_DEBUGUFS "-O0 -g")

cmake/compiler_flags_GNU_Fortran.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
set(r8_flags "-fdefault-real-8 -fdefault-double-8") # Fortran flags for 64BIT precision
33

44
# GNU Fortran
5-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fcray-pointer -fconvert=big-endian -ffree-line-length-none -fno-range-check -fbacktrace")
5+
set(CMAKE_Fortran_FLAGS "")
66

7-
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -funroll-all-loops -finline-functions")
7+
set(base_flags "-fcray-pointer -fdefault-double-8 -Waliasing -ffree-line-length-none -fno-range-check -fallow-argument-mismatch")
88

9-
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" )
9+
set(CMAKE_Fortran_FLAGS_RELEASE "${base_flags} -O2 -fno-expensive-optimizations")
10+
set(CMAKE_Fortran_FLAGS_DEBUG "${base_flags} -O0 -g -W -fbounds-check -ffpe-trap=invalid,zero,overflow")
1011

1112
set(CMAKE_Fortran_LINK_FLAGS "" )
13+
14+
#ufs flags
15+
set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O3 -funroll-all-loops -finline-functions")
16+
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-O0 -g -fcheck=bounds -ffpe-trap=invalid,zero,overflow,underflow" )
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
# Intel LLVM based C
22

3-
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -traceback")
3+
# flags from mkmf intel oneapi template
4+
# Release is prod/opt flags, debug and repro are the same
5+
set( CMAKE_C_FLAGS_BASE "-sox -traceback -march=core-avx-i")
46

5-
set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal")
7+
set( isa_flags "-march=core-avx-i")
68

7-
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapv")
9+
set( CMAKE_C_FLAGS "")
10+
11+
set( CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal ${CMAKE_C_FLAGS_BASE} ${isa_flags}")
12+
set( CMAKE_C_FLAGS_DEBUG "-O0 -g ${CMAKE_C_FLAGS_BASE}")
13+
set( CMAKE_C_FLAGS_REPRO "-O2 -debug minimal ${CMAKE_C_FLAGS_BASE} ${isa_flags}")
14+
set( CMAKE_C_FLAGS_NOFLAGS "")
815

916
set( CMAKE_C_LINK_FLAGS "")
17+
18+
# sets of flags used by ufs
19+
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapv -traceback")
20+
set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal")
21+

cmake/compiler_flags_IntelLLVM_Fortran.cmake

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision
33
set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision
44

5-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback")
5+
set(isa_flag "-march=core-avx-i")
66

7-
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align")
7+
# base flags from mkmf oneapi template
8+
set(CMAKE_Fortran_FLAGS_BASE "-fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -i4 -nowarn -traceback")
89

9-
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
10+
# set the default as empty so we can add on to it
11+
set(CMAKE_Fortran_FLAGS "")
1012

11-
set(CMAKE_Fortran_LINK_FLAGS "")
13+
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -debug minimal -fp-model source ${isa_flag} ${CMAKE_Fortran_FLAGS_BASE}")
14+
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -check nouninit -warn -warn noerrors -fpe0 -ftrapuv ${isa_flag} ${CMAKE_Fortran_FLAGS_BASE}")
15+
set(CMAKE_Fortran_FLAGS_REPRO "-O2 -debug minimal -fp-model source ${isa_flag} ${CMAKE_Fortran_FLAGS_BASE}")
16+
set(CMAKE_Fortran_FLAGS_NOFLAGS "")
17+
18+
set(CMAKE_Fortran_LINK_FLAGS "-fuse-ld=lld")
19+
20+
# ufs flags
21+
set(CMAKE_Fortran_SHARED_FLAGS "-fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -traceback")
22+
set(CMAKE_Fortran_FLAGS_RELEASEUFS "-O2 -debug minimal -nowarn -qoverride-limits -qno-opt-dynamic-align ${CMAKE_Fortran_SHARED_FLAGS}")
23+
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv ${CMAKE_Fortran_SHARED_FLAGS}")

cmake/compiler_flags_Intel_C.cmake

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Intel C
2-
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -sox -traceback")
2+
set( CMAKE_C_FLAGS "")
33

4-
set( CMAKE_C_FLAGS_RELEASE "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source")
4+
set( base_flags "-sox -traceback")
55

6-
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapuv")
6+
set( isa_flags "-march=core-avx-i -qno-opt-dynamic-align")
7+
8+
set( CMAKE_C_FLAGS_RELEASE "-O2 -debug minimal ${base_flags} ${isa_flags}")
9+
set( CMAKE_C_FLAGS_REPRO "-O2 -debug minimal ${base_flags} ${isa_flags}")
10+
set( CMAKE_C_FLAGS_DEBUG "-O0 -g -ftrapuv ${base_flags} ${isa_flags}")
711

812
set( CMAKE_C_LINK_FLAGS "")
13+
14+
# ufs flags
15+
set( CMAKE_C_FLAGS_RELEASEUFS "-qno-opt-dynamic-align -O2 -debug minimal -fp-model source")
16+
set( CMAKE_C_FLAGS_DEBUGUFS "-O0 -g -ftrapuv")

cmake/compiler_flags_Intel_Fortran.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,17 @@ set(r4_flags "-real-size 32") # Fortran flags for 32BIT precision
33
set(r8_flags "-real-size 64") # Fortran flags for 64BIT precision
44
set(r8_flags "${r8_flags} -no-prec-div -no-prec-sqrt")
55

6-
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback")
6+
set(isa_flags "-march=core-avx-i -qno-opt-dynamic-align")
77

8-
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3")
8+
set(CMAKE_Fortran_FLAGS "")
9+
set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -debug minimal -fp-model source ${isa_flags}")
10+
set(CMAKE_Fortran_FLAGS_REPRO "-O2 -debug minimal -fp-model source ${isa_flags}")
11+
set(CMAKE_Fortran_FLAGS_DEBUG "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv ${isa_flags}")
912

10-
set(CMAKE_Fortran_FLAGS_DEBUGUFS "-g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
13+
# ufs flags
14+
set(ufs_flags_base "${CMAKE_Fortran_FLAGS} -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -align array64byte -nowarn -sox -traceback")
15+
16+
set(CMAKE_Fortran_FLAGS_RELEASE "${ufs_flags_base} -O2 -debug minimal -fp-model source -nowarn -qoverride-limits -qno-opt-dynamic-align -qopt-prefetch=3")
17+
set(CMAKE_Fortran_FLAGS_DEBUGUFS "${ufs_flags_base} -g -O0 -check -check noarg_temp_created -check nopointer -warn -warn noerrors -fpe0 -ftrapuv")
1118

1219
set(CMAKE_Fortran_LINK_FLAGS "")

0 commit comments

Comments
 (0)