Skip to content
Snippets Groups Projects
Commit 4572e9f1 authored by jette's avatar jette
Browse files

srun: better handle inconsistent node/task/ntasks-per-node options

parent 2f0db724
No related branches found
No related tags found
No related merge requests found
...@@ -1946,6 +1946,7 @@ static bool _opt_verify(void) ...@@ -1946,6 +1946,7 @@ static bool _opt_verify(void)
else else
opt.min_nodes = hl_cnt; opt.min_nodes = hl_cnt;
} }
if ((opt.nodes_set || opt.extra_set) && if ((opt.nodes_set || opt.extra_set) &&
((opt.min_nodes == opt.max_nodes) || (opt.max_nodes == 0)) && ((opt.min_nodes == opt.max_nodes) || (opt.max_nodes == 0)) &&
!opt.ntasks_set) { !opt.ntasks_set) {
...@@ -1960,7 +1961,7 @@ static bool _opt_verify(void) ...@@ -1960,7 +1961,7 @@ static bool _opt_verify(void)
opt.ntasks *= opt.cores_per_socket; opt.ntasks *= opt.cores_per_socket;
opt.ntasks *= opt.threads_per_core; opt.ntasks *= opt.threads_per_core;
opt.ntasks_set = true; opt.ntasks_set = true;
} else if (opt.ntasks_per_node > 0) } else if (opt.ntasks_per_node != NO_VAL)
opt.ntasks *= opt.ntasks_per_node; opt.ntasks *= opt.ntasks_per_node;
/* massage the numbers */ /* massage the numbers */
...@@ -1986,7 +1987,6 @@ static bool _opt_verify(void) ...@@ -1986,7 +1987,6 @@ static bool _opt_verify(void)
/* Don't destroy hl here since it may be used later */ /* Don't destroy hl here since it may be used later */
} }
} else if (opt.nodes_set && opt.ntasks_set) { } else if (opt.nodes_set && opt.ntasks_set) {
/* /*
* Make sure that the number of * Make sure that the number of
* max_nodes is <= number of tasks * max_nodes is <= number of tasks
...@@ -2019,7 +2019,14 @@ static bool _opt_verify(void) ...@@ -2019,7 +2019,14 @@ static bool _opt_verify(void)
hostlist_ranged_string_xmalloc(hl); hostlist_ranged_string_xmalloc(hl);
} }
} }
if ((opt.ntasks_per_node != NO_VAL) &&
((opt.min_nodes == opt.max_nodes) || (opt.max_nodes == 0))&&
(opt.ntasks != (opt.min_nodes * opt.ntasks_per_node))) {
error("task count inconsistent with node count and "
"ntasks-per_node (%d != %d x %d).",
opt.ntasks, opt.min_nodes, opt.ntasks_per_node);
opt.ntasks = opt.min_nodes * opt.ntasks_per_node;
}
} /* else if (opt.ntasks_set && !opt.nodes_set) */ } /* else if (opt.ntasks_set && !opt.nodes_set) */
if (hl) if (hl)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment