Skip to content

Commit

Permalink
Protect against missing HWLOC object types
Browse files Browse the repository at this point in the history
If we are trying to bind to an HWLOC object type that is not
defined on a given node, then (a) if the binding policy was
specified by user, then error out; and (b) if we are using
a default binding policy, then simply do not bind.

Signed-off-by: Ralph Castain <[email protected]>
(cherry picked from commit 5d21059)
  • Loading branch information
rhc54 committed Jul 3, 2024
1 parent 55f6e2e commit a047eef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/mca/rmaps/base/rmaps_base_binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc,

nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, options->hwb);

// check for target object existence
if (0 == nobjs) {
// if this is not a default binding policy, then error out
if (PRTE_BINDING_POLICY_IS_SET(jdata->map->binding)) {
pmix_show_help("help-prte-rmaps-base.txt", "rmaps:binding-target-not-found",
true, prte_hwloc_base_print_binding(jdata->map->binding), node->name);
return PRTE_ERR_SILENT;
}
// fallback to not binding
return PRTE_SUCCESS;
}

for (n=0; n < nobjs; n++) {
tmp_obj = hwloc_get_obj_by_type(node->topology->topo, options->hwb, n);
#if HWLOC_API_VERSION < 0x20000
Expand Down Expand Up @@ -129,6 +141,9 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc,
#else
tgtcpus = trg_obj->cpuset;
#endif
if (NULL == tgtcpus) {
return PRTE_ERROR;
}
hwloc_bitmap_list_asprintf(&proc->cpuset, tgtcpus); // bind to the entire target object
if (4 < pmix_output_get_verbosity(prte_rmaps_base_framework.framework_output)) {
char *tmp1;
Expand Down

0 comments on commit a047eef

Please sign in to comment.