diff --git a/doc/html/selectplugins.shtml b/doc/html/selectplugins.shtml index 63e992b89961fb2c9663d221ba0433318c4275e2..06fa422e3fcf05e77586eb9e41b4a150e541aa81 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 3b624362fd2b71de02760c6c4748d54168ba6646..2e150cd286434ef93fb298ddd1a3b4c77b0c1534 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 ea0d7938f7e55b1c999c103578b3dece81296b1b..cda271d186091e1f7d38d436ef8472ee06d50904 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 43d739ecbac4d2c15f7d2933ceb86d17eb2940d7..eff81f282366aa9ea40d1ab5c4fdd4d8d1492f5d 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 152b0ef9e4123725b3228a631a0d873223e15c1c..1ce0014ae134832372699e489d67701c6c209538 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 6f3ab1d1ac41db28e1dfe84cf8b0d7b59801c4c3..661371557a5317bf8160b6f73091cb2aa46917e9 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 3f27d639f8f37d384b173430f572778d0e9826cd..555f0fa9ed3ae7010ee27745026f57e4364120cc 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 ad1acf89565eb985b5ec435f8b56de6bc99e0ab3..1c73eca634357174dac12bc1bc6358e8a5830c91 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 25d0734307f47ece5b4ba7f0728ae3ca4782fd2a..1b564ae20131d3c1d4d8764a55da4c0cca963987 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 8ba9de50249e9bf282a749b9ace6b7d70c0765ad..ad2375365be3e4e3cfc397d77041ad30ae7a25c4 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 95c9f73a23fb4fb15c47c35549ae3d09f68c76a0..654420a6373ce060aeba6e087e065efee2534e7b 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 c6d0856326a7c36f210e5ab99aae71a01995ea69..d7046cfddacb7ec2e799e65e0ec5264468018177 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);