Repository: terrapower/armi
Pull request #1969 (2024-10-22 20:47:13)

Revert "Revert "Updating cluster settings""
Reverts terrapower/armi#1965

We are ready for this update now


Patch:
diff --git a/armi/bookkeeping/report/newReportUtils.py b/armi/bookkeeping/report/newReportUtils.py
index a4fd7f68..98c14bf9 100644
--- a/armi/bookkeeping/report/newReportUtils.py
+++ b/armi/bookkeeping/report/newReportUtils.py
@@ -426,7 +426,7 @@ def insertSettingsData(cs, report):
         "burnSteps",
         "skipCycles",
         "cycleLength",
-        "numProcessors",
+        "nTasks",
     ]:
         report[COMPREHENSIVE_REPORT][CASE_PARAMETERS].addRow([key, cs[key]])
 
diff --git a/armi/cli/modify.py b/armi/cli/modify.py
index 75c557a5..197f9f8b 100644
--- a/armi/cli/modify.py
+++ b/armi/cli/modify.py
@@ -30,7 +30,7 @@ class ModifyCaseSettingsCommand(EntryPoint):
 
     Run the entry point like this::
 
-        $ python -m armi modify --numProcessors=3 *.yaml
+        $ python -m armi modify --nTasks=3 *.yaml
 
     """
 
diff --git a/armi/settings/fwSettings/globalSettings.py b/armi/settings/fwSettings/globalSettings.py
index 3b114388..43eb9209 100644
--- a/armi/settings/fwSettings/globalSettings.py
+++ b/armi/settings/fwSettings/globalSettings.py
@@ -80,10 +80,9 @@ CONF_LOW_POWER_REGION_FRACTION = "lowPowerRegionFraction"  # reports
 CONF_MATERIAL_NAMESPACE_ORDER = "materialNamespaceOrder"
 CONF_MIN_MESH_SIZE_RATIO = "minMeshSizeRatio"
 CONF_MODULE_VERBOSITY = "moduleVerbosity"
-CONF_MPI_TASKS_PER_NODE = "mpiTasksPerNode"
 CONF_N_CYCLES = "nCycles"
 CONF_NON_UNIFORM_ASSEM_FLAGS = "nonUniformAssemFlags"
-CONF_NUM_PROCESSORS = "numProcessors"
+CONF_N_TASKS = "nTasks"
 CONF_OPERATOR_LOCATION = "operatorLocation"
 CONF_OUTPUT_CACHE_LOCATION = "outputCacheLocation"
 CONF_OUTPUT_FILE_EXTENSION = "outputFileExtension"
@@ -154,11 +153,12 @@ def defineSettings() -> List[setting.Setting]:
     """
     settings = [
         setting.Setting(
-            CONF_NUM_PROCESSORS,
+            CONF_N_TASKS,
             default=1,
-            label="CPUs",
-            description="Number of CPUs to request on the cluster",
+            label="parallel tasks",
+            description="Number of parallel tasks to request on the cluster",
             schema=vol.All(vol.Coerce(int), vol.Range(min=1)),
+            oldNames=[("numProcessors", None)],
         ),
         setting.Setting(
             CONF_INITIALIZE_BURN_CHAIN,
@@ -587,14 +587,6 @@ def defineSettings() -> List[setting.Setting]:
             description="Description needed",
             schema=vol.All(vol.Coerce(float), vol.Range(min=0, max=1)),
         ),
-        setting.Setting(
-            CONF_MPI_TASKS_PER_NODE,
-            default=0,
-            label="MPI Tasks per Node",
-            description="Number of independent processes that are allocated to each "
-            "cluster node. 0 means 1 process per CPU.",
-            schema=vol.All(vol.Coerce(int), vol.Range(min=0)),
-        ),
         setting.Setting(
             CONF_N_CYCLES,
             default=1,
diff --git a/doc/release/0.4.rst b/doc/release/0.4.rst
index f8cc73aa..768c967b 100644
--- a/doc/release/0.4.rst
+++ b/doc/release/0.4.rst
@@ -41,6 +41,7 @@ API Changes
 #. Removing ``Assembly.rotatePins`` and ``Block.rotatePins``. Prefer ``Assembly.rotate`` and ``Block.rotate``. (`PR#1846 <https://github.com/terrapower/armi/1846>`_)
 #. Transposing ``pinMgFluxes`` parameters so that leading dimension is pin index (`PR#1937 <https://github.com/terrapower/armi/pull/1937>`)
 #. Removing ``globalFluxInterface.DoseResultsMapper`` class (`PR#1952 <https://github.com/terrapower/armi/pull/1952>`)
+#. Removing setting ``mpiTasksPerNode`` and renaming ``numProcessors`` to ``nTasks``. (`PR#1958 <https://github.com/terrapower/armi/pull/1958>`_)
 #. TBD
 
 Bug Fixes


Test patch:
diff --git a/armi/bookkeeping/db/tests/test_database3.py b/armi/bookkeeping/db/tests/test_database3.py
index 9a413da5..4e5c8381 100644
--- a/armi/bookkeeping/db/tests/test_database3.py
+++ b/armi/bookkeeping/db/tests/test_database3.py
@@ -535,7 +535,7 @@ class TestDatabase3Smaller(unittest.TestCase):
 
     def test_loadCS(self):
         cs = self.db.loadCS()
-        self.assertEqual(cs["numProcessors"], 1)
+        self.assertEqual(cs["nTasks"], 1)
         self.assertEqual(cs["nCycles"], 2)
 
     def test_loadBlueprints(self):
diff --git a/armi/cli/tests/test_runEntryPoint.py b/armi/cli/tests/test_runEntryPoint.py
index b0e541d6..9ba20f07 100644
--- a/armi/cli/tests/test_runEntryPoint.py
+++ b/armi/cli/tests/test_runEntryPoint.py
@@ -369,15 +369,15 @@ class TestModifyCaseSettingsCommand(unittest.TestCase):
             for fileName in ["armiRun.yaml", "refSmallReactor.yaml"]:
                 copyfile(os.path.join(TEST_ROOT, fileName), fileName)
 
-            # pass in --numProcessors=333
-            mcs.parse_args(["--numProcessors=333", "--rootDir", ".", "armiRun.yaml"])
+            # pass in --nTasks=333
+            mcs.parse_args(["--nTasks=333", "--rootDir", ".", "armiRun.yaml"])
 
             # invoke the CLI
             mcs.invoke()
 
-            # validate the change to numProcessors was made
+            # validate the change to nTasks was made
             txt = open("armiRun.yaml", "r").read()
-            self.assertIn("numProcessors: 333", txt)
+            self.assertIn("nTasks: 333", txt)
 
 
 class TestReportsEntryPoint(unittest.TestCase):
diff --git a/armi/settings/fwSettings/tests/test_fwSettings.py b/armi/settings/fwSettings/tests/test_fwSettings.py
index 724a6f4d..06537268 100644
--- a/armi/settings/fwSettings/tests/test_fwSettings.py
+++ b/armi/settings/fwSettings/tests/test_fwSettings.py
@@ -26,7 +26,7 @@ class TestSchema(unittest.TestCase):
     def setUp(self):
         self.cs = caseSettings.Settings()
         self.settings = {
-            "numProcessors": {
+            "nTasks": {
                 "valid": 1,
                 "invalid": -1,
                 "error": vol.error.MultipleInvalid,
@@ -91,11 +91,6 @@ class TestSchema(unittest.TestCase):
                 "invalid": 2,
                 "error": vol.error.MultipleInvalid,
             },
-            "mpiTasksPerNode": {
-                "valid": 0,
-                "invalid": -1,
-                "error": vol.error.MultipleInvalid,
-            },
             "nCycles": {"valid": 1, "invalid": -1, "error": vol.error.MultipleInvalid},
             "power": {"valid": 0, "invalid": -1, "error": vol.error.MultipleInvalid},
             "skipCycles": {
diff --git a/armi/settings/tests/test_inspectors.py b/armi/settings/tests/test_inspectors.py
index fe636175..cb27b3e9 100644
--- a/armi/settings/tests/test_inspectors.py
+++ b/armi/settings/tests/test_inspectors.py
@@ -152,10 +152,10 @@ class TestInspector(unittest.TestCase):
         self.assertIn("nCycles", keys)
 
     def test_createQueryRevertBadPathToDefault(self):
-        query = createQueryRevertBadPathToDefault(self.inspector, "numProcessors")
+        query = createQueryRevertBadPathToDefault(self.inspector, "nTasks")
         self.assertEqual(
             str(query),
-            "<Query: Setting numProcessors points to a nonexistent location:\n1>",
+            "<Query: Setting nTasks points to a nonexistent location:\n1>",
         )
 
     def test_correctCyclesToZeroBurnup(self):
diff --git a/armi/settings/tests/test_settings.py b/armi/settings/tests/test_settings.py
index 4deeb9d8..3cfae738 100644
--- a/armi/settings/tests/test_settings.py
+++ b/armi/settings/tests/test_settings.py
@@ -324,7 +324,7 @@ assemblyRotationAlgorithm: buReducingAssemblyRotatoin
         # some default settings values
         for sett in ["availabilityFactor", "db"]:
             self.assertIn(sett, settingsList)
-        self.assertNotIn("numProcessors", settingsList)
+        self.assertNotIn("nTasks", settingsList)
 
     def test_setModuleVerbosities(self):
         # init settings and use them to set module-level logging levels
diff --git a/armi/settings/tests/test_settingsIO.py b/armi/settings/tests/test_settingsIO.py
index 36dd7237..9b99f1b3 100644
--- a/armi/settings/tests/test_settingsIO.py
+++ b/armi/settings/tests/test_settingsIO.py
@@ -63,7 +63,7 @@ class SettingsReaderTests(unittest.TestCase):
     def test_basicSettingsReader(self):
         reader = settingsIO.SettingsReader(self.cs)
 
-        self.assertEqual(reader["numProcessors"], 1)
+        self.assertEqual(reader["nTasks"], 1)
         self.assertEqual(reader["nCycles"], 1)
 
         self.assertFalse(getattr(reader, "filelessBP"))
@@ -165,7 +165,7 @@ class SettingsWriterTests(unittest.TestCase):
         self.cs.loadFromInputFile(self.filepathYaml)
         txt = open(self.filepathYaml, "r").read()
         self.assertIn("nCycles: 55", txt)
-        self.assertNotIn("numProcessors", txt)
+        self.assertNotIn("nTasks", txt)
 
     def test_writeMedium(self):
         """Setting output as a sparse file that only includes defaults if they are
@@ -173,10 +173,10 @@ class SettingsWriterTests(unittest.TestCase):
         """
         with open(self.filepathYaml, "w") as stream:
             # Specify a setting that is also a default
-            self.cs.writeToYamlStream(stream, "medium", ["numProcessors"])
+            self.cs.writeToYamlStream(stream, "medium", ["nTasks"])
         txt = open(self.filepathYaml, "r").read()
         self.assertIn("nCycles: 55", txt)
-        self.assertIn("numProcessors: 1", txt)
+        self.assertIn("nTasks: 1", txt)
 
     def test_writeFull(self):
         """Setting output as a full, all defaults included file.
@@ -189,7 +189,7 @@ class SettingsWriterTests(unittest.TestCase):
         txt = open(self.filepathYaml, "r").read()
         self.assertIn("nCycles: 55", txt)
         # check a default setting
-        self.assertIn("numProcessors: 1", txt)
+        self.assertIn("nTasks: 1", txt)
 
     def test_writeYaml(self):
         self.cs.writeToYamlFile(self.filepathYaml)
diff --git a/armi/tests/test_apps.py b/armi/tests/test_apps.py
index a6b6ea7e..c14ffe5a 100644
--- a/armi/tests/test_apps.py
+++ b/armi/tests/test_apps.py
@@ -165,7 +165,7 @@ class TestApps(unittest.TestCase):
         settings = app.getSettings()
 
         self.assertGreater(len(settings), 100)
-        self.assertEqual(settings["numProcessors"].value, 1)
+        self.assertEqual(settings["nTasks"].value, 1)
         self.assertEqual(settings["nCycles"].value, 1)
 
     def test_splashText(self):