diff --git a/doc/man/man1/srun.1 b/doc/man/man1/srun.1 index 2989976d57799bbfd7d795031d118b396fed18b0..4ac42b02a87c1523d5cfbb9c2bb595636a0bac9a 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 6411a1e4a2ad6c6e4609713d0c69062f99f9fa12..167c1e863a56a99b02ad60a41449d2672aadd415 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;