Repository: terrapower/armi
Pull request #1965 (2024-10-21 21:46:19)

Revert "Updating cluster settings"
Reverts terrapower/armi#1958


Patch:
diff --git a/armi/bookkeeping/report/newReportUtils.py b/armi/bookkeeping/report/newReportUtils.py
index 98c14bf9..a4fd7f68 100644
--- a/armi/bookkeeping/report/newReportUtils.py
+++ b/armi/bookkeeping/report/newReportUtils.py
@@ -426,7 +426,7 @@ def insertSettingsData(cs, report):
         "burnSteps",
         "skipCycles",
         "cycleLength",
-        "nTasks",
+        "numProcessors",
     ]:
         report[COMPREHENSIVE_REPORT][CASE_PARAMETERS].addRow([key, cs[key]])
 
diff --git a/armi/cli/modify.py b/armi/cli/modify.py
index 197f9f8b..75c557a5 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 --nTasks=3 *.yaml
+        $ python -m armi modify --numProcessors=3 *.yaml
 
     """
 
diff --git a/armi/settings/fwSettings/globalSettings.py b/armi/settings/fwSettings/globalSettings.py
index 43eb9209..3b114388 100644
--- a/armi/settings/fwSettings/globalSettings.py
+++ b/armi/settings/fwSettings/globalSettings.py
@@ -80,9 +80,10 @@ 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_N_TASKS = "nTasks"
+CONF_NUM_PROCESSORS = "numProcessors"
 CONF_OPERATOR_LOCATION = "operatorLocation"
 CONF_OUTPUT_CACHE_LOCATION = "outputCacheLocation"
 CONF_OUTPUT_FILE_EXTENSION = "outputFileExtension"
@@ -153,12 +154,11 @@ def defineSettings() -> List[setting.Setting]:
     """
     settings = [
         setting.Setting(
-            CONF_N_TASKS,
+            CONF_NUM_PROCESSORS,
             default=1,
-            label="parallel tasks",
-            description="Number of parallel tasks to request on the cluster",
+            label="CPUs",
+            description="Number of CPUs 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,6 +587,14 @@ 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 ea65d6de..c5d52338 100644
--- a/doc/release/0.4.rst
+++ b/doc/release/0.4.rst
@@ -40,7 +40,6 @@ 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 4e5c8381..9a413da5 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["nTasks"], 1)
+        self.assertEqual(cs["numProcessors"], 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 9ba20f07..b0e541d6 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 --nTasks=333
-            mcs.parse_args(["--nTasks=333", "--rootDir", ".", "armiRun.yaml"])
+            # pass in --numProcessors=333
+            mcs.parse_args(["--numProcessors=333", "--rootDir", ".", "armiRun.yaml"])
 
             # invoke the CLI
             mcs.invoke()
 
-            # validate the change to nTasks was made
+            # validate the change to numProcessors was made
             txt = open("armiRun.yaml", "r").read()
-            self.assertIn("nTasks: 333", txt)
+            self.assertIn("numProcessors: 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 06537268..724a6f4d 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 = {
-            "nTasks": {
+            "numProcessors": {
                 "valid": 1,
                 "invalid": -1,
                 "error": vol.error.MultipleInvalid,
@@ -91,6 +91,11 @@ 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 cb27b3e9..fe636175 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, "nTasks")
+        query = createQueryRevertBadPathToDefault(self.inspector, "numProcessors")
         self.assertEqual(
             str(query),
-            "<Query: Setting nTasks points to a nonexistent location:\n1>",
+            "<Query: Setting numProcessors 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 3cfae738..4deeb9d8 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("nTasks", settingsList)
+        self.assertNotIn("numProcessors", 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 9b99f1b3..36dd7237 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["nTasks"], 1)
+        self.assertEqual(reader["numProcessors"], 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("nTasks", txt)
+        self.assertNotIn("numProcessors", 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", ["nTasks"])
+            self.cs.writeToYamlStream(stream, "medium", ["numProcessors"])
         txt = open(self.filepathYaml, "r").read()
         self.assertIn("nCycles: 55", txt)
-        self.assertIn("nTasks: 1", txt)
+        self.assertIn("numProcessors: 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("nTasks: 1", txt)
+        self.assertIn("numProcessors: 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 c14ffe5a..a6b6ea7e 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["nTasks"].value, 1)
+        self.assertEqual(settings["numProcessors"].value, 1)
         self.assertEqual(settings["nCycles"].value, 1)
 
     def test_splashText(self):