11#!/usr/bin/env python
22
3- import sys , os
3+ import sys , os , argparse
44
55#DEFAULT_SUITE_BEHAVIOR = 'supported'
66DEFAULT_SUITE_BEHAVIOR = 'regression_test'
77
88class 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+
4949suite_list = []
5050suite_list .append (suite ('SCM_GFS_v16' , 'tracers_GFS_v16.txt' , 'input_GFS_v16.nml' , 600.0 , 1800.0 , True ))
5151suite_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
8383def 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
123133if __name__ == '__main__' :
124- main ()
125-
134+ main ()
0 commit comments