Repository: ESMCI/cime

Issue:
TOTALPES wrong on cheyenne
TOTALPES is not counting threading.


Discussion:

Resolving patch:
diff --git a/scripts/lib/CIME/case/case.py b/scripts/lib/CIME/case/case.py
--- a/scripts/lib/CIME/case/case.py
+++ b/scripts/lib/CIME/case/case.py
@@ -363,12 +363,12 @@ def get_resolved_value(self, item, recurse=0, allow_unresolved_envvars=False):
         recurse_limit = 10
         if (num_unresolved > 0 and recurse < recurse_limit ):
             for env_file in self._env_entryid_files:
-                item = env_file.get_resolved_value(item, 
+                item = env_file.get_resolved_value(item,
                                                    allow_unresolved_envvars=allow_unresolved_envvars)
             if ("$" not in item):
                 return item
             else:
-                item = self.get_resolved_value(item, recurse=recurse+1, 
+                item = self.get_resolved_value(item, recurse=recurse+1,
                                                allow_unresolved_envvars=allow_unresolved_envvars)
 
         return item
diff --git a/scripts/lib/CIME/case/case_setup.py b/scripts/lib/CIME/case/case_setup.py
--- a/scripts/lib/CIME/case/case_setup.py
+++ b/scripts/lib/CIME/case/case_setup.py
@@ -152,10 +152,15 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False):
 
             case.initialize_derived_attributes()
 
-            cost_per_node = 16 if case.get_value("MACH") == "yellowstone" else case.get_value("MAX_MPITASKS_PER_NODE")
+            cost_per_node = case.get_value("COSTPES_PER_NODE")
             case.set_value("COST_PES", case.num_nodes * cost_per_node)
-            case.set_value("TOTALPES", case.total_tasks)
-            case.set_value("SMP_PRESENT", case.get_build_threaded())
+            threaded = case.get_build_threaded()
+            case.set_value("SMP_PRESENT", threaded)
+            if threaded and case.total_tasks * case.thread_count > cost_per_node:
+                smt_factor = max(1.0,int(case.get_value("MAX_TASKS_PER_NODE") / cost_per_node))
+                case.set_value("TOTALPES", int(case.total_tasks * max(1.0,float(case.thread_count) / smt_factor)))
+            else:
+                case.set_value("TOTALPES", case.total_tasks*case.thread_count)
 
             # create batch files
             env_batch = case.get_env("batch")
diff --git a/scripts/lib/CIME/hist_utils.py b/scripts/lib/CIME/hist_utils.py
--- a/scripts/lib/CIME/hist_utils.py
+++ b/scripts/lib/CIME/hist_utils.py
@@ -350,7 +350,7 @@ def get_extension(model, filepath):
     'h'
     >>> get_extension("clm","clm2_0002.h0.1850-01-06-00000.nc")
     '0002.h0'
-    >>> get_extension("pop","PFS.f09_g16.B1850.yellowstone_intel.allactive-default.GC.c2_0_b1f2_int.pop.h.ecosys.nday1.0001-01-02.nc")
+    >>> get_extension("pop","PFS.f09_g16.B1850.cheyenne_intel.allactive-default.GC.c2_0_b1f2_int.pop.h.ecosys.nday1.0001-01-02.nc")
     'h'
     """
     basename = os.path.basename(filepath)


Test patch:
diff --git a/scripts/create_test b/scripts/create_test
--- a/scripts/create_test
+++ b/scripts/create_test
@@ -33,8 +33,8 @@ OR
 {0} --help
 
 \033[1mEXAMPLES:\033[0m
-    \033[1;32m# Run all tests in the xml prealpha category and yellowstone machine \033[0m
-    > {0} --xml-machine yellowstone --xml-category prealpha
+    \033[1;32m# Run all tests in the xml prealpha category and cheyenne machine \033[0m
+    > {0} --xml-machine cheyenne --xml-category prealpha
 """.format(os.path.basename(args[0]))
 
     else:
diff --git a/scripts/fortran_unit_testing/run_tests.py b/scripts/fortran_unit_testing/run_tests.py
--- a/scripts/fortran_unit_testing/run_tests.py
+++ b/scripts/fortran_unit_testing/run_tests.py
@@ -91,7 +91,7 @@ def parse_command_line(args):
                         help="""MPI Library to use in build.
                         If not specified, use the default for this machine/compiler.
                         Must match an MPILIB option in config_compilers.xml.
-                        e.g., for yellowstone, can use 'mpich2'.
+                        e.g., for cheyenne, can use 'mpt'.
                         Only relevant if --use-mpi is specified."""
     )
 
diff --git a/scripts/lib/CIME/test_utils.py b/scripts/lib/CIME/test_utils.py
--- a/scripts/lib/CIME/test_utils.py
+++ b/scripts/lib/CIME/test_utils.py
@@ -64,19 +64,19 @@ def test_to_string(test, category_field_width=0, test_field_width=0, show_option
                              option is always printed, if present)
 
     Basic functionality:
-    >>> mytest = {'name': 'SMS.f19_g16.A.yellowstone_intel', 'category': 'prealpha', 'options': {}}
+    >>> mytest = {'name': 'SMS.f19_g16.A.cheyenne_intel', 'category': 'prealpha', 'options': {}}
     >>> test_to_string(mytest, 10)
-    'prealpha  : SMS.f19_g16.A.yellowstone_intel'
+    'prealpha  : SMS.f19_g16.A.cheyenne_intel'
 
     Printing comments:
-    >>> mytest = {'name': 'SMS.f19_g16.A.yellowstone_intel', 'category': 'prealpha', 'options': {'comment': 'my remarks'}}
+    >>> mytest = {'name': 'SMS.f19_g16.A.cheyenne_intel', 'category': 'prealpha', 'options': {'comment': 'my remarks'}}
     >>> test_to_string(mytest, 10)
-    'prealpha  : SMS.f19_g16.A.yellowstone_intel # my remarks'
+    'prealpha  : SMS.f19_g16.A.cheyenne_intel # my remarks'
 
     Printing other options, too:
-    >>> mytest = {'name': 'SMS.f19_g16.A.yellowstone_intel', 'category': 'prealpha', 'options': {'comment': 'my remarks', 'wallclock': '0:20', 'memleak_tolerance': 0.2}}
+    >>> mytest = {'name': 'SMS.f19_g16.A.cheyenne_intel', 'category': 'prealpha', 'options': {'comment': 'my remarks', 'wallclock': '0:20', 'memleak_tolerance': 0.2}}
     >>> test_to_string(mytest, 10, show_options=True)
-    'prealpha  : SMS.f19_g16.A.yellowstone_intel # my remarks  # memleak_tolerance: 0.2  # wallclock: 0:20'
+    'prealpha  : SMS.f19_g16.A.cheyenne_intel # my remarks  # memleak_tolerance: 0.2  # wallclock: 0:20'
     """
 
     mystr = "%-*s: %-*s"%(category_field_width, test['category'], test_field_width, test['name'])