From 126918c3d2c2355a011d5ed8130bf21f065f310a Mon Sep 17 00:00:00 2001 From: Danny Auble <da@schedmd.com> Date: Fri, 26 Sep 2014 11:31:21 -0700 Subject: [PATCH] Change definition for select_p_resv_test --- doc/html/selectplugins.shtml | 17 ++++++------- src/common/node_select.c | 19 ++++++++------ src/common/node_select.h | 24 ++++++++++-------- src/plugins/select/alps/select_alps.c | 11 ++++---- src/plugins/select/bluegene/select_bluegene.c | 9 ++++--- src/plugins/select/cons_res/select_cons_res.c | 25 ++++++++----------- src/plugins/select/cray/select_cray.c | 11 ++++---- src/plugins/select/linear/select_linear.c | 21 +++++----------- src/plugins/select/other/other_select.c | 23 +++++------------ src/plugins/select/other/other_select.h | 19 +++----------- src/plugins/select/serial/select_serial.c | 25 ++++++++----------- src/slurmctld/reservation.c | 19 ++++++-------- 12 files changed, 92 insertions(+), 131 deletions(-) diff --git a/doc/html/selectplugins.shtml b/doc/html/selectplugins.shtml index 63e992b8996..06fa422e3fc 100644 --- a/doc/html/selectplugins.shtml +++ b/doc/html/selectplugins.shtml @@ -668,22 +668,21 @@ the plugin should return SLURM_ERROR.</p> <h3>Advanced Reservation Functions</h3> -<p class="commandline">bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, -uint32_t node_cnt, uint32_t *core_cnt, bitstr_t **core_bitmap, uint32_t flags)</p> +<p class="commandline">bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, uint32_t node_cnt, bitstr_t *avail_bitmap, bitstr_t **core_bitmap)</p> <p style="margin-left:.2in"><b>Description</b>: Identify the nodes which best satisfy a reservation request taking system topology into consideration if applicable.</p> <p style="margin-left:.2in"><b>Arguments</b>:<br> -<span class="commandline"> avail_bitmap</span> (input/output) -a bitmap of the nodes which are available for use in creating the reservation.<br> +<span class="commandline"> resv_desc_ptr</span> (input/output) +the request of the reservation. The node_list could be changed inside +of the plugin.<br> <span class="commandline"> node_cnt</span> (input) number of nodes required to satisfy the reservation request.<br> -<span class="commandline"> core_cnt</span> (input) -number of cores per node required to satisfy the reservation request.<br> +<span class="commandline"> avail_bitmap</span> (input/output) +a bitmap of the nodes which are available for use in creating the reservation.<br> <span class="commandline"> core_bitmap</span> (input/output) -a bitmap of the cores which are available for use in creating the reservation.<br> -<span class="commandline"> flags</span> (input) -flags associated with the reservation request.</p> +cores which can not be used for this reservation IN, and cores to be +used in the reservation OUT (flush bitstr then apply only used cores).<br> <p style="margin-left:.2in"><b>Returns</b>: A bitmap of the nodes which should be used for the advanced reservation or NULL if the selected nodes can not be used for an advanced reservation.</p> diff --git a/src/common/node_select.c b/src/common/node_select.c index 3b624362fd2..2e150cd2864 100644 --- a/src/common/node_select.c +++ b/src/common/node_select.c @@ -1275,22 +1275,25 @@ extern int select_g_reconfigure (void) * request. "best" is defined as either single set of consecutive nodes * satisfying the request and leaving the minimum number of unused nodes * OR the fewest number of consecutive node sets - * IN/OUT avail_bitmap - nodes available for the reservation + * IN/OUT resv_desc_ptr - reservation request - select_jobinfo can be + * updated in the plugin * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN/OUT core_bitmap - cores which can not be used for this reservation - * IN flags - reservation request flags + * IN/OUT avail_bitmap - nodes available for the reservation + * IN/OUT core_bitmap - cores which can not be used for this + * reservation IN, and cores to be used in the reservation OUT + * (flush bitstr then apply only used cores) * RET - nodes selected for use by the reservation */ -extern bitstr_t * select_g_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_g_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { if (slurm_select_init(0) < 0) return NULL; return (*(ops[select_context_default].resv_test)) - (avail_bitmap, node_cnt, core_cnt, core_bitmap, flags); + (resv_desc_ptr, node_cnt, avail_bitmap, core_bitmap); } extern void select_g_ba_init(node_info_msg_t *node_info_ptr, bool sanity_check) diff --git a/src/common/node_select.h b/src/common/node_select.h index ea0d7938f7e..cda271d1860 100644 --- a/src/common/node_select.h +++ b/src/common/node_select.h @@ -223,11 +223,10 @@ typedef struct slurm_select_ops { int (*alter_node_cnt) (enum select_node_cnt type, void *data); int (*reconfigure) (void); - bitstr_t * (*resv_test) (bitstr_t *avail_bitmap, + bitstr_t * (*resv_test) (resv_desc_msg_t *resv_desc_ptr, uint32_t node_cnt, - uint32_t *core_cnt, - bitstr_t **core_bitmap, - uint32_t flags); + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap); void (*ba_init) (node_info_msg_t *node_info_ptr, bool sanity_check); void (*ba_fini) (void); @@ -680,16 +679,19 @@ extern int select_g_step_finish(struct step_record *step_ptr); * request. "best" is defined as either single set of consecutive nodes * satisfying the request and leaving the minimum number of unused nodes * OR the fewest number of consecutive node sets - * IN/OUT avail_bitmap - nodes available for the reservation + * IN/OUT resv_desc_ptr - reservation request - select_jobinfo can be + * updated in the plugin * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN/OUT core_bitmap - cores which can not be used for this reservation - * IN flags - reservation request flags + * IN/OUT avail_bitmap - nodes available for the reservation + * IN/OUT core_bitmap - cores which can not be used for this + * reservation IN, and cores to be used in the reservation OUT + * (flush bitstr then apply only used cores) * RET - nodes selected for use by the reservation */ -extern bitstr_t * select_g_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags); +extern bitstr_t * select_g_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap); /*****************************\ * GET INFORMATION FUNCTIONS * diff --git a/src/plugins/select/alps/select_alps.c b/src/plugins/select/alps/select_alps.c index 43d739ecbac..eff81f28236 100644 --- a/src/plugins/select/alps/select_alps.c +++ b/src/plugins/select/alps/select_alps.c @@ -884,12 +884,13 @@ extern int select_p_reconfigure(void) return other_reconfigure(); } -extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { - return other_resv_test(avail_bitmap, node_cnt, core_cnt, core_bitmap, - flags); + return other_resv_test(resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); } extern void select_p_ba_init(node_info_msg_t *node_info_ptr, bool sanity_check) diff --git a/src/plugins/select/bluegene/select_bluegene.c b/src/plugins/select/bluegene/select_bluegene.c index 152b0ef9e41..1ce0014ae13 100644 --- a/src/plugins/select/bluegene/select_bluegene.c +++ b/src/plugins/select/bluegene/select_bluegene.c @@ -121,7 +121,7 @@ List assoc_mgr_qos_list = NULL; const char plugin_name[] = "BlueGene node selection plugin"; const char plugin_type[] = "select/bluegene"; const uint32_t plugin_id = 100; -const uint32_t plugin_version = 110; +const uint32_t plugin_version = 120; /* Global variables */ bg_config_t *bg_conf = NULL; @@ -3369,9 +3369,10 @@ extern int select_p_reconfigure(void) #endif } -extern bitstr_t *select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t *select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { #ifdef HAVE_BG /* Reserve a block of appropriate geometry by issuing a fake job diff --git a/src/plugins/select/cons_res/select_cons_res.c b/src/plugins/select/cons_res/select_cons_res.c index 6f3ab1d1ac4..661371557a5 100644 --- a/src/plugins/select/cons_res/select_cons_res.c +++ b/src/plugins/select/cons_res/select_cons_res.c @@ -2884,21 +2884,10 @@ static int _get_avail_core_in_node(bitstr_t *core_bitmap, int node, return 0; } -/* - * select_p_resv_test - Identify the nodes which "best" satisfy a reservation - * request. "best" is defined as either single set of consecutive nodes - * satisfying the request and leaving the minimum number of unused nodes - * OR the fewest number of consecutive node sets - * IN/OUT avail_bitmap - nodes available for the reservation - * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN/OUT core_bitmap - cores which can not be used for this reservation - * IN flags - reservation request flags - * RET - nodes selected for use by the reservation - */ -extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { bitstr_t **switches_bitmap; /* nodes on this switch */ bitstr_t **switches_core_bitmap; /* cores on this switch */ @@ -2915,8 +2904,14 @@ extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, int best_fit_location = 0, best_fit_sufficient; bool sufficient; int cores_per_node; + uint32_t *core_cnt; + uint32_t flags; xassert(avail_bitmap); + xassert(resv_desc_ptr); + + core_cnt = resv_desc_ptr->core_cnt; + flags = resv_desc_ptr->flags; if ((flags & RESERVE_FLAG_FIRST_CORES) && core_cnt) { return _pick_first_cores(avail_bitmap, node_cnt, core_cnt, diff --git a/src/plugins/select/cray/select_cray.c b/src/plugins/select/cray/select_cray.c index 3f27d639f8f..555f0fa9ed3 100644 --- a/src/plugins/select/cray/select_cray.c +++ b/src/plugins/select/cray/select_cray.c @@ -2287,12 +2287,13 @@ extern int select_p_reconfigure(void) return other_reconfigure(); } -extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { - return other_resv_test(avail_bitmap, node_cnt, core_cnt, core_bitmap, - flags); + return other_resv_test(resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); } extern void select_p_ba_init(node_info_msg_t *node_info_ptr, bool sanity_check) diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c index ad1acf89565..1c73eca6343 100644 --- a/src/plugins/select/linear/select_linear.c +++ b/src/plugins/select/linear/select_linear.c @@ -3423,21 +3423,10 @@ extern int select_p_reconfigure(void) return SLURM_SUCCESS; } -/* - * select_p_resv_test - Identify the nodes which "best" satisfy a reservation - * request. "best" is defined as either single set of consecutive nodes - * satisfying the request and leaving the minimum number of unused nodes - * OR the fewest number of consecutive node sets - * IN/OUT avail_bitmap - nodes available for the reservation - * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN/OUT core_bitmap - cores which can not be used for this reservation - * IN flags - reservation request flags - * RET - nodes selected for use by the reservation - */ -extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { bitstr_t **switches_bitmap; /* nodes on this switch */ int *switches_cpu_cnt; /* total CPUs on switch */ @@ -3453,6 +3442,8 @@ extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, bool sufficient; xassert(avail_bitmap); + xassert(resv_desc_ptr); + if (!switch_record_cnt || !switch_record_table) return bit_pick_cnt(avail_bitmap, node_cnt); diff --git a/src/plugins/select/other/other_select.c b/src/plugins/select/other/other_select.c index 25d0734307f..1b564ae2013 100644 --- a/src/plugins/select/other/other_select.c +++ b/src/plugins/select/other/other_select.c @@ -747,27 +747,16 @@ extern int other_reconfigure (void) return (*(ops.reconfigure))(); } -/* - * other_resv_test - Identify the nodes which "best" satisfy a reservation - * request. "best" is defined as either single set of consecutive nodes - * satisfying the request and leaving the minimum number of unused nodes - * OR the fewest number of consecutive node sets - * IN avail_bitmap - nodes available for the reservation - * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN core_bitmap - cores to be excluded for this reservation - * IN flags - reservation request flags - * RET - nodes selected for use by the reservation - */ -extern bitstr_t * other_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * other_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { if (other_select_init() < 0) return NULL; - return (*(ops.resv_test))(avail_bitmap, node_cnt, core_cnt, - core_bitmap, flags); + return (*(ops.resv_test))(resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); } extern void other_ba_init(node_info_msg_t *node_info_ptr, bool sanity_check) diff --git a/src/plugins/select/other/other_select.h b/src/plugins/select/other/other_select.h index 8ba9de50249..ad2375365be 100644 --- a/src/plugins/select/other/other_select.h +++ b/src/plugins/select/other/other_select.h @@ -383,21 +383,10 @@ extern int other_pack_select_info(time_t last_query_time, uint16_t show_flags, /* Note reconfiguration or change in partition configuration */ extern int other_reconfigure(void); -/* - * other_resv_test - Identify the nodes which "best" satisfy a reservation - * request. "best" is defined as either single set of consecutive nodes - * satisfying the request and leaving the minimum number of unused nodes - * OR the fewest number of consecutive node sets - * IN avail_bitmap - nodes available for the reservation - * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN core_bitmap - cores to be excluded for this reservation - * IN flags - reservation request flags - * RET - nodes selected for use by the reservation - */ -extern bitstr_t * other_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags); +extern bitstr_t * other_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap); extern void other_ba_init(node_info_msg_t *node_info_ptr, bool sanity_check); extern void other_ba_fini(void); diff --git a/src/plugins/select/serial/select_serial.c b/src/plugins/select/serial/select_serial.c index 95c9f73a23f..654420a6373 100644 --- a/src/plugins/select/serial/select_serial.c +++ b/src/plugins/select/serial/select_serial.c @@ -2128,21 +2128,10 @@ extern int select_p_reconfigure(void) return SLURM_SUCCESS; } -/* - * select_p_resv_test - Identify the nodes which "best" satisfy a reservation - * request. "best" is defined as either single set of consecutive nodes - * satisfying the request and leaving the minimum number of unused nodes - * OR the fewest number of consecutive node sets - * IN/OUT avail_bitmap - nodes available for the reservation - * IN node_cnt - count of required nodes - * IN core_cnt - count of required cores per node - * IN/OUT core_bitmap - cores which can not be used for this reservation - * IN flags - reservation request flags - * RET - nodes selected for use by the reservation - */ -extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, - uint32_t *core_cnt, bitstr_t **core_bitmap, - uint32_t flags) +extern bitstr_t * select_p_resv_test(resv_desc_msg_t *resv_desc_ptr, + uint32_t node_cnt, + bitstr_t *avail_bitmap, + bitstr_t **core_bitmap) { int i, j; int core_inx = 0, node_cores; @@ -2150,8 +2139,14 @@ extern bitstr_t * select_p_resv_test(bitstr_t *avail_bitmap, uint32_t node_cnt, int rem_cores = 0; bitstr_t *new_bitmap; bool enforce_node_cnt = (node_cnt != 0); + uint32_t *core_cnt; + uint32_t flags; xassert(avail_bitmap); + xassert(resv_desc_ptr); + + core_cnt = resv_desc_ptr->core_cnt; + flags = resv_desc_ptr->flags; if (flags & RESERVE_FLAG_FIRST_CORES) { debug("select/serial: Reservation flag FIRST_CORES not " diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c index c6d0856326a..d7046cfddac 100644 --- a/src/slurmctld/reservation.c +++ b/src/slurmctld/reservation.c @@ -3429,9 +3429,8 @@ static bitstr_t *_pick_idle_node_cnt(bitstr_t *avail_bitmap, return NULL; } else if ((total_node_cnt == node_cnt) && (resv_desc_ptr->flags & RESERVE_FLAG_IGN_JOBS)) { - return select_g_resv_test(avail_bitmap, node_cnt, - resv_desc_ptr->core_cnt, core_bitmap, - resv_desc_ptr->flags); + return select_g_resv_test(resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); } orig_bitmap = bit_copy(avail_bitmap); @@ -3458,10 +3457,8 @@ static bitstr_t *_pick_idle_node_cnt(bitstr_t *avail_bitmap, /* NOTE: select_g_resv_test() does NOT preserve avail_bitmap, * so we do that here and other calls to that function */ save_bitmap = bit_copy(avail_bitmap); - ret_bitmap = select_g_resv_test(avail_bitmap, node_cnt, - resv_desc_ptr->core_cnt, - core_bitmap, - resv_desc_ptr->flags); + ret_bitmap = select_g_resv_test(resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); if (ret_bitmap) goto fini; bit_or(avail_bitmap, save_bitmap); @@ -3488,11 +3485,9 @@ static bitstr_t *_pick_idle_node_cnt(bitstr_t *avail_bitmap, total_node_cnt = bit_set_count(avail_bitmap); if (total_node_cnt >= node_cnt) { save_bitmap = bit_copy(avail_bitmap); - ret_bitmap = select_g_resv_test(avail_bitmap, - node_cnt, - resv_desc_ptr->core_cnt, - core_bitmap, - resv_desc_ptr->flags); + ret_bitmap = select_g_resv_test( + resv_desc_ptr, node_cnt, + avail_bitmap, core_bitmap); if (!ret_bitmap) { bit_or(avail_bitmap, save_bitmap); FREE_NULL_BITMAP(save_bitmap); -- GitLab