diff --git a/src/srun/launch.c b/src/srun/launch.c index 62c6d803ce587669a1da22b8d6b32bba9cf8d8b5..f1d2c7c3ad496d7555e9b917506d568ca7df73eb 100644 --- a/src/srun/launch.c +++ b/src/srun/launch.c @@ -164,9 +164,6 @@ static void p_launch(slurm_msg_t *req_array_ptr, job_t *job) task_info_t *task_info_ptr; thd_t *thread_ptr; - if (opt.max_threads > job->nhosts) /* don't need more threads than tasks */ - opt.max_threads = job->nhosts; - thread_ptr = xmalloc (job->nhosts * sizeof (thd_t)); for (i = 0; i < job->nhosts; i++) { if (job->ntask[i] == 0) { /* No tasks for this node */ diff --git a/src/srun/opt.c b/src/srun/opt.c index 0d1c26fb4d938744ffd100bacd0575779ab2b29e..0935c00e5a9513c42501bb386e4b458a80a92712 100644 --- a/src/srun/opt.c +++ b/src/srun/opt.c @@ -847,11 +847,6 @@ opt_verify(poptContext optctx) { bool verified = true; - if (opt.max_threads < 1) { - error("Invalid max_threads value: %d", opt.max_threads); - return false; - } - if (opt.no_alloc && !opt.nodelist) { error("must specify a node list with -Z, --no-allocate."); verified = false; @@ -945,6 +940,15 @@ opt_verify(poptContext optctx) } + if (opt.max_threads <= 0) { /* set default */ + error("Thread value invalid, reset to 1"); + opt.max_threads = 1; + } else if (opt.max_threads > MAX_THREADS) { + error("Thread value exceeds system limit, reset to %d", + MAX_THREADS); + opt.max_threads = MAX_THREADS; + } + return verified; } diff --git a/src/srun/srun.c b/src/srun/srun.c index d83619f92adf3ae85bed69ec147d1047836d9050..48c0e9803c50508b6dead334dba7f7b56989c5f9 100644 --- a/src/srun/srun.c +++ b/src/srun/srun.c @@ -575,9 +575,6 @@ static void p_fwd_signal(slurm_msg_t *req_array_ptr, job_t *job) task_info_t *task_info_ptr; thd_t *thread_ptr; - if (opt.max_threads > job->nhosts) /* don't need more threads than tasks */ - opt.max_threads = job->nhosts; - thread_ptr = xmalloc (job->nhosts * sizeof (thd_t)); for (i = 0; i < job->nhosts; i++) { if (req_array_ptr[i].msg_type == 0)