Skip to content
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

Correct way to set compiler flags #193

Closed
climbfuji opened this issue Dec 27, 2018 · 1 comment
Closed

Correct way to set compiler flags #193

climbfuji opened this issue Dec 27, 2018 · 1 comment

Comments

@climbfuji
Copy link
Collaborator

climbfuji commented Dec 27, 2018

Currently, the cmake build system uses CMAKE_Fortran_FLAGS as default compiler options for all CAPS and SCHEMES. These options are added to the compiler options for individual files, because of the definition

set_target_properties(ccppphys PROPERTIES VERSION ${PROJECT_VERSION}
                                     SOVERSION ${PROJECT_VERSION_MAJOR}
                                     COMPILE_FLAGS "${CMAKE_Fortran_FLAGS}"
                                     LINK_FLAGS "${CMAKE_Fortran_FLAGS}")

Because of this, forcing certain compiler options (or removing them) for individual files does not work.

Example: in order to compile gfdl_fv_sat_adj.F90 with default real kind 4 with the GNU compilers, it is necessary to remove the "-fdefault-real-8" compiler option, which the current system doesn't allow. For Intel, this problem is overcome by adding "-real-size 32" to the compiler options for this file. When the compiler options are combined, "-real-size 32" ends up after "-real-size 64" and as such overwrites "-real-size 64". For the PGI compiler, this has not been tested yet.

The correct way to do this would be to specify default compiler options for all CAPS and SCHEMES before adjustments are made for individual files, and remove COMPILE_FLAGS and LINK_FLAGS fro the above code snippet.

@climbfuji
Copy link
Collaborator Author

In general addressed by https://github.com/NCAR/NEMSfv3gfs/pull/113.

hannahcbarnes pushed a commit to hannahcbarnes/ccpp-physics that referenced this issue Aug 3, 2022
* New metadata for GP scheme.
* Removed redundant importing of kind_phys
* add units to index_for_diagnostic_printout metadata
* Bugfix in GP sampling routines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant