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
7234static void append_prefixes (char * * * out , const char * in )
7335{
@@ -119,10 +81,7 @@ static void setup_mca_prefixes(void)
11981int 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