-
Notifications
You must be signed in to change notification settings - Fork 18
Clean up compiler flag specification #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
fmahebert
wants to merge
7
commits into
develop
Choose a base branch
from
feature/cleanup_compiler_flags_part1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e3b989f
Clean up compiler flag specification
fmahebert 27a2d20
Trigger CI
fmahebert 49f7231
trigger ci
eap 868d24f
Fix jedi-ci config
eap 902c48e
trigger ci
eap 5ab2f50
Merge branch 'develop' into feature/cleanup_compiler_flags_part1
eap 97bd832
Merge branch 'develop' into feature/cleanup_compiler_flags_part1
eap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # (C) Copyright 2026 UCAR | ||
| # | ||
| # This software is licensed under the terms of the Apache Licence Version 2.0 | ||
| # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
|
|
||
|
|
||
| # IntelLLVM | ||
| if(CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM) | ||
| set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Release-with-debug-info C++ compiler flags" FORCE) | ||
| endif() | ||
| if(CMAKE_C_COMPILER_ID STREQUAL IntelLLVM) | ||
| set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Release-with-debug-info C compiler flags" FORCE) | ||
| endif() | ||
| if(CMAKE_Fortran_COMPILER_ID STREQUAL IntelLLVM) | ||
| set(Fortran_AUTOMATIC_ARRAYS_LIMIT 32768) # (32 kb) | ||
| math(EXPR Fortran_AUTOMATIC_ARRAYS_LIMIT_KB "${Fortran_AUTOMATIC_ARRAYS_LIMIT}/1024") | ||
|
|
||
| set(Fortran_FLAG_STACK_ARRAYS "-no-heap-arrays") | ||
| set(Fortran_FLAG_AUTOMATIC_ARRAYS "-heap-arrays ${Fortran_AUTOMATIC_ARRAYS_LIMIT_KB}") | ||
|
|
||
| set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG -unroll -inline ${Fortran_FLAG_AUTOMATIC_ARRAYS}" CACHE STRING "Release Fortran flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${Fortran_FLAG_AUTOMATIC_ARRAYS}" CACHE STRING "Release-with-debug-info Fortran flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_BIT "-O2 -DNDEBUG -unroll -inline ${Fortran_FLAG_AUTOMATIC_ARRAYS}" CACHE STRING "Bit-reproducible Fortran flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -traceback ${Fortran_FLAG_AUTOMATIC_ARRAYS} -check all" CACHE STRING "Debug Fortran flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_PRODUCTION "-O3 -g ${Fortran_FLAG_AUTOMATIC_ARRAYS}" CACHE STRING "Production Fortran compiler flags" FORCE) | ||
| endif() | ||
|
|
||
|
|
||
| # NVHPC | ||
| if(CMAKE_CXX_COMPILER_ID STREQUAL NVHPC) | ||
| set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C++ compiler flags" FORCE) | ||
| set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Release-with-debug-info C++ compiler flags" FORCE) | ||
| endif() | ||
| if(CMAKE_C_COMPILER_ID STREQUAL NVHPC) | ||
| set(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production C compiler flags" FORCE) | ||
| set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Release-with-debug-info C compiler flags" FORCE) | ||
| endif() | ||
| if(CMAKE_Fortran_COMPILER_ID STREQUAL NVHPC) | ||
| set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -DNDEBUG" CACHE STRING "Release Fortran compiler flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_BIT "-O2 -DNDEBUG" CACHE STRING "Bit-reproducible Fortran compiler flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -traceback" CACHE STRING "Debug Fortran compiler flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_PRODUCTION "-O3 -g" CACHE STRING "Production Fortran compiler flags" FORCE) | ||
| set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Release-with-debug-info Fortran compiler flags" FORCE) | ||
| endif() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,27 @@ | ||
| # (C) Copyright 2026 UCAR | ||
| # | ||
| # This software is licensed under the terms of the Apache Licence Version 2.0 | ||
| # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
|
|
||
| if( NOT CMAKE_BUILD_TYPE MATCHES "Debug" ) | ||
| add_definitions( -DNDEBUG ) | ||
| endif() | ||
|
|
||
| ####################################################################################### | ||
| # Fortran | ||
| ####################################################################################### | ||
|
|
||
| message(STATUS "Compiler ID: ${CMAKE_Fortran_COMPILER_ID}") | ||
| message(STATUS "Compiler: ${CMAKE_Fortran_COMPILER}") | ||
|
|
||
| set(CMAKE_FORTRAN_STANDARD 08) | ||
| set(CMAKE_FORTRAN_STANDARD_REQUIRED ON) | ||
| set(CMAKE_FORTRAN_EXTENSIONS OFF) | ||
|
|
||
| if( CMAKE_Fortran_COMPILER_ID STREQUAL "GNU" ) | ||
| include( compiler_flags_GNU_Fortran ) | ||
|
|
||
| elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "IntelLLVM" ) | ||
| include( compiler_flags_IntelLLVM_Fortran ) | ||
| # Set compiler flags for basic build types, | ||
| # for compilers where this is not provided by ecbuild. | ||
| include(build_type_compiler_flags) | ||
|
|
||
| elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" ) | ||
| include( compiler_flags_Intel_Fortran ) | ||
| # Set JEDI's common compiler flags | ||
| include(jedi_common_compiler_flags) | ||
|
|
||
| elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" OR CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC" ) | ||
| include( compiler_flags_NVHPC_Fortran ) | ||
|
|
||
| elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "XL" ) | ||
| include( compiler_flags_XL_Fortran ) | ||
|
|
||
| elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Cray" ) | ||
| include( compiler_flags_Cray_Fortran ) | ||
|
|
||
| else() | ||
| message( STATUS "Fortran compiler with ID ${CMAKE_Fortran_COMPILER_ID} will be used with CMake default options") | ||
| # Set CRTM-specific compiler flags | ||
| if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) | ||
| ecbuild_add_fortran_flags("-ffree-line-length-none") | ||
| endif() | ||
| if(CMAKE_Fortran_COMPILER_ID STREQUAL Intel) | ||
| ecbuild_add_fortran_flags("-assume byterecl") | ||
| endif() | ||
| if(CMAKE_Fortran_COMPILER_ID STREQUAL IntelLLVM) | ||
| # to match historical behavior, disable RelWithDebugInfo optimization for IntelLLVM | ||
| # TODO: determine source of problem and resolve in a more elegant way, then return | ||
| # to default compiler flags so that RELWITHDEBINFO does what it says | ||
| set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O0 -g -DNDEBUG -traceback -heap-arrays 32" ) | ||
| ecbuild_add_fortran_flags("-assume byterecl") | ||
| endif() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spoke with @BenjaminTJohnson — CRTM has the requirement of being buildable outside of the JEDI environment, in particular of being buildable as a standalone repo with a CMake (not ecbuild) build system.
Thus, these
ecbuildfunctions shouldn't be used to specify flags.I'll go back and rethink this PR to see if I can improve the consistency of CRTM flags with the rest of JEDI, while still falling within CRTM's constraints.