Skip to content

Commit 92d7d44

Browse files
authored
Merge pull request #11 from grantfirl/add_rl_type
Add rl type
2 parents 7d37d1f + f4904e5 commit 92d7d44

File tree

3 files changed

+49
-25
lines changed

3 files changed

+49
-25
lines changed

scm/src/CMakeLists.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@ if(DEFINED CCPP_SUITES)
1717
endif()
1818
unset(CCPP_SUITES CACHE)
1919
else()
20-
execute_process(
21-
COMMAND scm/src/suite_info.py --fc "${CMAKE_Fortran_COMPILER_ID}"
22-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../..
23-
OUTPUT_VARIABLE suite_string
24-
OUTPUT_STRIP_TRAILING_WHITESPACE
25-
)
26-
set(_ccpp_suites_arg "--suites=${suite_string}")
27-
message("Calling CCPP code generator (ccpp_prebuild.py) for suites listed in scm/src/suite_info.py: ${_ccpp_suites_arg}.")
20+
if(DEFINED RL)
21+
execute_process(
22+
COMMAND scm/src/suite_info.py --fc "${CMAKE_Fortran_COMPILER_ID}" --rl ${RL}
23+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../..
24+
OUTPUT_VARIABLE suite_string
25+
OUTPUT_STRIP_TRAILING_WHITESPACE
26+
)
27+
else()
28+
execute_process(
29+
COMMAND scm/src/suite_info.py --fc "${CMAKE_Fortran_COMPILER_ID}"
30+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../..
31+
OUTPUT_VARIABLE suite_string
32+
OUTPUT_STRIP_TRAILING_WHITESPACE
33+
)
34+
endif()
35+
set(_ccpp_suites_arg "--suites=${suite_string}")
36+
message("Calling CCPP code generator (ccpp_prebuild.py) for suites listed in scm/src/suite_info.py: ${_ccpp_suites_arg}.")
2837
endif()
2938
# Run CCPP prebuild.py
3039
message (STATUS "Running ccpp_prebuild.py for CCPP")
@@ -259,7 +268,7 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
259268
endif()
260269

261270
set(CMAKE_C_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE)
262-
set(CMAKE_Fortran_FLAGS_RELEASE "-O0 -fPIC" CACHE STRING "" FORCE)
271+
set(CMAKE_Fortran_FLAGS_RELEASE "-O2 -fPIC" CACHE STRING "" FORCE)
263272
set(CMAKE_C_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE)
264273
set(CMAKE_Fortran_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE)
265274

scm/src/suite_info.py

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#DEFAULT_SUITE_BEHAVIOR = 'supported'
66
DEFAULT_SUITE_BEHAVIOR = 'regression_test'
77

8+
DEFAULT_RUN_LIST = 'all'
9+
810
class suite(object):
911

1012
DEFAULT_MAX_TIMESTEP = 1800.0
@@ -83,12 +85,20 @@ def timestep(self, value):
8385
def main():
8486
# find which compiler is being used
8587
parser = argparse.ArgumentParser()
86-
parser.add_argument("--fc")
88+
parser.add_argument("--fc", help='Fortran compiler being used (e.g. gnu, intel, intelllvm, nvhpc)', required=False)
89+
parser.add_argument("--rl", help='run list type in rt_test_cases.py (e.g. supported, dev, legacy, sp)', required=False)
8790
args = parser.parse_args()
88-
91+
92+
fc = args.fc
93+
rl = args.rl
94+
95+
if not rl or rl.lower() not in ['all','supported','legacy','dev', 'sp']:
96+
#printing a warning will mess up the cmake process because it passes in everything printed out by this script to the '--suites' argument of ccpp_prebuild.py
97+
rl = DEFAULT_RUN_LIST
98+
8999
#print supported suites separated by commas
90100
suite_string = ''
91-
101+
92102
if DEFAULT_SUITE_BEHAVIOR == 'regression_test':
93103
dir_path = os.path.dirname(os.path.realpath(__file__))
94104
sys.path.insert(1, dir_path + '/../../test/')
@@ -98,27 +108,32 @@ def main():
98108
import rt_test_cases
99109

100110
# choose correct compiler
101-
if 'gnu' in args.fc.lower():
111+
if 'gnu' in fc.lower():
102112
rttc = rt_test_cases.gnu_test_cases
103-
elif 'intel' in args.fc.lower():
113+
elif 'intel' in fc.lower():
104114
rttc = rt_test_cases.intel_test_cases
105-
elif 'nvhpc' in args.fc.lower():
115+
elif 'nvhpc' in fc.lower():
106116
rttc = rt_test_cases.nvhpc_test_cases
107117
else:
108-
print("Warning: suite_info.py was unable to match CMAKE_Fortran_COMPILER string, using default gnu rt test cases")
118+
#printing a warning will mess up the cmake process because it passes in everything printed out by this script to the '--suites' argument of ccpp_prebuild.py
119+
#print("Warning: suite_info.py was unable to match CMAKE_Fortran_COMPILER string, using default gnu rt test cases")
109120
rttc = rt_test_cases.gnu_test_cases
110121

111-
for item in rttc.run_list_supported:
112-
rt_suite_list.append(item.get("suite"))
122+
if 'supported' in rl.lower() or 'all' in rl.lower():
123+
for item in rttc.run_list_supported:
124+
rt_suite_list.append(item.get("suite"))
113125

114-
for item in rttc.run_list_legacy:
115-
rt_suite_list.append(item.get("suite"))
126+
if 'legacy' in rl.lower() or 'all' in rl.lower():
127+
for item in rttc.run_list_legacy:
128+
rt_suite_list.append(item.get("suite"))
116129

117-
for item in rttc.run_list_dev:
118-
rt_suite_list.append(item.get("suite"))
130+
if 'dev' in rl.lower() or 'all' in rl.lower():
131+
for item in rttc.run_list_dev:
132+
rt_suite_list.append(item.get("suite"))
119133

120-
for item in rttc.run_list_sp:
121-
rt_suite_list.append(item.get("suite"))
134+
if 'sp' in rl.lower() or 'all' in rl.lower():
135+
for item in rttc.run_list_sp:
136+
rt_suite_list.append(item.get("suite"))
122137

123138
unique_suite_list = list(set(rt_suite_list))
124139

scm/src/supported_suites.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
suites = ["SCM_GFS_v16","SCM_GFS_v16_ps","SCM_GFS_v16_RRTMGP","SCM_GFS_v17_p8_ugwpv1","SCM_HRRR_gf","SCM_WoFS_v0"]
1+
suites = ["SCM_GFS_v16","SCM_GFS_v16_RRTMGP","SCM_GFS_v17_p8_ugwpv1","SCM_HRRR_gf","SCM_WoFS_v0"]

0 commit comments

Comments
 (0)