Skip to content

Commit 8cd7976

Browse files
authored
Merge pull request #8090 from rhc54/topic/pmix3
Add some protection against PMIx v4
2 parents 0bcef04 + 92d2842 commit 8cd7976

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

config/opal_config_pmix.m4

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dnl All rights reserved.
1313
dnl Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved.
1414
dnl Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
1515
dnl reserved.
16-
dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved.
16+
dnl Copyright (c) 2014-2020 Intel, Inc. All rights reserved.
1717
dnl Copyright (c) 2014-2018 Research Organization for Information Science
1818
dnl and Technology (RIST). All rights reserved.
1919
dnl Copyright (c) 2016 IBM Corporation. All rights reserved.
@@ -166,11 +166,11 @@ AC_DEFUN([_OPAL_CONFIG_PMIX_EXTERNAL], [
166166
LIBS="$opal_pmix_LIBS_save $opal_pmix_LIBS"
167167
168168
AS_IF([test "$opal_pmix_external_support" = "yes"],
169-
[AC_MSG_CHECKING([if external PMIx version is 3.0.0 or greater])
169+
[AC_MSG_CHECKING([if external PMIx version is 3.1.5 or greater])
170170
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <pmix_version.h>]],
171171
[[
172-
#if PMIX_VERSION_MAJOR < 3L
173-
#error "pmix API version is less than 3.0.0"
172+
#if PMIX_NUMERIC_VERSION < 0x00030105
173+
#error "pmix API version is less than 3.1.5"
174174
#endif
175175
]])],
176176
[AC_MSG_RESULT([yes])],

ompi/dpm/dpm.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,11 @@ static int dpm_convert(opal_list_t *infos,
696696
/* does it conflict? */
697697
if (0 != strncasecmp(ck, directive, strlen(directive))) {
698698
opal_asprintf(&help_str, "Conflicting directives \"%s %s\"", ck, directive);
699+
#if PMIX_NUMERIC_VERSION >= 0x00040000
699700
attr = PMIx_Get_attribute_string(option);
701+
#else
702+
attr = option;
703+
#endif
700704
opal_show_help("help-dpm.txt", "deprecated-fail", true,
701705
infokey, attr, help_str);
702706
free(help_str);
@@ -723,7 +727,11 @@ static int dpm_convert(opal_list_t *infos,
723727
if (OMPI_SUCCESS != rc) {
724728
/* we have a conflict */
725729
opal_asprintf(&ptr, " Option %s\n Conflicting modifiers \"%s %s\"", option, infokey, modifier);
730+
#if PMIX_NUMERIC_VERSION >= 0x00040000
726731
attr = PMIx_Get_attribute_string(option);
732+
#else
733+
attr = option;
734+
#endif
727735
opal_show_help("help-dpm.txt", "deprecated-fail", true,
728736
infokey, attr, ptr);
729737
free(ptr);
@@ -983,9 +991,9 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
983991

984992
/* non-standard keys
985993
* Keys that correspond to prun/mpiexec parameters
986-
* do not deprecate PMIX unprefixed forms to remain identical
994+
* do not deprecate PMIX unprefixed forms to remain identical
987995
* to the command line parameter;
988-
* Keys that are not corresponding to an mpiexec parameter are
996+
* Keys that are not corresponding to an mpiexec parameter are
989997
* deprecated in the non-prefixed form */
990998

991999
/* check for 'hostfile' */

ompi/runtime/ompi_rte.c

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -585,9 +585,11 @@ int ompi_rte_init(int *pargc, char ***pargv)
585585
/* just assume 0 */
586586
u16 = 0;
587587
} else {
588-
ret = opal_pmix_convert_status(rc);
589-
error = "node rank";
590-
goto error;
588+
/* we may be in an environment that doesn't quite adhere
589+
* to the Standard - we can safely assume it is the same
590+
* as the local rank as such environments probably aren't
591+
* going to care */
592+
u16 = opal_process_info.my_local_rank;
591593
}
592594
}
593595
opal_process_info.my_node_rank = u16;
@@ -668,6 +670,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
668670
}
669671
}
670672

673+
#ifdef PMIX_APP_ARGV
671674
/* get our command - defaults to our appnum */
672675
ev1 = NULL;
673676
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_APP_ARGV,
@@ -681,24 +684,28 @@ int ompi_rte_init(int *pargc, char ***pargv)
681684
opal_process_info.command = opal_argv_join(tmp, ' ');
682685
}
683686
}
687+
#else
688+
tmp = *pargv;
689+
if (NULL != tmp) {
690+
opal_process_info.command = opal_argv_join(tmp, ' ');
691+
}
692+
#endif
684693

694+
#ifdef PMIX_REINCARNATION
685695
/* get our reincarnation number */
686696
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_REINCARNATION,
687697
&OPAL_PROC_MY_NAME, &u32ptr, PMIX_UINT32);
688698
if (PMIX_SUCCESS == rc) {
689699
opal_process_info.reincarnation = u32;
690700
}
701+
#endif
691702

692703
/* get the number of local peers - required for wireup of
693704
* shared memory BTL, defaults to local node */
694705
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_LOCAL_SIZE,
695706
&pname, &u32ptr, PMIX_UINT32);
696707
if (PMIX_SUCCESS == rc) {
697708
opal_process_info.num_local_peers = u32 - 1; // want number besides ourselves
698-
} else {
699-
ret = opal_pmix_convert_status(rc);
700-
error = "local size";
701-
goto error;
702709
}
703710

704711
/* retrieve temp directories info */
@@ -768,28 +775,27 @@ int ompi_rte_init(int *pargc, char ***pargv)
768775
opal_process_info.proc_is_bound = false;
769776
}
770777

771-
/* get our local peers */
772-
if (0 < opal_process_info.num_local_peers) {
773-
/* if my local rank if too high, then that's an error */
774-
if (opal_process_info.num_local_peers < opal_process_info.my_local_rank) {
775-
ret = OPAL_ERR_BAD_PARAM;
776-
error = "num local peers";
777-
goto error;
778-
}
779-
/* retrieve the local peers - defaults to local node */
780-
val = NULL;
781-
OPAL_MODEX_RECV_VALUE(rc, PMIX_LOCAL_PEERS,
782-
&pname, &val, PMIX_STRING);
783-
if (PMIX_SUCCESS == rc && NULL != val) {
784-
peers = opal_argv_split(val, ',');
785-
free(val);
786-
} else {
787-
ret = opal_pmix_convert_status(rc);
788-
error = "local peers";
789-
goto error;
790-
}
778+
/* retrieve the local peers - defaults to local node */
779+
val = NULL;
780+
OPAL_MODEX_RECV_VALUE(rc, PMIX_LOCAL_PEERS,
781+
&pname, &val, PMIX_STRING);
782+
if (PMIX_SUCCESS == rc && NULL != val) {
783+
peers = opal_argv_split(val, ',');
784+
free(val);
791785
} else {
792-
peers = NULL;
786+
ret = opal_pmix_convert_status(rc);
787+
error = "local peers";
788+
goto error;
789+
}
790+
/* if we were unable to retrieve the #local peers, set it here */
791+
if (0 == opal_process_info.num_local_peers) {
792+
opal_process_info.num_local_peers = opal_argv_count(peers) - 1;
793+
}
794+
/* if my local rank if too high, then that's an error */
795+
if (opal_process_info.num_local_peers < opal_process_info.my_local_rank) {
796+
ret = OPAL_ERR_BAD_PARAM;
797+
error = "num local peers";
798+
goto error;
793799
}
794800

795801
/* set the locality */

0 commit comments

Comments
 (0)