diff --git a/orte/mca/ess/base/ess_base_fns.c b/orte/mca/ess/base/ess_base_fns.c index 046d790300..6c6740b9c3 100644 --- a/orte/mca/ess/base/ess_base_fns.c +++ b/orte/mca/ess/base/ess_base_fns.c @@ -261,22 +261,22 @@ int orte_ess_base_proc_binding(void) opal_hwloc_base_get_local_cpuset(); /* report bindings, if requested */ if (opal_hwloc_report_bindings) { - char bindings[64]; - hwloc_obj_t root; - hwloc_cpuset_t cpus; - /* get the root object for this node */ - root = hwloc_get_root_obj(opal_hwloc_topology); - cpus = opal_hwloc_base_get_available_cpus(opal_hwloc_topology, root); - /* we are not bound if this equals our cpuset */ - if (0 == hwloc_bitmap_compare(cpus, opal_hwloc_my_cpuset)) { - opal_output(0, "%s is not bound", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); + char tmp1[1024], tmp2[1024]; + hwloc_cpuset_t mycpus; + /* get the cpus we are bound to */ + mycpus = hwloc_bitmap_alloc(); + if (hwloc_get_cpubind(opal_hwloc_topology, + mycpus, + HWLOC_CPUBIND_PROCESS) < 0) { + opal_output(0, "MCW rank %d is not bound", + ORTE_PROC_MY_NAME->vpid); } else { - hwloc_bitmap_list_snprintf(bindings, 64, opal_hwloc_my_cpuset); - opal_output(0, "%s is bound to cpus %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - bindings); + opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), mycpus); + opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), mycpus); + opal_output(0, "MCW rank %d bound to %s: %s", + ORTE_PROC_MY_NAME->vpid, tmp1, tmp2); } + hwloc_bitmap_free(mycpus); } return ORTE_SUCCESS; diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index 19102883d0..b7c0bc582f 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -497,14 +497,25 @@ static int do_child(orte_app_context_t* context, } if (0 == rc && opal_hwloc_report_bindings) { char tmp1[1024], tmp2[1024]; - if (NULL == cpuset) { - opal_output(0, "Cannot print NULL cpuset"); + hwloc_cpuset_t mycpus; + /* get the cpus we are bound to */ + mycpus = hwloc_bitmap_alloc(); + if (hwloc_get_cpubind(opal_hwloc_topology, + mycpus, + HWLOC_CPUBIND_PROCESS) < 0) { + opal_output(0, "MCW rank %d is not bound", + child->name.vpid); } else { - opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), cpuset); - opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), cpuset); + opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), mycpus); + opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), mycpus); opal_output(0, "MCW rank %d bound to %s: %s", child->name.vpid, tmp1, tmp2); } + hwloc_bitmap_free(mycpus); + /* avoid reporting it twice */ + param = mca_base_param_env_var ("hwloc_base_report_bindings"); + opal_unsetenv(param, &environ_copy); + free(param); } /* set memory affinity policy */ if (ORTE_SUCCESS != opal_hwloc_base_set_process_membind_policy()) {