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

correct bad pointer used in select/cons_res scheduling with Moab and topology plugin.

parent ec648ca5
No related branches found
No related tags found
No related merge requests found
......@@ -767,12 +767,19 @@ bitstr_t *_make_core_bitmap(bitstr_t *node_map)
}
/* return the number of cpus that the given
* job can run on the indexed node */
/*
* Determine the number of CPUs that a given job can use on a specific node
* IN: job_ptr - pointer to job we are attempting to start
* IN: node_index - zero origin node being considered for use
* IN: cpu_cnt - array with count of CPU's availble to job on each node
* IN: freq - array with repetition counts for each cpu_cnt entry
* IN: size - length of cpu_cnt and freq arrays
* RET: number of usable CPUs on the identified node
*/
static int _get_cpu_cnt(struct job_record *job_ptr, const int node_index,
uint16_t *cpu_cnt, uint32_t *freq, uint32_t size)
uint16_t *cpu_cnt, uint32_t *freq, uint32_t size)
{
int i, pos, cpus;
int i, offset, pos, cpus;
uint16_t *layout_ptr = job_ptr->details->req_node_layout;
pos = 0;
......@@ -782,16 +789,18 @@ static int _get_cpu_cnt(struct job_record *job_ptr, const int node_index,
pos += freq[i];
}
cpus = cpu_cnt[i];
if (layout_ptr && bit_test(job_ptr->details->req_node_bitmap, i)) {
pos = bit_get_pos_num(job_ptr->details->req_node_bitmap, i);
cpus = MIN(cpus, layout_ptr[pos]);
if (layout_ptr &&
bit_test(job_ptr->details->req_node_bitmap, node_index)) {
offset = bit_get_pos_num(job_ptr->details->req_node_bitmap,
node_index);
cpus = MIN(cpus, layout_ptr[offset]);
} else if (layout_ptr) {
cpus = 0; /* should not happen? */
}
return cpus;
}
#define CR_FREQ_ARRAY_INCREMENT 16
/* Compute resource usage for the given job on all available resources
......
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