-
Notifications
You must be signed in to change notification settings - Fork 67
ccpp_prebuild: ccpp stub and various bugfixes #436
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
Merged
climbfuji
merged 16 commits into
NCAR:main
from
climbfuji:ccpp_framework_stub_merged_20220202
Jun 9, 2022
Merged
Changes from 6 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3fa6b4c
Detect missing scheme requested by suite in physics library
climbfuji d8d98a2
Update scripts/ccpp_prebuild.py and scripts/mkstatic.py to create she…
climbfuji 2adecf3
Add CCPP stub
climbfuji 958b284
Add stub/README.md
climbfuji e58c284
Merge branch 'ccpp_framework_stub' of https://github.com/climbfuji/cc…
climbfuji 566916d
Update stub code to reflect recent changes in ccpp-framework
climbfuji 503f43d
Fix problems with ccpp loop counter/max variables not being in list o…
climbfuji 4885561
Merge branch 'main' of https://github.com/NCAR/ccpp-framework into cc…
climbfuji 6c840e2
fix namespace collision for static api
uturuncoglu 302cb1e
update new option name and fix clean option
uturuncoglu bae5d42
Merge branch 'NCAR:main' into ccpp_framework_stub_merged_20220202
climbfuji 425cc4f
Merge branch 'main' of https://github.com/ncar/ccpp-framework into HEAD
climbfuji 5c21306
Update CCPP error code variable in stub/stub.meta
climbfuji 5fe0dc7
Merge branch 'main' of https://github.com/ncar/ccpp-framework into cc…
climbfuji f694a99
Update scripts/mkstatic.py
climbfuji e107542
Update scripts/metadata_parser.py
climbfuji 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
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
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,84 @@ | ||
| #------------------------------------------------------------------------------ | ||
| cmake_minimum_required(VERSION 3.0) | ||
|
|
||
| project(ccppstub | ||
| VERSION 1.0.0 | ||
| LANGUAGES Fortran) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Request a static build | ||
| option(BUILD_SHARED_LIBS "Build a shared library" OFF) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set the sources: physics type definitions | ||
| set(TYPEDEFS $ENV{CCPP_TYPEDEFS}) | ||
| if(TYPEDEFS) | ||
| message(STATUS "Got CCPP TYPEDEFS from environment variable: ${TYPEDEFS}") | ||
| else(TYPEDEFS) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/CCPP_TYPEDEFS.cmake) | ||
| message(STATUS "Got CCPP TYPEDEFS from cmakefile include file: ${TYPEDEFS}") | ||
| endif(TYPEDEFS) | ||
|
|
||
| # Generate list of Fortran modules from the CCPP type | ||
| # definitions that need need to be installed | ||
| foreach(typedef_module ${TYPEDEFS}) | ||
| list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${typedef_module}) | ||
| endforeach() | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| # Set the sources: physics schemes | ||
| set(SCHEMES $ENV{CCPP_SCHEMES}) | ||
| if(SCHEMES) | ||
| message(STATUS "Got CCPP SCHEMES from environment variable: ${SCHEMES}") | ||
| else(SCHEMES) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/CCPP_SCHEMES.cmake) | ||
| message(STATUS "Got CCPP SCHEMES from cmakefile include file: ${SCHEMES}") | ||
| endif(SCHEMES) | ||
|
|
||
| # Set the sources: physics scheme caps | ||
| set(CAPS $ENV{CCPP_CAPS}) | ||
| if(CAPS) | ||
| message(STATUS "Got CCPP CAPS from environment variable: ${CAPS}") | ||
| else(CAPS) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/CCPP_CAPS.cmake) | ||
| message(STATUS "Got CCPP CAPS from cmakefile include file: ${CAPS}") | ||
| endif(CAPS) | ||
|
|
||
| # Set the sources: physics scheme caps | ||
| set(API $ENV{CCPP_API}) | ||
| if(API) | ||
| message(STATUS "Got CCPP API from environment variable: ${API}") | ||
| else(API) | ||
| include(${CMAKE_CURRENT_SOURCE_DIR}/CCPP_API.cmake) | ||
| message(STATUS "Got CCPP API from cmakefile include file: ${API}") | ||
| endif(API) | ||
|
|
||
| #------------------------------------------------------------------------------ | ||
| add_library(ccppstub STATIC ${SCHEMES} ${CAPS} ${API}) | ||
| # Generate list of Fortran modules from defined sources | ||
| foreach(source_f90 ${CAPS} ${API}) | ||
| get_filename_component(tmp_source_f90 ${source_f90} NAME) | ||
| string(REGEX REPLACE ".F90" ".mod" tmp_module_f90 ${tmp_source_f90}) | ||
| string(TOLOWER ${tmp_module_f90} module_f90) | ||
| list(APPEND MODULES_F90 ${CMAKE_CURRENT_BINARY_DIR}/${module_f90}) | ||
| endforeach() | ||
|
|
||
| set_target_properties(ccppstub PROPERTIES VERSION ${PROJECT_VERSION} | ||
| SOVERSION ${PROJECT_VERSION_MAJOR}) | ||
|
|
||
| # Define where to install the library | ||
| install(TARGETS ccppstub | ||
| EXPORT ccppstub-targets | ||
| ARCHIVE DESTINATION lib | ||
| LIBRARY DESTINATION lib | ||
| RUNTIME DESTINATION lib | ||
| ) | ||
| # Export our configuration | ||
| install(EXPORT ccppstub-targets | ||
| FILE ccppstub-config.cmake | ||
| DESTINATION lib/cmake | ||
| ) | ||
| # Define where to install the C headers and Fortran modules | ||
| #install(FILES ${HEADERS_C} DESTINATION include) | ||
| install(FILES ${MODULES_F90} DESTINATION include) | ||
|
|
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,12 @@ | ||
| # How to build the stub | ||
|
|
||
| Note: build is in-source for now | ||
|
|
||
| 1. Set compiler environment as appropriate for your system | ||
| 2. Run the following commands: | ||
| ``` | ||
| cd stub | ||
| ../scripts/ccpp_prebuild.py --config=ccpp_prebuild_config.py | ||
| cmake . 2>&1 | tee log.cmake | ||
| make 2>&1 | tee log.make | ||
| ``` |
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,78 @@ | ||
| #!/usr/bin/env python | ||
|
|
||
| # CCPP prebuild config for GFDL Finite-Volume Cubed-Sphere Model (FV3) | ||
|
|
||
|
|
||
| ############################################################################### | ||
| # Definitions # | ||
| ############################################################################### | ||
|
|
||
| HOST_MODEL_IDENTIFIER = "FV3" | ||
|
|
||
| # Add all files with metadata tables on the host model side and in CCPP, | ||
| # relative to basedir = top-level directory of host model. This includes | ||
| # kind and type definitions used in CCPP physics. Also add any internal | ||
| # dependencies of these files to the list. | ||
| VARIABLE_DEFINITION_FILES = [ | ||
| # actual variable definition files | ||
| '../src/ccpp_types.F90', | ||
| 'data.F90', | ||
| ] | ||
|
|
||
| TYPEDEFS_NEW_METADATA = { | ||
| 'ccpp_types' : { | ||
| 'ccpp_types' : '', | ||
| 'ccpp_t' : 'ccpp_data', | ||
| }, | ||
| } | ||
|
|
||
| # Add all physics scheme files relative to basedir | ||
| SCHEME_FILES = [ | ||
| 'stub.F90', | ||
| ] | ||
|
|
||
| # Default build dir, relative to current working directory, | ||
| # if not specified as command-line argument | ||
| DEFAULT_BUILD_DIR = '.' | ||
|
|
||
| # Auto-generated makefile/cmakefile snippets that contain all type definitions | ||
| TYPEDEFS_MAKEFILE = '{build_dir}/CCPP_TYPEDEFS.mk' | ||
| TYPEDEFS_CMAKEFILE = '{build_dir}/CCPP_TYPEDEFS.cmake' | ||
| TYPEDEFS_SOURCEFILE = '{build_dir}/CCPP_TYPEDEFS.sh' | ||
|
|
||
| # Auto-generated makefile/cmakefile snippets that contain all schemes | ||
| SCHEMES_MAKEFILE = '{build_dir}/CCPP_SCHEMES.mk' | ||
| SCHEMES_CMAKEFILE = '{build_dir}/CCPP_SCHEMES.cmake' | ||
| SCHEMES_SOURCEFILE = '{build_dir}/CCPP_SCHEMES.sh' | ||
|
|
||
| # Auto-generated makefile/cmakefile snippets that contain all caps | ||
| CAPS_MAKEFILE = '{build_dir}/CCPP_CAPS.mk' | ||
| CAPS_CMAKEFILE = '{build_dir}/CCPP_CAPS.cmake' | ||
| CAPS_SOURCEFILE = '{build_dir}/CCPP_CAPS.sh' | ||
|
|
||
| # Directory where to put all auto-generated physics caps | ||
| CAPS_DIR = '{build_dir}' | ||
|
|
||
| # Directory where the suite definition files are stored | ||
| SUITES_DIR = '{build_dir}' | ||
|
|
||
| # Optional arguments - only required for schemes that use | ||
| # optional arguments. ccpp_prebuild.py will throw an exception | ||
| # if it encounters a scheme subroutine with optional arguments | ||
| # if no entry is made here. Possible values are: 'all', 'none', | ||
| # or a list of standard_names: [ 'var1', 'var3' ]. | ||
| OPTIONAL_ARGUMENTS = {} | ||
|
|
||
| # Directory where to write static API to | ||
| STATIC_API_DIR = '{build_dir}' | ||
| STATIC_API_CMAKEFILE = '{build_dir}/CCPP_API.cmake' | ||
| STATIC_API_SOURCEFILE = '{build_dir}/CCPP_API.sh' | ||
|
|
||
| # Directory for writing HTML pages generated from metadata files | ||
| METADATA_HTML_OUTPUT_DIR = '{build_dir}' | ||
|
|
||
| # HTML document containing the model-defined CCPP variables | ||
| HTML_VARTABLE_FILE = '{build_dir}/CCPP_VARIABLES_STUB.html' | ||
|
|
||
| # LaTeX document containing the provided vs requested CCPP variables | ||
| LATEX_VARTABLE_FILE = '{build_dir}/CCPP_VARIABLES_STUB.tex' |
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,17 @@ | ||
| module data | ||
|
|
||
| !! \section arg_table_data Argument Table | ||
| !! \htmlinclude data.html | ||
| !! | ||
|
|
||
| use ccpp_types, only: ccpp_t | ||
|
|
||
| implicit none | ||
|
|
||
| private | ||
|
|
||
| public ccpp_data | ||
|
|
||
| type(ccpp_t), save, target :: ccpp_data | ||
|
|
||
| end module data |
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,14 @@ | ||
| [ccpp-table-properties] | ||
| name = data | ||
| type = module | ||
| dependencies = | ||
|
|
||
| [ccpp-arg-table] | ||
| name = data | ||
| type = module | ||
| [ccpp_data] | ||
| standard_name = ccpp_t_instance | ||
| long_name = instance of derived data type ccpp_t | ||
| units = DDT | ||
| dimensions = () | ||
| type = ccpp_t |
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,35 @@ | ||
| !>\file stub.F90 | ||
| !! This file contains a stub CCPP scheme that does nothing | ||
| !! except requesting the minimum, mandatory variables. | ||
|
|
||
| module stub | ||
|
|
||
| implicit none | ||
| private | ||
| public :: stub_init, stub_finalize | ||
|
|
||
| contains | ||
|
|
||
| !! \section arg_table_stub_init Argument Table | ||
| !! \htmlinclude stub_init.html | ||
| !! | ||
| subroutine stub_init(errmsg, errflg) | ||
| character(len=*), intent(out) :: errmsg | ||
| integer, intent(out) :: errflg | ||
| ! Initialize CCPP error handling variables | ||
| errmsg = '' | ||
| errflg = 0 | ||
| end subroutine stub_init | ||
|
|
||
| !! \section arg_table_stub_finalize Argument Table | ||
| !! \htmlinclude stub_finalize.html | ||
| !! | ||
| subroutine stub_finalize(errmsg, errflg) | ||
| character(len=*), intent(out) :: errmsg | ||
| integer, intent(out) :: errflg | ||
| ! Initialize CCPP error handling variables | ||
| errmsg = '' | ||
| errflg = 0 | ||
| end subroutine stub_finalize | ||
|
|
||
| end module stub |
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.
Uh oh!
There was an error while loading. Please reload this page.