Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/config_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,14 @@ Common scheduler options
A list of systems or system/partitions combinations that this scheduler configuration is valid for.
For a detailed description of this property, you may refer `here <#.environments[].target_systems>`__.

.. js:attribute:: .schedulers[].use_nodes_option

:required: No
:default: ``false``

Always emit the ``--nodes`` Slurm option in the preamble of the job script.
This option is relevant to Slurm backends only.


.. js:attribute:: .schedulers[].ignore_reqnodenotavail

Expand Down
7 changes: 7 additions & 0 deletions reframe/core/schedulers/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def __init__(self):
self._job_submit_timeout = rt.runtime().get_option(
f'schedulers/@{self.registered_name}/job_submit_timeout'
)
self._use_nodes_opt = rt.runtime().get_option(
f'schedulers/@{self.registered_name}/use_nodes_option'
)

def completion_time(self, job):
if (self._completion_time or
Expand Down Expand Up @@ -182,6 +185,10 @@ def emit_preamble(self, job):
self._format_option(job.sched_exclusive_access, '--exclusive')
)

if self._use_nodes_opt:
num_nodes = job.num_tasks // job.num_tasks_per_node
preamble.append(self._format_option(num_nodes, '--nodes={0}'))

if job.use_smt is None:
hint = None
else:
Expand Down
4 changes: 3 additions & 1 deletion reframe/schemas/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@
},
"ignore_reqnodenotavail": {"type": "boolean"},
"job_submit_timeout": {"type": "number"},
"target_systems": {"$ref": "#/defs/system_ref"}
"target_systems": {"$ref": "#/defs/system_ref"},
"use_nodes_option": {"type": "boolean"}
},
"required": ["name"],
"additionalProperties": false
Expand Down Expand Up @@ -424,6 +425,7 @@
"schedulers/ignore_reqnodenotavail": false,
"schedulers/job_submit_timeout": 60,
"schedulers/target_systems": ["*"],
"schedulers/use_nodes_option": false,
"systems/descr": "",
"systems/modules_system": "nomod",
"systems/modules": [],
Expand Down
12 changes: 12 additions & 0 deletions unittests/test_schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ def test_prepare_without_smt(fake_job, slurm_only):
assert re.search(r'--hint=nomultithread', fp.read()) is not None


def test_prepare_nodes_option(temp_runtime, make_job, slurm_only):
rt = temp_runtime(fixtures.TEST_CONFIG_FILE, 'generic',
{'schedulers/use_nodes_option': True})
next(rt)
job = make_job()
job.num_tasks = 16
job.num_tasks_per_node = 2
prepare_job(job)
with open(job.script_filename) as fp:
assert re.search(r'--nodes=8', fp.read()) is not None


def test_submit(make_job, exec_ctx):
minimal_job = make_job(sched_access=exec_ctx.access)
prepare_job(minimal_job)
Expand Down