Skip to content
Snippets Groups Projects
Commit d5a6e943 authored by Moe Jette's avatar Moe Jette
Browse files

Fix bug introduced in -Z option when adding support for allocate option.

parent b99b3eb4
No related branches found
No related tags found
No related merge requests found
......@@ -114,7 +114,7 @@ job_create(resource_allocation_response_msg_t *resp)
pthread_mutex_init(&job->task_mutex, NULL);
ntask = opt.nprocs;
tph = ntask / job->nhosts; /* expect trucation of result here */
tph = (ntask+job->nhosts-1) / job->nhosts; /* tasks per host, round up */
for(i = 0; i < job->nhosts; i++) {
struct hostent *he;
......@@ -130,9 +130,12 @@ job_create(resource_allocation_response_msg_t *resp)
/* actual task counts and layouts performed in launch() */
/* job->ntask[i] = 0; */
job->cpus[i] = resp->cpus_per_node[cpu_inx];
if ((++cpu_cnt) >= resp->cpu_count_reps[cpu_inx])
cpu_inx++;
if (resp) {
job->cpus[i] = resp->cpus_per_node[cpu_inx];
if ((++cpu_cnt) >= resp->cpu_count_reps[cpu_inx])
cpu_inx++;
} else
job->cpus[i] = tph;
}
return job;
......
......@@ -138,10 +138,8 @@ main(int ac, char **av)
create_job_step(job);
slurm_free_resource_allocation_response_msg(resp);
} else if (opt.allocate) {
if (!(resp = allocate_nodes()) || (resp->node_list == NULL)) {
info("No nodes allocated. exiting");
if ( !(resp = allocate_nodes()) )
exit(1);
}
if (_verbose || _debug)
print_job_information(resp);
else
......@@ -152,10 +150,8 @@ main(int ac, char **av)
info ("Spawned srun shell terminated");
exit (0);
} else {
if (!(resp = allocate_nodes()) || (resp->node_list == NULL)) {
info("No nodes allocated. exiting");
if ( !(resp = allocate_nodes()) )
exit(1);
}
if (_verbose || _debug)
print_job_information(resp);
else
......@@ -324,12 +320,16 @@ allocate_nodes(void)
sleep (++retries);
}
else {
error("Unable to allocate resources: %s",
slurm_strerror(errno));
error("Unable to allocate resources: %s", slurm_strerror(errno));
return NULL;
}
}
if (resp->node_list == NULL) {
info("No nodes allocated. exiting");
return NULL;
}
return resp;
}
......
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