2828#include "opal/util/printf.h"
2929#include "opal/util/show_help.h"
3030#include "ompi/constants.h"
31- #if OMPI_USING_INTERNAL_PRRTE
32- #include "3rd-party/prrte/include/ prte.h"
31+ #if OMPI_HAVE_PRTE_LAUNCH
32+ #include "prte.h"
3333#endif
3434
3535
@@ -79,69 +79,6 @@ static void setup_mca_prefixes(void)
7979 opal_argv_free (tmp );
8080}
8181
82-
83- #if OMPI_HAVE_PRTE_LAUNCH
84-
85- /* we can use prte_launch */
86-
87- int main (int argc , char * argv [])
88- {
89- char * opal_prefix = getenv ("OPAL_PREFIX" );
90- int ret ;
91-
92- ret = opal_init_util (& argc , & argv );
93- if (OMPI_SUCCESS != ret ) {
94- fprintf (stderr , "Failed initializing opal: %d\n" , ret );
95- exit (1 );
96- }
97-
98- /* note that we just modify our environment rather than create a
99- * child environment because it is easier and we're not going to
100- * be around long enough for it to matter (since we exec prterun
101- * asap */
102- setenv ("PRTE_MCA_schizo_proxy" , "ompi" , 1 );
103- setenv ("OMPI_VERSION" , OMPI_VERSION , 1 );
104- char * base_tool_name = opal_basename (argv [0 ]);
105- setenv ("OMPI_TOOL_NAME" , base_tool_name , 1 );
106- free (base_tool_name );
107-
108- /* TODO: look for --prefix and compare with OPAL_PREFIX and pick
109- * one */
110-
111- /* as a special case, if OPAL_PREFIX was set and either PRRTE or
112- * PMIx are internal builds, set their prefix variables as well */
113- if (NULL != opal_prefix ) {
114- #if OMPI_USING_INTERNAL_PRRTE
115- setenv ("PRTE_PREFIX" , opal_prefix , 1 );
116- #endif
117- #if OPAL_USING_INTERNAL_PMIX
118- setenv ("PMIX_PREFIX" , opal_prefix , 1 );
119- #endif
120- }
121-
122- /*
123- * set environment variable for our install location
124- * used within the OMPI prrte schizo component
125- */
126-
127- setenv ("OMPI_LIBDIR_LOC" , opal_install_dirs .libdir , 1 );
128-
129- // Set environment variable to tell PRTE what MCA prefixes belong
130- // to Open MPI.
131- setup_mca_prefixes ();
132-
133-
134- ret = prte_launch (argc , argv );
135- if (OMPI_SUCCESS != ret ) {
136- opal_show_help ("help-mpirun.txt" , "prte-launch-failed" , 1 , strerror (errno ));
137- exit (1 );
138- }
139-
140- return 0 ;
141- }
142-
143- #else
144-
14582static char * find_prterun (void )
14683{
14784 char * filename = NULL ;
@@ -210,23 +147,33 @@ int main(int argc, char *argv[])
210147#endif
211148 }
212149
213- full_prterun_path = find_prterun ();
214- if (NULL == full_prterun_path ) {
215- opal_show_help ("help-mpirun.txt" , "no-prterun-found" , 1 );
216- exit (1 );
217- }
218-
219150 /*
220151 * set environment variable for our install location
221152 * used within the OMPI prrte schizo component
222153 */
223-
224154 setenv ("OMPI_LIBDIR_LOC" , opal_install_dirs .libdir , 1 );
225155
226156 // Set environment variable to tell PRTE what MCA prefixes belong
227157 // to Open MPI.
228158 setup_mca_prefixes ();
229159
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+
230177 /* calling mpirun (and now prterun) with a full path has a special
231178 * meaning in terms of -prefix behavior, so copy that behavior
232179 * into prterun */
@@ -245,6 +192,29 @@ int main(int argc, char *argv[])
245192 opal_show_help ("help-mpirun.txt" , "prterun-exec-failed" ,
246193 1 , full_prterun_path , strerror (errno ));
247194 exit (1 );
195+ #endif /* OMPI_HAVE_PRTE_LAUNCH*/
248196}
249- #endif /* OMPI_HAVE_PRTE_LAUNCH */
250-
197+ /*
198+ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
199+ * University Research and Technology
200+ * Corporation. All rights reserved.
201+ * Copyright (c) 2004-2005 The University of Tennessee and The University
202+ * of Tennessee Research Foundation. All rights
203+ * reserved.
204+ * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
205+ * University of Stuttgart. All rights reserved.
206+ * Copyright (c) 2004-2005 The Regents of the University of California.
207+ * All rights reserved.
208+ * Copyright (c) 2017-2020 Intel, Inc. All rights reserved.
209+ * Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved
210+ * Copyright (c) 2021 Nanook Consulting. All rights reserved.
211+ * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
212+ * Copyright (c) 2022-2025 Triad National Security, LLC. All rights
213+ * reserved.
214+
215+ * $COPYRIGHT$
216+ *
217+ * Additional copyrights may follow
218+ *
219+ * $HEADER$
220+ */
0 commit comments