From c2b2512be7d90d56afe55d8038d06749ab122813 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 2 Dec 2002 18:03:00 +0000 Subject: [PATCH] Return behaviour to block distribution by default iff the number of tasks exceeds the number of nodes and document this behaviour. --- doc/man/man1/srun.1 | 6 ++++-- src/srun/opt.c | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1 index 2989976d577..4ac42b02a87 100644 --- a/doc/man/man1/srun.1 +++ b/doc/man/man1/srun.1 @@ -97,12 +97,14 @@ Specify an alternate distribution method for remote processes. .TP .B block The block method of distribution will allocate processes in-order to -the cpus on a node. +the cpus on a node. This is the default behavior if the number of tasks +exceeds the number of nodes requested. .TP .B cyclic The cyclic method distributes processes in a round-robin fashion across the allocated nodes. That is, process 1 will be allocated to the first -node, process 2 to the second, and so on. This is the default behavior. +node, process 2 to the second, and so on. This is the default behavior +if the number of tasks is no larger than the number of nodes requested. .RE .TP \fB\-J\fR, \fB\-\-job\-name\fR=\fIjobname\fR diff --git a/src/srun/opt.c b/src/srun/opt.c index 6411a1e4a2a..167c1e863a5 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -880,8 +880,12 @@ _opt_verify(poptContext optctx) verified = false; } - if (opt.distribution == SRUN_DIST_UNKNOWN) - opt.distribution = SRUN_DIST_CYCLIC; + if (opt.distribution == SRUN_DIST_UNKNOWN) { + if (opt.nprocs <= opt.nodes) + opt.distribution = SRUN_DIST_CYCLIC; + else + opt.distribution = SRUN_DIST_BLOCK; + } if (opt.mincpus < opt.cpus_per_task) opt.mincpus = opt.cpus_per_task; -- GitLab