2828#include "opal/util/printf.h"
2929#include "opal/util/show_help.h"
3030#include "ompi/constants.h"
31-
32- static char * find_prterun (void )
33- {
34- char * filename = NULL ;
35- #if !OMPI_USING_INTERNAL_PRRTE
36- char * prrte_prefix = NULL ;
31+ #if OMPI_HAVE_PRTE_LAUNCH
32+ #include "prte.h"
3733#endif
3834
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- }
7135
7236static void append_prefixes (char * * * out , const char * in )
7337{
@@ -115,6 +79,35 @@ static void setup_mca_prefixes(void)
11579 opal_argv_free (tmp );
11680}
11781
82+ static char * find_prterun (void )
83+ {
84+ char * filename = NULL ;
85+ char * prrte_prefix = NULL ;
86+
87+ /* 1) Did the user tell us exactly where to find prterun? */
88+ filename = getenv ("OMPI_PRTERUN" );
89+ if (NULL != filename ) {
90+ return filename ;
91+ }
92+
93+ /* 2) Look in ${PRTE_PREFIX}/bin */
94+ prrte_prefix = getenv ("PRTE_PREFIX" );
95+ if (NULL != prrte_prefix ) {
96+ opal_asprintf (& filename , "%s%sbin%sprterun" , prrte_prefix , OPAL_PATH_SEP , OPAL_PATH_SEP );
97+ return filename ;
98+ }
99+
100+ /* 4) See if configure told us where to look, if set */
101+ #if defined(OMPI_PRTERUN_PATH )
102+ return strdup (OMPI_PRTERUN_PATH );
103+ #else
104+
105+ /* 5) Use path search */
106+ filename = opal_find_absolute_path ("prterun" );
107+
108+ return filename ;
109+ #endif
110+ }
118111
119112int main (int argc , char * argv [])
120113{
@@ -154,23 +147,33 @@ int main(int argc, char *argv[])
154147#endif
155148 }
156149
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-
163150 /*
164151 * set environment variable for our install location
165152 * used within the OMPI prrte schizo component
166153 */
167-
168154 setenv ("OMPI_LIBDIR_LOC" , opal_install_dirs .libdir , 1 );
169155
170156 // Set environment variable to tell PRTE what MCA prefixes belong
171157 // to Open MPI.
172158 setup_mca_prefixes ();
173159
160+ #if OMPI_HAVE_PRTE_LAUNCH
161+
162+ ret = prte_launch (argc , argv );
163+ if (OMPI_SUCCESS != ret ) {
164+ opal_show_help ("help-mpirun.txt" , "prte-launch-failed" , 1 , strerror (errno ));
165+ exit (1 );
166+ }
167+
168+ return 0 ;
169+ #else
170+
171+ full_prterun_path = find_prterun ();
172+ if (NULL == full_prterun_path ) {
173+ opal_show_help ("help-mpirun.txt" , "no-prterun-found" , 1 );
174+ exit (1 );
175+ }
176+
174177 /* calling mpirun (and now prterun) with a full path has a special
175178 * meaning in terms of -prefix behavior, so copy that behavior
176179 * into prterun */
@@ -188,10 +191,10 @@ int main(int argc, char *argv[])
188191 ret = execv (full_prterun_path , prterun_args );
189192 opal_show_help ("help-mpirun.txt" , "prterun-exec-failed" ,
190193 1 , full_prterun_path , strerror (errno ));
191- exit (1 );
192- }
193-
194- /*
194+ exit (1 );
195+ #endif /* OMPI_HAVE_PRTE_LAUNCH*/
196+ }
197+ /*
195198 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
196199 * University Research and Technology
197200 * Corporation. All rights reserved.
@@ -206,9 +209,9 @@ int main(int argc, char *argv[])
206209 * Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved
207210 * Copyright (c) 2021 Nanook Consulting. All rights reserved.
208211 * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
209- * Copyright (c) 2022 Triad National Security, LLC. All rights
212+ * Copyright (c) 2022-2025 Triad National Security, LLC. All rights
210213 * reserved.
211-
214+
212215 * $COPYRIGHT$
213216 *
214217 * Additional copyrights may follow
0 commit comments