Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly compute number of procs when not given #2085

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions src/mca/rmaps/base/rmaps_base_map_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,15 +490,27 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata)
app->num_procs = PMIX_ARGV_COUNT_COMPAT(ck);
PMIX_ARGV_FREE_COMPAT(ck);
} else {
/* set the num_procs to equal the number of slots on these
* mapped nodes, taking into account the number of cpus/rank
*/
app->num_procs = slots / options.cpus_per_rank;
/* sometimes, we have only one "slot" assigned, but may
* want more than one cpu/rank - so ensure we always wind
* up with at least one proc */
if (0 == app->num_procs) {
app->num_procs = 1;
if (1 < options.cpus_per_rank) {
// compute the number of cpus on each node
len = 0;
PMIX_LIST_FOREACH (node, &nodes, prte_node_t) {
if (options.use_hwthreads) {
len += prte_hwloc_base_get_nbobjs_by_type(node->topology->topo,
HWLOC_OBJ_PU) / options.cpus_per_rank;
} else {
len += prte_hwloc_base_get_nbobjs_by_type(node->topology->topo,
HWLOC_OBJ_CORE) / options.cpus_per_rank;
}
}
app->num_procs = len;
// ensure we always wind up with at least one proc
if (0 == app->num_procs) {
app->num_procs = 1;
} else if (slots < app->num_procs) {
app->num_procs = slots;
}
} else {
app->num_procs = slots;
}
}
}
Expand Down
Loading