From 273dffecf19b0e93d81a8a0c26ec7ec26ff7dee3 Mon Sep 17 00:00:00 2001 From: Morris Jette <jette@schedmd.com> Date: Wed, 20 Jun 2012 13:53:01 -0700 Subject: [PATCH] Mods for zero size allocation This change permits a user to get a zero size allocation by specifying a task count of zero with no node count specification. --- src/sbatch/opt.c | 2 +- src/sbatch/sbatch.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sbatch/opt.c b/src/sbatch/opt.c index c37106a755c..4aedfbcdea9 100644 --- a/src/sbatch/opt.c +++ b/src/sbatch/opt.c @@ -2161,7 +2161,7 @@ static bool _opt_verify(void) setenv("SLURM_JOB_NAME", opt.job_name, 0); /* check for realistic arguments */ - if (opt.ntasks <= 0) { + if (opt.ntasks < 0) { error("invalid number of tasks (-n %d)", opt.ntasks); verified = false; } diff --git a/src/sbatch/sbatch.c b/src/sbatch/sbatch.c index 939b9472eb0..964d5e42734 100644 --- a/src/sbatch/sbatch.c +++ b/src/sbatch/sbatch.c @@ -281,12 +281,14 @@ static int _fill_job_desc_from_opts(job_desc_msg_t *desc) desc->req_nodes = opt.nodelist; desc->exc_nodes = opt.exc_nodes; desc->partition = opt.partition; - if (opt.nodes_set || opt.min_nodes) - desc->min_nodes = opt.min_nodes; if (opt.licenses) desc->licenses = xstrdup(opt.licenses); - if (opt.nodes_set || opt.max_nodes) - desc->max_nodes = opt.max_nodes; + if (opt.nodes_set) { + desc->min_nodes = opt.min_nodes; + if (opt.max_nodes) + desc->max_nodes = opt.max_nodes; + } else if (opt.ntasks_set && (opt.ntasks == 0)) + desc->min_nodes = 0; if (opt.ntasks_per_node) desc->ntasks_per_node = opt.ntasks_per_node; desc->user_id = opt.uid; -- GitLab