diff --git a/src/srun/opt.c b/src/srun/opt.c index 11d3693b9a2496cfd1ce7af4c12ab81af2a6766d..ca2093b3bc6851100b9181b41cffb82e7fe868e4 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -42,6 +42,7 @@ #endif #include <string.h> /* strcpy, strncasecmp */ +#include <math.h> #ifdef HAVE_STRINGS_H # include <strings.h> @@ -1670,7 +1671,12 @@ static void _opt_args(int argc, char **argv) opt.max_nodes = opt.min_nodes = node_cnt = opt.ntasks; if (!opt.ntasks_per_node || (opt.ntasks_per_node == NO_VAL)) { - opt.ntasks_per_node = opt.ntasks / node_cnt; + /* We always want the next larger number if + there is a fraction so we try to stay in + the allocation requested. + */ + opt.ntasks_per_node = ceil((double)opt.ntasks + / (double)node_cnt); figured = true; }