1
1

Cleanup report-bindings so it always reports the actual binding instead of what was requested. Ensure we don't report twice if it is an MPI process being launched.

This commit was SVN r28057.
Этот коммит содержится в:
Ralph Castain 2013-02-14 17:24:28 +00:00
родитель bbddd6ea03
Коммит b9897267ef
2 изменённых файлов: 29 добавлений и 18 удалений

Просмотреть файл

@ -261,22 +261,22 @@ int orte_ess_base_proc_binding(void)
opal_hwloc_base_get_local_cpuset(); opal_hwloc_base_get_local_cpuset();
/* report bindings, if requested */ /* report bindings, if requested */
if (opal_hwloc_report_bindings) { if (opal_hwloc_report_bindings) {
char bindings[64]; char tmp1[1024], tmp2[1024];
hwloc_obj_t root; hwloc_cpuset_t mycpus;
hwloc_cpuset_t cpus; /* get the cpus we are bound to */
/* get the root object for this node */ mycpus = hwloc_bitmap_alloc();
root = hwloc_get_root_obj(opal_hwloc_topology); if (hwloc_get_cpubind(opal_hwloc_topology,
cpus = opal_hwloc_base_get_available_cpus(opal_hwloc_topology, root); mycpus,
/* we are not bound if this equals our cpuset */ HWLOC_CPUBIND_PROCESS) < 0) {
if (0 == hwloc_bitmap_compare(cpus, opal_hwloc_my_cpuset)) { opal_output(0, "MCW rank %d is not bound",
opal_output(0, "%s is not bound", ORTE_PROC_MY_NAME->vpid);
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
} else { } else {
hwloc_bitmap_list_snprintf(bindings, 64, opal_hwloc_my_cpuset); opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), mycpus);
opal_output(0, "%s is bound to cpus %s", opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), mycpus);
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), opal_output(0, "MCW rank %d bound to %s: %s",
bindings); ORTE_PROC_MY_NAME->vpid, tmp1, tmp2);
} }
hwloc_bitmap_free(mycpus);
} }
return ORTE_SUCCESS; return ORTE_SUCCESS;

Просмотреть файл

@ -497,14 +497,25 @@ static int do_child(orte_app_context_t* context,
} }
if (0 == rc && opal_hwloc_report_bindings) { if (0 == rc && opal_hwloc_report_bindings) {
char tmp1[1024], tmp2[1024]; char tmp1[1024], tmp2[1024];
if (NULL == cpuset) { hwloc_cpuset_t mycpus;
opal_output(0, "Cannot print NULL cpuset"); /* 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 { } else {
opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), cpuset); opal_hwloc_base_cset2str(tmp1, sizeof(tmp1), mycpus);
opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), cpuset); opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), mycpus);
opal_output(0, "MCW rank %d bound to %s: %s", opal_output(0, "MCW rank %d bound to %s: %s",
child->name.vpid, tmp1, tmp2); 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 */ /* set memory affinity policy */
if (ORTE_SUCCESS != opal_hwloc_base_set_process_membind_policy()) { if (ORTE_SUCCESS != opal_hwloc_base_set_process_membind_policy()) {