Skip to content
Snippets Groups Projects
Commit 381b8894 authored by Mark Grondona's avatar Mark Grondona
Browse files

o fix calculation of "cpus per node" when running in no-allocate mode.

 o change variable named "info" to "ai"
parent bfac0360
No related branches found
No related tags found
No related merge requests found
...@@ -129,9 +129,10 @@ job_t * ...@@ -129,9 +129,10 @@ job_t *
job_create_noalloc(void) job_create_noalloc(void)
{ {
job_t *job = NULL; job_t *job = NULL;
allocation_info_t *info = xmalloc(sizeof(*info)); allocation_info_t *ai = xmalloc(sizeof(*ai));
int cpn = 1; int cpn = 1;
int i; int i = 0;
hostlist_t hl = hostlist_create(opt.nodelist); hostlist_t hl = hostlist_create(opt.nodelist);
if (!hl) { if (!hl) {
...@@ -140,27 +141,27 @@ job_create_noalloc(void) ...@@ -140,27 +141,27 @@ job_create_noalloc(void)
} }
srand48(getpid()); srand48(getpid());
info->jobid = MIN_NOALLOC_JOBID + ai->jobid = MIN_NOALLOC_JOBID +
((uint32_t) lrand48() % ((uint32_t) lrand48() %
(MAX_NOALLOC_JOBID - MIN_NOALLOC_JOBID + 1)); (MAX_NOALLOC_JOBID - MIN_NOALLOC_JOBID + 1));
info->stepid = (uint32_t) (lrand48()); ai->stepid = (uint32_t) (lrand48());
info->nodelist = opt.nodelist; ai->nodelist = opt.nodelist;
info->nnodes = hostlist_count(hl); ai->nnodes = hostlist_count(hl);
/* if (opt.nprocs < info->nnodes) /* if (opt.nprocs < ai->nnodes)
opt.nprocs = hostlist_count(hl); opt.nprocs = hostlist_count(hl);
*/ */
hostlist_destroy(hl); hostlist_destroy(hl);
cpn = opt.nprocs / info->nnodes; cpn = (opt.nprocs + ai->nnodes - 1) / ai->nnodes;
info->cpus_per_node = &cpn; ai->cpus_per_node = &cpn;
info->cpu_count_reps = &opt.nprocs; ai->cpu_count_reps = &ai->nnodes;
info->addrs = NULL; ai->addrs = NULL;
/* /*
* Create job, then fill in host addresses * Create job, then fill in host addresses
*/ */
job = _job_create_internal(info); job = _job_create_internal(ai);
for (i = 0; i < job->nhosts; i++) { for (i = 0; i < job->nhosts; i++) {
slurm_set_addr ( &job->slurmd_addr[i], slurm_set_addr ( &job->slurmd_addr[i],
...@@ -171,7 +172,7 @@ job_create_noalloc(void) ...@@ -171,7 +172,7 @@ job_create_noalloc(void)
_job_fake_cred(job); _job_fake_cred(job);
error: error:
xfree(info); xfree(ai);
return (job); return (job);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment