Skip to content

Commit

Permalink
Updating cluster settings (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbk-tp authored Oct 21, 2024
1 parent eef58dd commit 1f70838
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 35 deletions.
2 changes: 1 addition & 1 deletion armi/bookkeeping/db/tests/test_database3.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def test_open(self):

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):
Expand Down
2 changes: 1 addition & 1 deletion armi/bookkeeping/report/newReportUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def insertSettingsData(cs, report):
"burnSteps",
"skipCycles",
"cycleLength",
"numProcessors",
"nTasks",
]:
report[COMPREHENSIVE_REPORT][CASE_PARAMETERS].addRow([key, cs[key]])

Expand Down
2 changes: 1 addition & 1 deletion armi/cli/modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down
8 changes: 4 additions & 4 deletions armi/cli/tests/test_runEntryPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,15 +369,15 @@ def test_modifyCaseSettingsCommandInvoke(self):
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):
Expand Down
18 changes: 5 additions & 13 deletions armi/settings/fwSettings/globalSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@
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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions armi/settings/fwSettings/tests/test_fwSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -91,11 +91,6 @@ def setUp(self):
"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": {
Expand Down
4 changes: 2 additions & 2 deletions armi/settings/tests/test_inspectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ def test_assignCS(self):
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):
Expand Down
2 changes: 1 addition & 1 deletion armi/settings/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def test_getSettingsSetByUser(self):
# 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
Expand Down
10 changes: 5 additions & 5 deletions armi/settings/tests/test_settingsIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def setUp(self):
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"))
Expand Down Expand Up @@ -165,18 +165,18 @@ def test_writeShort(self):
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
user-specified.
"""
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.
Expand All @@ -189,7 +189,7 @@ def test_writeFull(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion armi/tests/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_getSettings(self):
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):
Expand Down
1 change: 1 addition & 0 deletions doc/release/0.4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,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
Expand Down

0 comments on commit 1f70838

Please sign in to comment.