diff --git a/src/common/node_conf.c b/src/common/node_conf.c index eea68a9e6362f0e93de738b650fb911ee22e8145..0943bc768052144d9eeb43ca4e467d34ea60f38d 100644 --- a/src/common/node_conf.c +++ b/src/common/node_conf.c @@ -1095,15 +1095,18 @@ extern uint32_t cr_get_coremap_offset(uint32_t node_index) return cr_node_cores_offset[node_index]; } -/* The value of threads should be from config_ptr->threads if slurm.conf has fast schedule turned on (config_record); - * otherwise, it should be from node_ptr->threads (node_record). +/* Given the number of tasks per core and the actual number of hw threads, + * compute how many CPUs are "visible" and, hence, usable on the node. */ -extern int _adjust_cpus_nppcu(uint16_t ntasks_per_core, uint16_t threads, int cpus ) { +extern int adjust_cpus_nppcu(uint16_t ntasks_per_core, uint16_t threads, + int cpus) +{ if (ntasks_per_core == 0xffff) ntasks_per_core = threads; - /* Adjust the number of CPUs according to the percentage of the hwthreads/core being used. */ + /* Adjust the number of CPUs according to the percentage of the + * hwthreads/core being used. */ cpus *= ntasks_per_core; cpus /= threads; diff --git a/src/common/node_conf.h b/src/common/node_conf.h index 22b44c6ff2434165601b6d736c420c7a74a048a6..6cd0c332ede91c84c67367ae4d6c4be334367a08 100644 --- a/src/common/node_conf.h +++ b/src/common/node_conf.h @@ -281,9 +281,10 @@ extern void cr_fini_global_core_data(void); /*return the coremap index to the first core of the given node */ extern uint32_t cr_get_coremap_offset(uint32_t node_index); -/* Given the number of tasks per core and the actual number of hw threads, compute - * how many CPUs are "visible" and, hence, usable on the node. +/* Given the number of tasks per core and the actual number of hw threads, + * compute how many CPUs are "visible" and, hence, usable on the node. */ -extern int _adjust_cpus_nppcu(uint16_t ntasks_per_core, uint16_t threads, int cpus); +extern int adjust_cpus_nppcu(uint16_t ntasks_per_core, uint16_t threads, + int cpus); #endif /* !_HAVE_NODE_CONF_H */ diff --git a/src/common/slurm_resource_info.c b/src/common/slurm_resource_info.c index 66d6d358d4ff013efba2a96d7622d5be451a5fb0..7b2d1c20cb70a0ebdf7a95177826bd53e2c39e49 100644 --- a/src/common/slurm_resource_info.c +++ b/src/common/slurm_resource_info.c @@ -138,6 +138,7 @@ int slurm_get_avail_procs(const uint16_t socket_cnt, char *name) { uint16_t avail_cpus = 0; + uint32_t nppcu; /* pick defaults for any unspecified items */ if (cpus_per_task <= 0) @@ -163,17 +164,17 @@ int slurm_get_avail_procs(const uint16_t socket_cnt, info("get_avail_procs %u %s alloc_cores[%d] = %u", job_id, name, i, alloc_cores[i]); #endif - uint32_t nppcu = ntaskspercore; - - if (nppcu == 0xffff) { /* nppcu was not explicitly set, use all threads */ - info( "***** nppcu was not explicitly set, use all threads *****"); + nppcu = ntaskspercore; + if (nppcu == 0xffff) { + verbose("nppcu not explicitly set for job %u, use all threads", + job_id); nppcu = *threads; } avail_cpus = *sockets * *cores * *threads; avail_cpus = avail_cpus * nppcu / *threads; - if(ntaskspernode>0) + if (ntaskspernode > 0) avail_cpus = MIN(avail_cpus, ntaskspernode * cpus_per_task); #if (DEBUG) diff --git a/src/plugins/select/cray/basil_alps.h b/src/plugins/select/cray/basil_alps.h index 470fa3323d0ae9e1e3fdf1c6b5e86f74c76fa46e..02a6f8c9c735d818eedf47dcad5dd015be696840 100644 --- a/src/plugins/select/cray/basil_alps.h +++ b/src/plugins/select/cray/basil_alps.h @@ -623,7 +623,8 @@ extern void free_inv(struct basil_inventory *inv); extern long basil_reserve(const char *user, const char *batch_id, uint32_t width, uint32_t depth, uint32_t nppn, - uint32_t mem_mb, uint32_t nppcu, struct nodespec *ns_head, + uint32_t mem_mb, uint32_t nppcu, + struct nodespec *ns_head, struct basil_accel_param *accel_head); extern int basil_confirm(uint32_t rsvn_id, int job_id, uint64_t pagg_id); extern const struct basil_rsvn *basil_rsvn_by_id(const struct basil_inventory *inv, diff --git a/src/plugins/select/cray/basil_interface.c b/src/plugins/select/cray/basil_interface.c index 4f48e9ba2f73c38c11302a56b4c43091052bf963..77f92d156d9a4cbf9a8ce273c35d34fba21265d8 100644 --- a/src/plugins/select/cray/basil_interface.c +++ b/src/plugins/select/cray/basil_interface.c @@ -776,13 +776,16 @@ extern int do_basil_reserve(struct job_record *job_ptr) } if (slurmctld_conf.select_type_param & CR_ONE_TASK_PER_CORE) { - if ( job_ptr->details && job_ptr->details->mc_ptr && job_ptr->details->mc_ptr->ntasks_per_core == 0xffff ) { + if (job_ptr->details && job_ptr->details->mc_ptr && + (job_ptr->details->mc_ptr->ntasks_per_core == 0xffff)) { nppcu = 1; - debug("No explicit ntasks-per-core has been set, using nppcu=1."); + debug("No explicit ntasks-per-core has been set, " + "using nppcu=1."); } } - if ( job_ptr->details && job_ptr->details->mc_ptr && job_ptr->details->mc_ptr->ntasks_per_core != 0xffff ) { + if (job_ptr->details && job_ptr->details->mc_ptr && + (job_ptr->details->mc_ptr->ntasks_per_core != 0xffff)) { nppcu = job_ptr->details->mc_ptr->ntasks_per_core; } @@ -849,9 +852,12 @@ extern int do_basil_reserve(struct job_record *job_ptr) for (i = 0; i < job_ptr->job_resrcs->nhosts; i++) { uint32_t node_tasks = job_ptr->job_resrcs->cpus[i] / mppdepth; - if ( job_ptr->job_resrcs->sockets_per_node[i] > 0 && job_ptr->job_resrcs->cores_per_socket[i] > 0 ) - hwthreads_per_core = job_ptr->job_resrcs->cpus[i] / job_ptr->job_resrcs->sockets_per_node[i] / job_ptr->job_resrcs->cores_per_socket[i]; - + if ((job_ptr->job_resrcs->sockets_per_node[i] > 0) && + (job_ptr->job_resrcs->cores_per_socket[i] > 0)) { + hwthreads_per_core = job_ptr->job_resrcs->cpus[i] / + job_ptr->job_resrcs->sockets_per_node[i] / + job_ptr->job_resrcs->cores_per_socket[i]; + } if (nppcu) node_tasks = node_tasks * nppcu / hwthreads_per_core; diff --git a/src/plugins/select/cray/libalps/basil_request.c b/src/plugins/select/cray/libalps/basil_request.c index 15f66f0baefbbf803191036420a06e5870c75790..9345299c92404b782976641ab1332d9a8319d021 100644 --- a/src/plugins/select/cray/libalps/basil_request.c +++ b/src/plugins/select/cray/libalps/basil_request.c @@ -89,8 +89,8 @@ static void _rsvn_write_reserve_xml(FILE *fp, struct basil_reservation *r, _write_xml(fp, " <ReserveParam architecture=\"%s\" " "width=\"%ld\" depth=\"%ld\" nppn=\"%ld\"" " nppcu=\"%d\"", - nam_arch[param->arch], - param->width, param->depth, param->nppn, param->nppcu); + nam_arch[param->arch], param->width, + param->depth, param->nppn, param->nppcu); else _write_xml(fp, " <ReserveParam architecture=\"%s\" " "width=\"%ld\" depth=\"%ld\" nppn=\"%ld\"", diff --git a/src/plugins/select/linear/select_linear.c b/src/plugins/select/linear/select_linear.c index be2967feb658c42fbf9198847bb4e61d7c5dd72d..f494e1a5b378ab3651b008b124a7156ad2b7142b 100644 --- a/src/plugins/select/linear/select_linear.c +++ b/src/plugins/select/linear/select_linear.c @@ -543,7 +543,7 @@ static uint16_t _get_total_threads(int index) /* * _get_ntasks_per_core - Retrieve the value of ntasks_per_core from * the given job_details record. If it wasn't set, return 0xffff. - * Intended for use with the _adjust_cpus_nppcu function. + * Intended for use with the adjust_cpus_nppcu function. */ static uint16_t _get_ntasks_per_core(struct job_details *details) { @@ -619,7 +619,9 @@ static void _build_select_struct(struct job_record *job_ptr, bitstr_t *bitmap) node_threads = node_ptr->threads; } - node_cpus = _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), node_threads, node_cpus); + node_cpus = adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + node_threads, node_cpus); job_resrcs_ptr->cpus[j] = node_cpus; if ((k == -1) || (job_resrcs_ptr->cpu_array_value[k] != node_cpus)) { @@ -891,7 +893,10 @@ static int _job_test(struct job_record *job_ptr, bitstr_t *bitmap, rem_nodes--; max_nodes--; rem_cpus -= avail_cpus; - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(index), _get_total_cpus(index)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(index), + _get_total_cpus(index)); } else { /* node not required (yet) */ bit_clear(bitmap, index); consec_cpus[consec_index] += avail_cpus; @@ -1018,7 +1023,10 @@ static int _job_test(struct job_record *job_ptr, bitstr_t *bitmap, max_nodes--; avail_cpus = _get_avail_cpus(job_ptr, i); rem_cpus -= avail_cpus; - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); } for (i = (best_fit_req - 1); i >= consec_start[best_fit_location]; i--) { @@ -1032,7 +1040,10 @@ static int _job_test(struct job_record *job_ptr, bitstr_t *bitmap, max_nodes--; avail_cpus = _get_avail_cpus(job_ptr, i); rem_cpus -= avail_cpus; - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); } } else { for (i = consec_start[best_fit_location]; @@ -1047,7 +1058,10 @@ static int _job_test(struct job_record *job_ptr, bitstr_t *bitmap, max_nodes--; avail_cpus = _get_avail_cpus(job_ptr, i); rem_cpus -= avail_cpus; - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); } } if (job_ptr->details->contiguous || @@ -1273,7 +1287,10 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap, bit_set(bitmap, i); alloc_nodes++; rem_cpus -= avail_cpus; - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); } } /* Accumulate additional resources from leafs that @@ -1308,7 +1325,10 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap, bit_set(bitmap, i); alloc_nodes++; rem_cpus -= _get_avail_cpus(job_ptr, i); - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); if ((alloc_nodes > max_nodes) || ((alloc_nodes >= want_nodes) && (rem_cpus <= 0))) @@ -1378,7 +1398,10 @@ static int _job_test_topo(struct job_record *job_ptr, bitstr_t *bitmap, bit_set(bitmap, i); alloc_nodes++; rem_cpus -= _get_avail_cpus(job_ptr, i); - total_cpus += _adjust_cpus_nppcu(_get_ntasks_per_core(job_ptr->details), _get_total_threads(i), _get_total_cpus(i)); + total_cpus += adjust_cpus_nppcu( + _get_ntasks_per_core(job_ptr->details), + _get_total_threads(i), + _get_total_cpus(i)); if ((alloc_nodes > max_nodes) || ((alloc_nodes >= want_nodes) && (rem_cpus <= 0))) break; diff --git a/src/slurmctld/node_scheduler.c b/src/slurmctld/node_scheduler.c index 120b4235e8232ee9cdd0a77d6fd5f1ed3b8ee5b7..e31416e700acd006c7f2c8831fd402834b2a8dc0 100644 --- a/src/slurmctld/node_scheduler.c +++ b/src/slurmctld/node_scheduler.c @@ -133,7 +133,7 @@ static int _fill_in_gres_fields(struct job_record *job_ptr); /* * _get_ntasks_per_core - Retrieve the value of ntasks_per_core from * the given job_details record. If it wasn't set, return 0xffff. - * Intended for use with the _adjust_cpus_nppcu function. + * Intended for use with the adjust_cpus_nppcu function. */ static uint16_t _get_ntasks_per_core(struct job_details *details) { uint16_t ntasks_per_core; @@ -2010,7 +2010,7 @@ static int _build_node_list(struct job_record *job_ptr, struct node_set **node_set_pptr, int *node_set_size) { - int i, node_set_inx, power_cnt, rc; + int adj_cpus, i, node_set_inx, power_cnt, rc; struct node_set *node_set_ptr; struct config_record *config_ptr; struct part_record *part_ptr = job_ptr->part_ptr; @@ -2087,9 +2087,11 @@ static int _build_node_list(struct job_record *job_ptr, while ((config_ptr = (struct config_record *) list_next(config_iterator))) { - config_filter = 0; - if ((detail_ptr->pn_min_cpus > _adjust_cpus_nppcu(_get_ntasks_per_core(detail_ptr), config_ptr->threads, config_ptr->cpus)) || + adj_cpus = adjust_cpus_nppcu(_get_ntasks_per_core(detail_ptr), + config_ptr->threads, + config_ptr->cpus); + if ((detail_ptr->pn_min_cpus > adj_cpus) || ((detail_ptr->pn_min_memory & (~MEM_PER_CPU)) > config_ptr->real_memory) || (detail_ptr->pn_min_tmp_disk > config_ptr->tmp_disk)) @@ -2239,7 +2241,7 @@ static int _build_node_list(struct job_record *job_ptr, static void _filter_nodes_in_set(struct node_set *node_set_ptr, struct job_details *job_con) { - int i; + int adj_cpus, i; multi_core_data_t *mc_ptr = job_con->mc_ptr; if (slurmctld_conf.fast_schedule) { /* test config records */ @@ -2248,9 +2250,11 @@ static void _filter_nodes_in_set(struct node_set *node_set_ptr, int job_ok = 0, job_mc_ptr_ok = 0; if (bit_test(node_set_ptr->my_bitmap, i) == 0) continue; - node_con = node_record_table_ptr[i].config_ptr; - if ((job_con->pn_min_cpus <= _adjust_cpus_nppcu(_get_ntasks_per_core(job_con), node_con->threads, node_con->cpus)) && + adj_cpus = adjust_cpus_nppcu(_get_ntasks_per_core(job_con), + node_con->threads, + node_con->cpus); + if ((job_con->pn_min_cpus <= adj_cpus) && ((job_con->pn_min_memory & (~MEM_PER_CPU)) <= node_con->real_memory) && (job_con->pn_min_tmp_disk <= node_con->tmp_disk)) @@ -2279,9 +2283,12 @@ static void _filter_nodes_in_set(struct node_set *node_set_ptr, continue; node_ptr = &node_record_table_ptr[i]; - if ((job_con->pn_min_cpus <= _adjust_cpus_nppcu(_get_ntasks_per_core(job_con), node_ptr->threads, node_ptr->cpus)) && + adj_cpus = adjust_cpus_nppcu(_get_ntasks_per_core(job_con), + node_ptr->threads, + node_ptr->cpus); + if ((job_con->pn_min_cpus <= adj_cpus) && ((job_con->pn_min_memory & (~MEM_PER_CPU)) <= - node_ptr->real_memory) && + node_ptr->real_memory) && (job_con->pn_min_tmp_disk <= node_ptr->tmp_disk)) job_ok = 1; if (mc_ptr &&