Skip to content

Commit 9bc5ca5

Browse files
Gerardo Garciahppritcha
authored andcommitted
modified mpirun to longer fork/exec prterun but now to instead call the function directly in the process
Note this commit will need to be adjusted to reset .gitmodules before merging into Open MPI main Signed-off-by: Gerardo Garcia <[email protected]> Signed-off-by: Howard Pritchard <[email protected]>
1 parent a26f28a commit 9bc5ca5

File tree

6 files changed

+23
-79
lines changed

6 files changed

+23
-79
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "prrte"]
22
path = 3rd-party/prrte
33
url = ../../open-mpi/prrte
4-
branch = master
4+
branch = ompi-main
55
[submodule "openpmix"]
66
path = 3rd-party/openpmix
77
url = ../../openpmix/openpmix.git

3rd-party/prrte

Submodule prrte updated 193 files

ompi/dpm/dpm.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,10 @@ static char *find_prte(void)
19751975
#if OMPI_USING_INTERNAL_PRRTE
19761976
/* 2) If using internal PRRTE, use our bindir. Note that this
19771977
* will obey OPAL_PREFIX and OPAL_DESTDIR */
1978-
opal_asprintf(&filename, "%s%sprte", opal_install_dirs.bindir, OPAL_PATH_SEP);
1978+
/*
1979+
* TODO: HPP replace hard-wired prrte prefix with something configurable
1980+
*/
1981+
opal_asprintf(&filename, "%s%sompi-prte", opal_install_dirs.bindir, OPAL_PATH_SEP);
19791982
return filename;
19801983
#else
19811984

ompi/tools/mpirun/Makefile.am

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ EXTRA_DIST = help-mpirun.txt
2121
mpirun_SOURCES = \
2222
main.c
2323

24+
#
25+
# TODO: HPP replace hard-wired prrte prefix with something configurable
26+
#
2427
mpirun_LDADD = \
25-
$(top_builddir)/opal/libopen-pal_core.la
28+
$(top_builddir)/opal/libopen-pal_core.la \
29+
$(top_builddir)/3rd-party/prrte/src/libompi-prrte.la
2630

2731
mpirun_CPPFLAGS = \
2832
-DMCA_oshmem_FRAMEWORKS="\"$(MCA_oshmem_FRAMEWORKS)\"" \

ompi/tools/mpirun/help-mpirun.txt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
# This is the US/English help file for Open MPI wrapper compiler error
1111
# messages.
1212
#
13-
[no-prterun-found]
14-
Open MPI's mpirun command was unable to find an underlying prterun
15-
command to execute. Consider setting the OMPI_PRTERUN environment
16-
variable to help mpirun find the correct underlying prterun.
17-
[prterun-exec-failed]
18-
Open MPI's mpirun command could not execute the underlying prterun
19-
command. The prterun command we tried to execute and the error
20-
message from exec() are below:
13+
[prte-launch-failed]
14+
Open MPI's mpirun command was unable to launch the user's application.
15+
This may indicate an issue with the environment or incorrect configuration.
2116

22-
Command: %s
23-
Error Message: %s
17+
Error Message: %s

ompi/tools/mpirun/main.c

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -28,46 +28,8 @@
2828
#include "opal/util/printf.h"
2929
#include "opal/util/show_help.h"
3030
#include "ompi/constants.h"
31+
#include "3rd-party/prrte/include/prte.h"
3132

32-
static char *find_prterun(void)
33-
{
34-
char *filename = NULL;
35-
#if !OMPI_USING_INTERNAL_PRRTE
36-
char *prrte_prefix = NULL;
37-
#endif
38-
39-
/* 1) Did the user tell us exactly where to find prterun? */
40-
filename = getenv("OMPI_PRTERUN");
41-
if (NULL != filename) {
42-
return filename;
43-
}
44-
45-
#if OMPI_USING_INTERNAL_PRRTE
46-
/* 2) If using internal PRRTE, use our bindir. Note that this
47-
* will obey OPAL_PREFIX and OPAL_DESTDIR */
48-
opal_asprintf(&filename, "%s%sprterun", opal_install_dirs.bindir, OPAL_PATH_SEP);
49-
return filename;
50-
#else
51-
52-
/* 3) Look in ${PRTE_PREFIX}/bin */
53-
prrte_prefix = getenv("PRTE_PREFIX");
54-
if (NULL != prrte_prefix) {
55-
opal_asprintf(&filename, "%s%sbin%sprterun", prrte_prefix, OPAL_PATH_SEP, OPAL_PATH_SEP);
56-
return filename;
57-
}
58-
59-
/* 4) See if configure told us where to look, if set */
60-
#if defined(OMPI_PRTERUN_PATH)
61-
return strdup(OMPI_PRTERUN_PATH);
62-
#else
63-
64-
/* 5) Use path search */
65-
filename = opal_find_absolute_path("prterun");
66-
67-
return filename;
68-
#endif
69-
#endif
70-
}
7133

7234
static void append_prefixes(char ***out, const char *in)
7335
{
@@ -119,10 +81,7 @@ static void setup_mca_prefixes(void)
11981
int main(int argc, char *argv[])
12082
{
12183
char *opal_prefix = getenv("OPAL_PREFIX");
122-
char *full_prterun_path = NULL;
123-
char **prterun_args = NULL;
12484
int ret;
125-
size_t i;
12685

12786
ret = opal_init_util(&argc, &argv);
12887
if (OMPI_SUCCESS != ret) {
@@ -154,12 +113,6 @@ int main(int argc, char *argv[])
154113
#endif
155114
}
156115

157-
full_prterun_path = find_prterun();
158-
if (NULL == full_prterun_path) {
159-
opal_show_help("help-mpirun.txt", "no-prterun-found", 1);
160-
exit(1);
161-
}
162-
163116
/*
164117
* set environment variable for our install location
165118
* used within the OMPI prrte schizo component
@@ -171,24 +124,14 @@ int main(int argc, char *argv[])
171124
// to Open MPI.
172125
setup_mca_prefixes();
173126

174-
/* calling mpirun (and now prterun) with a full path has a special
175-
* meaning in terms of -prefix behavior, so copy that behavior
176-
* into prterun */
177-
if (opal_path_is_absolute(argv[0])) {
178-
opal_argv_append_nosize(&prterun_args, full_prterun_path);
179-
} else {
180-
opal_argv_append_nosize(&prterun_args, "prterun");
127+
128+
ret = prte_launch(argc, argv);
129+
if (OMPI_SUCCESS != ret) {
130+
opal_show_help("help-mpirun.txt", "prte-launch-failed", 1, strerror(errno));
131+
exit(1);
181132
}
182133

183-
/* Copy all the mpirun arguments to prterun.
184-
* TODO: Need to handle --prefix rationally here. */
185-
for (i = 1; NULL != argv[i]; i++) {
186-
opal_argv_append_nosize(&prterun_args, argv[i]);
187-
}
188-
ret = execv(full_prterun_path, prterun_args);
189-
opal_show_help("help-mpirun.txt", "prterun-exec-failed",
190-
1, full_prterun_path, strerror(errno));
191-
exit(1);
134+
return 0;
192135
}
193136

194137
/*
@@ -214,4 +157,4 @@ int main(int argc, char *argv[])
214157
* Additional copyrights may follow
215158
*
216159
* $HEADER$
217-
*/
160+
*/

0 commit comments

Comments
 (0)