Skip to content

Commit 376d408

Browse files
author
Ralph Castain
committed
Fix the multiple pe/proc option
Things got a little out of whack and we weren't actually processing the map-by modifiers, plus an error crept into the display of the binding report. So clean those up. Thanks to @tonyreina for the error report Signed-off-by: Ralph Castain <[email protected]> (cherry picked from commit bcdb1f4)
1 parent 39f8903 commit 376d408

File tree

2 files changed

+45
-37
lines changed

2 files changed

+45
-37
lines changed

orte/mca/rmaps/base/rmaps_base_frame.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
1313
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
1414
* All rights reserved.
15-
* Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
15+
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
1616
* Copyright (c) 2014-2015 Research Organization for Information Science
1717
* and Technology (RIST). All rights reserved.
1818
* $COPYRIGHT$
@@ -603,7 +603,7 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
603603
char **device, char *inspec)
604604
{
605605
char *ck;
606-
char *ptr;
606+
char *ptr, *cptr;
607607
orte_mapping_policy_t tmp;
608608
int rc;
609609
size_t len;
@@ -667,20 +667,26 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
667667
return ORTE_ERR_SILENT;
668668
}
669669
ptr++; // move past the colon
670-
/* check the remaining string for modifiers - may be none, so
671-
* don't emit an error message if the modifier isn't recognized
672-
*/
673-
if (ORTE_ERR_SILENT == (rc = check_modifiers(ptr, &tmp)) &&
674-
ORTE_ERR_BAD_PARAM != rc) {
675-
free(spec);
676-
return ORTE_ERR_SILENT;
677-
}
678-
/* if we found something, then we need to adjust the string */
679-
if (ORTE_SUCCESS == rc) {
680-
ptr--;
681-
*ptr = '\0';
670+
/* at this point, ck is pointing to the number of procs/object
671+
* and ptr is pointing to the beginning of the string that describes
672+
* the object plus any modifiers. We first check to see if there
673+
* is a comma indicating that there are modifiers to the request */
674+
if (NULL != (cptr = strchr(ptr, ','))) {
675+
/* there are modifiers, so we terminate the object string
676+
* at the location of the first comma */
677+
*cptr = '\0';
678+
/* step over that comma */
679+
cptr++;
680+
/* now check for modifiers - may be none, so
681+
* don't emit an error message if the modifier
682+
* isn't recognized */
683+
if (ORTE_ERR_SILENT == (rc = check_modifiers(cptr, &tmp)) &&
684+
ORTE_ERR_BAD_PARAM != rc) {
685+
free(spec);
686+
return ORTE_ERR_SILENT;
687+
}
682688
}
683-
/* now get the pattern */
689+
/* now save the pattern */
684690
orte_rmaps_base.ppr = strdup(ck);
685691
ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR);
686692
ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN);

orte/runtime/data_type_support/orte_dt_print_fns.c

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
1515
* All rights reserved.
16-
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
16+
* Copyright (c) 2013-2018 Intel, Inc. All rights reserved.
1717
* $COPYRIGHT$
1818
*
1919
* Additional copyrights may follow
@@ -442,9 +442,12 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_
442442
*/
443443
int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_type_t type)
444444
{
445-
char *tmp, *tmp2, *pfx2;
446-
hwloc_obj_t loc=NULL, bd=NULL;
447-
char locale[1024], bind[1024];
445+
char *tmp, *tmp3, *pfx2;
446+
hwloc_obj_t loc=NULL;
447+
char locale[1024], tmp1[1024], tmp2[1024];
448+
hwloc_cpuset_t mycpus;
449+
char *str=NULL, *cpu_bitmap=NULL;
450+
448451

449452
/* set default result */
450453
*output = NULL;
@@ -470,10 +473,6 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_
470473
}
471474

472475
if (!orte_devel_level_output) {
473-
hwloc_cpuset_t mycpus;
474-
char tmp1[1024], tmp2[1024];
475-
char *str=NULL, *cpu_bitmap=NULL;
476-
477476
if (orte_get_attribute(&src->attributes, ORTE_PROC_CPU_BITMAP, (void**)&cpu_bitmap, OPAL_STRING) &&
478477
NULL != src->node->topology && NULL != src->node->topology->topo) {
479478
mycpus = hwloc_bitmap_alloc();
@@ -509,10 +508,10 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_
509508

510509
asprintf(&tmp, "\n%sData for proc: %s", pfx2, ORTE_NAME_PRINT(&src->name));
511510

512-
asprintf(&tmp2, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu\tApp rank: %d", tmp, pfx2,
511+
asprintf(&tmp3, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu\tApp rank: %d", tmp, pfx2,
513512
(long)src->pid, (unsigned long)src->local_rank, (unsigned long)src->node_rank, src->app_rank);
514513
free(tmp);
515-
tmp = tmp2;
514+
tmp = tmp3;
516515

517516
if (orte_get_attribute(&src->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&loc, OPAL_PTR)) {
518517
if (NULL != loc) {
@@ -525,23 +524,26 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_
525524
} else {
526525
strcpy(locale, "UNKNOWN");
527526
}
528-
if (orte_get_attribute(&src->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) {
529-
if (NULL != bd) {
530-
if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(bind, sizeof(bind), src->node->topology->topo, bd->cpuset)) {
531-
strcpy(bind, "UNBOUND");
532-
}
533-
} else {
534-
strcpy(bind, "UNBOUND");
535-
}
527+
if (orte_get_attribute(&src->attributes, ORTE_PROC_CPU_BITMAP, (void**)&cpu_bitmap, OPAL_STRING) &&
528+
NULL != src->node->topology && NULL != src->node->topology->topo) {
529+
mycpus = hwloc_bitmap_alloc();
530+
hwloc_bitmap_list_sscanf(mycpus, cpu_bitmap);
531+
opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), src->node->topology->topo, mycpus);
536532
} else {
537-
strcpy(bind, "UNBOUND");
533+
snprintf(tmp2, sizeof(tmp2), "UNBOUND");
538534
}
539-
asprintf(&tmp2, "%s\n%s\tState: %s\tApp_context: %ld\n%s\tLocale: %s\n%s\tBinding: %s", tmp, pfx2,
540-
orte_proc_state_to_str(src->state), (long)src->app_idx, pfx2, locale, pfx2, bind);
535+
asprintf(&tmp3, "%s\n%s\tState: %s\tApp_context: %ld\n%s\tLocale: %s\n%s\tBinding: %s", tmp, pfx2,
536+
orte_proc_state_to_str(src->state), (long)src->app_idx, pfx2, locale, pfx2, tmp2);
541537
free(tmp);
538+
if (NULL != str) {
539+
free(str);
540+
}
541+
if (NULL != cpu_bitmap) {
542+
free(cpu_bitmap);
543+
}
542544

543545
/* set the return */
544-
*output = tmp2;
546+
*output = tmp3;
545547

546548
free(pfx2);
547549
return ORTE_SUCCESS;

0 commit comments

Comments
 (0)