Skip to content

Commit 02020f3

Browse files
authored
Merge pull request open-mpi#9963 from awlauria/fix_mpirun_external_2
external prrte: Compile mpirun with PRTE_PATH to find prterun.
2 parents 43524c4 + 66c7664 commit 02020f3

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

config/ompi_setup_prrte.m4

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ AC_DEFUN([OMPI_SETUP_PRRTE],[
9999
[$OMPI_HAVE_PRRTE],
100100
[Whether or not PRRTE is available])
101101
102+
AS_IF([test "$opal_prrte_mode" = "external"],
103+
[AC_DEFINE_UNQUOTED([OMPI_PRTERUN_PATH],
104+
["$PRTE_PATH"],
105+
[Path to prterun])])
106+
102107
AC_DEFINE_UNQUOTED([OMPI_USING_INTERNAL_PRRTE],
103108
[$OMPI_USING_INTERNAL_PRRTE],
104109
[Whether or not we are using the internal PRRTE])
@@ -268,13 +273,15 @@ AC_DEFUN([_OMPI_SETUP_PRRTE_EXTERNAL], [
268273
AS_IF([test "$setup_prrte_external_happy" = "yes"],
269274
[AS_IF([test -n "$with_prrte"],
270275
[PRTE_PATH="${with_prrte}/bin/prte"
271-
AS_IF([test ! -r ${PRTE_PATH}], [AC_MSG_ERROR([Could not find prte binary at $PRTE_PATH])])],
276+
AS_IF([test ! -r ${PRTE_PATH}],
277+
[AC_MSG_ERROR([Could not find prte binary at $PRTE_PATH])],
278+
[PRTE_PATH="${with_prrte}/bin"])],
272279
[PRTE_PATH=""
273280
OPAL_WHICH([prte], [PRTE_PATH])
274281
AS_IF([tets -z "$PRTE_PATH"],
275282
[AC_MSG_WARN([Could not find prte in PATH])
276-
setup_prrte_external_happy=no])])])
277-
283+
setup_prrte_external_happy=no],
284+
[PRTE_PATH="`echo $PRTE_PATH | sed -e 's/\/prte//'`"])])])
278285
AS_IF([test "$setup_prrte_external_happy" = "yes"],
279286
[$1], [$2])
280287

ompi/tools/mpirun/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
3434
char **pargs = NULL;
3535
char *pfx = NULL;
3636
int m, param_len;
37-
char *truepath;
37+
char *truepath = NULL;
3838

3939
if (NULL != (evar = getenv("OPAL_PREFIX"))) {
4040

@@ -87,6 +87,14 @@ int main(int argc, char *argv[])
8787

8888
if (NULL == pfx) {
8989
truepath = opal_path_findv("prterun", X_OK, environ, NULL);
90+
#if !OMPI_USING_INTERNAL_PRRTE
91+
// if OMPI_PRTERUN_PATH is available, try that
92+
// for external builds if the user didn't explictly
93+
// add a prefix and it isn't in the users path.
94+
if((NULL == truepath) && (0 != strlen(OMPI_PRTERUN_PATH))) {
95+
truepath = opal_os_path(0, OMPI_PRTERUN_PATH, "prterun", NULL);
96+
}
97+
#endif
9098
} else {
9199
truepath = opal_os_path(0, pfx, "prterun", NULL);
92100
free(pfx);

0 commit comments

Comments
 (0)