Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defend against -1 values for n_nodes (and update examples) #764

Merged
merged 1 commit into from
Nov 15, 2024
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
2 changes: 1 addition & 1 deletion examples/basic_hostname_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ramble:
variables:
mpi_command: mpirun
batch_submit: '{execute_experiment}'
processes_per_node: -1
processes_per_node: 1
applications:
hostname:
workloads:
Expand Down
4 changes: 2 additions & 2 deletions lib/ramble/docs/tutorials/mirrors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Write the following configuration into the file, save, and exit:
variables:
mpi_command: mpirun -n {n_ranks}
batch_submit: '{execute_experiment}'
processes_per_node: -1
processes_per_node: 1
applications:
wrfv4:
variables:
Expand Down Expand Up @@ -84,7 +84,7 @@ will look something like this:
variables:
mpi_command: mpirun -n {n_ranks}
batch_submit: '{execute_experiment}'
processes_per_node: -1
processes_per_node: 1
applications:
wrfv4:
variables:
Expand Down
6 changes: 6 additions & 0 deletions lib/ramble/ramble/experiment_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,18 @@ def _compute_mpi_vars(self, expander, variables):

if n_ranks:
n_ranks = int(expander.expand_var(n_ranks))
if n_ranks <= 0:
logger.error("n_ranks must be positive")

if ppn:
ppn = int(expander.expand_var(ppn))
if ppn <= 0:
logger.error("processes_per_node must be positive")

if n_nodes:
n_nodes = int(expander.expand_var(n_nodes))
if n_nodes <= 0:
logger.error("n_nodes must be positive")

if n_threads:
n_threads = int(expander.expand_var(n_threads))
Expand Down
2 changes: 1 addition & 1 deletion lib/ramble/ramble/test/cmd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def test_config_add_to_workspace_preserve_comments(
variables:
n_ranks: '1'
n_nodes: '1'
processors_per_node: '1'
processes_per_node: '1'
"""
with open(filepath, "w") as f:
f.write(contents)
Expand Down
2 changes: 1 addition & 1 deletion lib/ramble/ramble/test/end_to_end/passthrough_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_disable_passthrough(mutable_config, mutable_mock_workspace_path):
ramble:
variables:
batch_submit: '{execute_experiment}'
processes_per_node: -1
processes_per_node: 1
applications:
hostname:
workloads:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ramble:
variables:
mpi_command: ''
batch_submit: '{execute_experiment}'
processes_per_node: -1
processes_per_node: 1
applications:
iperf2:
workloads:
Expand Down