Skip to content

Commit fcefa44

Browse files
author
Ralph Castain
authored
Merge pull request #5483 from rhc54/topic/maps
Fix the map-by modifier parsing
2 parents 99ad8d4 + bcdb1f4 commit fcefa44

File tree

5 files changed

+70
-39
lines changed

5 files changed

+70
-39
lines changed

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,29 @@ ompi/mpiext/cuda/c/MPIX_Query_cuda_support.3
251251
ompi/mpiext/cuda/c/mpiext_cuda_c.h
252252

253253
ompi/mpiext/pcollreq/c/MPIX_*.3
254+
ompi/mpiext/pcollreq/c/profile/pallgather_init.c
255+
ompi/mpiext/pcollreq/c/profile/pallgatherv_init.c
256+
ompi/mpiext/pcollreq/c/profile/pallreduce_init.c
257+
ompi/mpiext/pcollreq/c/profile/palltoall_init.c
258+
ompi/mpiext/pcollreq/c/profile/palltoallv_init.c
259+
ompi/mpiext/pcollreq/c/profile/palltoallw_init.c
260+
ompi/mpiext/pcollreq/c/profile/pbarrier_init.c
261+
ompi/mpiext/pcollreq/c/profile/pbcast_init.c
262+
ompi/mpiext/pcollreq/c/profile/pexscan_init.c
263+
ompi/mpiext/pcollreq/c/profile/pgather_init.c
264+
ompi/mpiext/pcollreq/c/profile/pgatherv_init.c
265+
ompi/mpiext/pcollreq/c/profile/pmpiext_pcollreq_c.h
266+
ompi/mpiext/pcollreq/c/profile/pneighbor_allgather_init.c
267+
ompi/mpiext/pcollreq/c/profile/pneighbor_allgatherv_init.c
268+
ompi/mpiext/pcollreq/c/profile/pneighbor_alltoall_init.c
269+
ompi/mpiext/pcollreq/c/profile/pneighbor_alltoallv_init.c
270+
ompi/mpiext/pcollreq/c/profile/pneighbor_alltoallw_init.c
271+
ompi/mpiext/pcollreq/c/profile/preduce_init.c
272+
ompi/mpiext/pcollreq/c/profile/preduce_scatter_block_init.c
273+
ompi/mpiext/pcollreq/c/profile/preduce_scatter_init.c
274+
ompi/mpiext/pcollreq/c/profile/pscan_init.c
275+
ompi/mpiext/pcollreq/c/profile/pscatter_init.c
276+
ompi/mpiext/pcollreq/c/profile/pscatterv_init.c
254277

255278
ompi/tools/mpisync/mpisync
256279
ompi/tools/mpisync/mpirun_prof

opal/mca/pmix/ext2x/ext2x_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ static int external_open(void)
118118
OBJ_CONSTRUCT(&mca_pmix_ext2x_component.dmdx, opal_list_t);
119119

120120
version = PMIx_Get_version();
121-
if ('2' != version[0]) {
121+
if ('2' >= version[0]) {
122122
opal_show_help("help-pmix-base.txt",
123123
"incorrect-pmix", true, version, "v2.x");
124124
return OPAL_ERROR;
125125
}
126-
if (0 == strncmp(version, "2.1", 3)) {
126+
if (0 != strncmp(version, "2.0", 3)) {
127127
mca_pmix_ext2x_component.legacy_get = false;
128128
}
129129

opal/mca/pmix/pmix3x/pmix3x_component.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static int external_open(void)
118118
OBJ_CONSTRUCT(&mca_pmix_pmix3x_component.dmdx, opal_list_t);
119119

120120
version = PMIx_Get_version();
121-
if ('3' != version[0]) {
121+
if ('3' > version[0]) {
122122
opal_show_help("help-pmix-base.txt",
123123
"incorrect-pmix", true, version, "v3.x");
124124
return OPAL_ERROR;

orte/mca/rmaps/base/rmaps_base_frame.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
597597
char **device, char *inspec)
598598
{
599599
char *ck;
600-
char *ptr;
600+
char *ptr, *cptr;
601601
orte_mapping_policy_t tmp;
602602
int rc;
603603
size_t len;
@@ -661,20 +661,26 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy,
661661
return ORTE_ERR_SILENT;
662662
}
663663
ptr++; // move past the colon
664-
/* check the remaining string for modifiers - may be none, so
665-
* don't emit an error message if the modifier isn't recognized
666-
*/
667-
if (ORTE_ERR_SILENT == (rc = check_modifiers(ptr, &tmp)) &&
668-
ORTE_ERR_BAD_PARAM != rc) {
669-
free(spec);
670-
return ORTE_ERR_SILENT;
671-
}
672-
/* if we found something, then we need to adjust the string */
673-
if (ORTE_SUCCESS == rc) {
674-
ptr--;
675-
*ptr = '\0';
664+
/* at this point, ck is pointing to the number of procs/object
665+
* and ptr is pointing to the beginning of the string that describes
666+
* the object plus any modifiers. We first check to see if there
667+
* is a comma indicating that there are modifiers to the request */
668+
if (NULL != (cptr = strchr(ptr, ','))) {
669+
/* there are modifiers, so we terminate the object string
670+
* at the location of the first comma */
671+
*cptr = '\0';
672+
/* step over that comma */
673+
cptr++;
674+
/* now check for modifiers - may be none, so
675+
* don't emit an error message if the modifier
676+
* isn't recognized */
677+
if (ORTE_ERR_SILENT == (rc = check_modifiers(cptr, &tmp)) &&
678+
ORTE_ERR_BAD_PARAM != rc) {
679+
free(spec);
680+
return ORTE_ERR_SILENT;
681+
}
676682
}
677-
/* now get the pattern */
683+
/* now save the pattern */
678684
orte_rmaps_base.ppr = strdup(ck);
679685
ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR);
680686
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)