Skip to content

Commit b1994f5

Browse files
committed
default regression tests in suite_info.py throw an error during build process
1 parent 748ad9a commit b1994f5

File tree

3 files changed

+60
-32
lines changed

3 files changed

+60
-32
lines changed

scm/src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(DEFINED CCPP_SUITES)
1818
unset(CCPP_SUITES CACHE)
1919
else()
2020
execute_process(
21-
COMMAND scm/src/suite_info.py
21+
COMMAND scm/src/suite_info.py --fc "${CMAKE_Fortran_COMPILER}"
2222
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../..
2323
OUTPUT_VARIABLE suite_string
2424
OUTPUT_STRIP_TRAILING_WHITESPACE
@@ -152,7 +152,7 @@ endif()
152152

153153
#------------------------------------------------------------------------------
154154
# GNU
155-
#------------------------------------------------------------------------------
155+
#------------------------------------------------------------------------------
156156
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
157157
message(STATUS "Compile using GNU")
158158
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ggdb -fbacktrace -cpp -fcray-pointer -ffree-line-length-none -fno-range-check")
@@ -218,7 +218,7 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
218218
set(CMAKE_Fortran_FLAGS_BITFORBIT "-O2 -fPIC" CACHE STRING "" FORCE)
219219
#------------------------------------------------------------------------------
220220
# Intel Classic
221-
#------------------------------------------------------------------------------
221+
#------------------------------------------------------------------------------
222222
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel")
223223
message(STATUS "Compile using Intel Classic")
224224
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -qno-opt-dynamic-align")
@@ -258,7 +258,7 @@ if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
258258

259259
#------------------------------------------------------------------------------
260260
# Nvidia HPC stack
261-
#------------------------------------------------------------------------------
261+
#------------------------------------------------------------------------------
262262
elseif (${CMAKE_Fortran_COMPILER_ID} MATCHES "NVHPC")
263263
message(STATUS "Compile using Nvidia HPC Stack")
264264
if(ENABLE_NVIDIA_OPENACC MATCHES "true")

scm/src/suite_info.py

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#!/usr/bin/env python
22

3-
import sys, os
3+
import sys, os, argparse
44

55
#DEFAULT_SUITE_BEHAVIOR = 'supported'
66
DEFAULT_SUITE_BEHAVIOR = 'regression_test'
77

88
class suite(object):
9-
9+
1010
DEFAULT_MAX_TIMESTEP = 1800.0
11-
11+
1212
def __init__(self, name, tracers, namelist, timestep, max_timestep, supported):
1313
DEFAULT_MAX_TIMESTEP = 1800.0
1414
self._name = name #should remain unchanged after init
@@ -17,12 +17,12 @@ def __init__(self, name, tracers, namelist, timestep, max_timestep, supported):
1717
self.tracers = self._default_tracers #can be modified after init
1818
self.namelist = self._default_namelist #can be modified after init
1919
self._supported = supported
20-
20+
2121
if max_timestep > 0:
2222
self._max_timestep = max_timestep #should remain unchanged after init
2323
else:
2424
self._max_timestep = DEFAULT_MAX_TIMESTEP
25-
25+
2626
if timestep <= self._max_timestep and timestep > 0:
2727
self._default_timestep = timestep #should remain unchanged after init
2828
self.timestep = self._default_timestep #can be modified after init
@@ -31,7 +31,7 @@ def __init__(self, name, tracers, namelist, timestep, max_timestep, supported):
3131
else:
3232
message = 'The timestep for suite {0} cannot be set greater than the max_timestep of {1}'.format(self._name, self._max_timestep)
3333
raise Exception(message)
34-
34+
3535
@property
3636
def timestep(self):
3737
"""Get the timestep for the given suite."""
@@ -45,7 +45,7 @@ def timestep(self, value):
4545
else:
4646
message = 'The timestep for suite {0} cannot be set greater than the max_timestep of {1}'.format(self._name, self._max_timestep)
4747
raise Exception(message)
48-
48+
4949
suite_list = []
5050
suite_list.append(suite('SCM_GFS_v16', 'tracers_GFS_v16.txt', 'input_GFS_v16.nml', 600.0, 1800.0, True ))
5151
suite_list.append(suite('SCM_GFS_v17_p8_ugwpv1', 'tracers_GFS_v17_p8_ugwpv1.txt', 'input_GFS_v17_p8_ugwpv1.nml', 600.0, 600.0, True ))
@@ -81,45 +81,54 @@ def timestep(self, value):
8181

8282

8383
def main():
84-
84+
# find which compiler is being used
85+
parser = argparse.ArgumentParser()
86+
parser.add_argument("--fc")
87+
args = parser.parse_args()
88+
8589
#print supported suites separated by commas
8690
suite_string = ''
87-
91+
8892
if DEFAULT_SUITE_BEHAVIOR == 'regression_test':
8993
dir_path = os.path.dirname(os.path.realpath(__file__))
9094
sys.path.insert(1, dir_path + '/../../test/')
91-
95+
9296
rt_suite_list = []
93-
97+
9498
import rt_test_cases
95-
import rt_test_cases_sp
96-
import rt_test_cases_nvidia
97-
98-
for item in rt_test_cases.run_list_supported:
99-
rt_suite_list.append(item.get("suite"))
10099

101-
for item in rt_test_cases.run_list_legacy:
100+
# choose correct compiler
101+
if 'gfortran' in args.fc.lower():
102+
rttc = rt_test_cases.gnu_test_cases
103+
elif 'intel' in args.fc.lower():
104+
rttc = rt_test_cases.intel_test_cases
105+
elif 'nvhpc' in args.fc.lower():
106+
rttc = rt_test_cases.nvhpc_test_cases
107+
else:
108+
print("Warning: suite_info.py was unable to match CMAKE_Fortran_COMPILER string, using default gnu rt test cases")
109+
rttc = rt_test_cases.gnu_test_cases
110+
111+
for item in rttc.run_list_supported:
102112
rt_suite_list.append(item.get("suite"))
103113

104-
for item in rt_test_cases.run_list_dev:
114+
for item in rttc.run_list_legacy:
105115
rt_suite_list.append(item.get("suite"))
106116

107-
for item in rt_test_cases.run_list_sp:
117+
for item in rttc.run_list_dev:
108118
rt_suite_list.append(item.get("suite"))
109-
110-
for item in rt_test_cases.run_list_nvhpc:
119+
120+
for item in rttc.run_list_sp:
111121
rt_suite_list.append(item.get("suite"))
112-
122+
113123
unique_suite_list = list(set(rt_suite_list))
114-
115-
for s in unique_suite_list:
124+
125+
for s in unique_suite_list:
116126
suite_string += s + ',' + s + '_ps' + ','
117127
else:
118128
for s in suite_list:
119129
if s._supported:
120-
suite_string += s._name + ',' + s._name + '_ps' + ','
130+
suite_string += s._name + ',' + s._name + '_ps' + ','
121131
print(suite_string[:-1])
122132

123133
if __name__ == '__main__':
124-
main()
125-
134+
main()

test/rt_test_cases.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
{"case": "LASSO_2016051812", "suite": "SCM_RAP"}]
9191

9292
#----------------------------------------------------------------------------------------------------------------------------------------------------------
93-
# Developmental suites, (w/ supported cases).
93+
# Developmental suites, (w/ supported cases).
9494
#----------------------------------------------------------------------------------------------------------------------------------------------------------
9595
suites_dev_gfortran = [\
9696
" SCM_GFS_v16_no_nsst", "SCM_GFS_v17_p8_ugwpv1_no_nsst", "SCM_RRFS_v1beta_no_nsst", "SCM_GFS_v17_p8_ugwpv1_tempo", \
@@ -169,3 +169,22 @@
169169
#
170170
suites_sp_ifx = suites_sp_gfortran
171171
run_list_sp_ifx = run_list_sp_gfortran
172+
173+
# make this work with suite_info.py
174+
class gnu_test_cases:
175+
run_list_supported = run_list_supported_gfortran
176+
run_list_legacy = run_list_legacy_gfortran
177+
run_list_dev = run_list_dev_gfortran
178+
run_list_sp = run_list_sp_gfortran
179+
180+
class intel_test_cases:
181+
run_list_supported = run_list_supported_ifx
182+
run_list_legacy = run_list_legacy_ifx
183+
run_list_dev = run_list_dev_ifx
184+
run_list_sp = run_list_sp_ifx
185+
186+
class nvhpc_test_cases:
187+
run_list_supported = run_list_supported_nvhpc
188+
run_list_legacy = []
189+
run_list_dev = []
190+
run_list_sp = []

0 commit comments

Comments
 (0)