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

treat gres allocations like memory, allocate it whenever the job is allocated

resources on the node, job suspend has no effect on allocated gres (previously
it did).
parent 2f4331f3
No related branches found
No related tags found
No related merge requests found
...@@ -815,9 +815,9 @@ static void _build_row_bitmaps(struct part_res_record *p_ptr) ...@@ -815,9 +815,9 @@ static void _build_row_bitmaps(struct part_res_record *p_ptr)
* - add 'struct job_resources' resources to 'struct part_res_record' * - add 'struct job_resources' resources to 'struct part_res_record'
* - add job's memory requirements to 'struct node_res_record' * - add job's memory requirements to 'struct node_res_record'
* *
* if action = 0 then add cores and memory * if action = 0 then add cores and memory (starting new job)
* if action = 1 then only add memory (job is suspended) * if action = 1 then only add memory (adding suspended job)
* if action = 2 then only add cores (job is resumed) * if action = 2 then only add cores (suspended job is resumed)
*/ */
static int _add_job_to_res(struct job_record *job_ptr, int action) static int _add_job_to_res(struct job_record *job_ptr, int action)
{ {
...@@ -844,14 +844,16 @@ static int _add_job_to_res(struct job_record *job_ptr, int action) ...@@ -844,14 +844,16 @@ static int _add_job_to_res(struct job_record *job_ptr, int action)
n++; n++;
node_ptr = select_node_record[i].node_ptr; node_ptr = select_node_record[i].node_ptr;
if (select_node_usage[i].gres_list) if (action != 2) {
gres_list = select_node_usage[i].gres_list; if (select_node_usage[i].gres_list)
else gres_list = select_node_usage[i].gres_list;
gres_list = node_ptr->gres_list; else
gres_plugin_job_alloc(job_ptr->gres_list, gres_list, gres_list = node_ptr->gres_list;
job->nhosts, n, job->cpus[n], gres_plugin_job_alloc(job_ptr->gres_list, gres_list,
job_ptr->job_id, node_ptr->name); job->nhosts, n, job->cpus[n],
gres_plugin_node_state_log(gres_list, node_ptr->name); job_ptr->job_id, node_ptr->name);
gres_plugin_node_state_log(gres_list, node_ptr->name);
}
if (action != 2) { if (action != 2) {
if (job->memory_allocated[n] == 0) if (job->memory_allocated[n] == 0)
...@@ -921,7 +923,7 @@ static int _add_job_to_res(struct job_record *job_ptr, int action) ...@@ -921,7 +923,7 @@ static int _add_job_to_res(struct job_record *job_ptr, int action)
* - subtract 'struct job_resources' resources from 'struct part_res_record' * - subtract 'struct job_resources' resources from 'struct part_res_record'
* - subtract job's memory requirements from 'struct node_res_record' * - subtract job's memory requirements from 'struct node_res_record'
* *
* if action = 0 then subtract cores and memory * if action = 0 then subtract cores and memory (running job was terminated)
* if action = 1 then only subtract memory (suspended job was terminated) * if action = 1 then only subtract memory (suspended job was terminated)
* if action = 2 then only subtract cores (job is suspended) * if action = 2 then only subtract cores (job is suspended)
* *
...@@ -954,13 +956,16 @@ static int _rm_job_from_res(struct part_res_record *part_record_ptr, ...@@ -954,13 +956,16 @@ static int _rm_job_from_res(struct part_res_record *part_record_ptr,
n++; n++;
node_ptr = node_record_table_ptr + i; node_ptr = node_record_table_ptr + i;
if (node_usage[i].gres_list) if (action != 2) {
gres_list = node_usage[i].gres_list; if (node_usage[i].gres_list)
else gres_list = node_usage[i].gres_list;
gres_list = node_ptr->gres_list; else
gres_plugin_job_dealloc(job_ptr->gres_list, gres_list, n, gres_list = node_ptr->gres_list;
job_ptr->job_id, node_ptr->name); gres_plugin_job_dealloc(job_ptr->gres_list, gres_list,
gres_plugin_node_state_log(gres_list, node_ptr->name); n, job_ptr->job_id,
node_ptr->name);
gres_plugin_node_state_log(gres_list, node_ptr->name);
}
if (action != 2) { if (action != 2) {
if (job->memory_allocated[n] == 0) if (job->memory_allocated[n] == 0)
......
...@@ -1391,14 +1391,16 @@ static int _rm_job_from_nodes(struct cr_record *cr_ptr, ...@@ -1391,14 +1391,16 @@ static int _rm_job_from_nodes(struct cr_record *cr_ptr,
pre_err, node_ptr->name); pre_err, node_ptr->name);
} }
if (cr_ptr->nodes[i].gres_list) if (remove_all) {
gres_list = cr_ptr->nodes[i].gres_list; if (cr_ptr->nodes[i].gres_list)
else gres_list = cr_ptr->nodes[i].gres_list;
gres_list = node_ptr->gres_list; else
gres_plugin_job_dealloc(job_ptr->gres_list, gres_list, gres_list = node_ptr->gres_list;
node_offset, job_ptr->job_id, gres_plugin_job_dealloc(job_ptr->gres_list, gres_list,
node_ptr->name); node_offset, job_ptr->job_id,
gres_plugin_node_state_log(gres_list, node_ptr->name); node_ptr->name);
gres_plugin_node_state_log(gres_list, node_ptr->name);
}
if (exclusive) { if (exclusive) {
if (cr_ptr->nodes[i].exclusive_cnt) if (cr_ptr->nodes[i].exclusive_cnt)
...@@ -1669,14 +1671,16 @@ static int _add_job_to_nodes(struct cr_record *cr_ptr, ...@@ -1669,14 +1671,16 @@ static int _add_job_to_nodes(struct cr_record *cr_ptr,
} else } else
cr_ptr->nodes[i].alloc_memory += job_memory_node; cr_ptr->nodes[i].alloc_memory += job_memory_node;
if (cr_ptr->nodes[i].gres_list) if (alloc_all) {
gres_list = cr_ptr->nodes[i].gres_list; if (cr_ptr->nodes[i].gres_list)
else gres_list = cr_ptr->nodes[i].gres_list;
gres_list = node_ptr->gres_list; else
gres_plugin_job_alloc(job_ptr->gres_list, gres_list, gres_list = node_ptr->gres_list;
node_cnt, node_offset, cpu_cnt, gres_plugin_job_alloc(job_ptr->gres_list, gres_list,
job_ptr->job_id, node_ptr->name); node_cnt, node_offset, cpu_cnt,
gres_plugin_node_state_log(gres_list, node_ptr->name); job_ptr->job_id, node_ptr->name);
gres_plugin_node_state_log(gres_list, node_ptr->name);
}
if (exclusive) if (exclusive)
cr_ptr->nodes[i].exclusive_cnt++; cr_ptr->nodes[i].exclusive_cnt++;
......
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