28
28
#include "opal/util/printf.h"
29
29
#include "opal/util/show_help.h"
30
30
#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"
37
33
#endif
38
34
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
- }
71
-
72
35
static void append_prefixes (char * * * out , const char * in )
73
36
{
74
37
if (NULL == in ) {
@@ -115,14 +78,43 @@ static void setup_mca_prefixes(void)
115
78
opal_argv_free (tmp );
116
79
}
117
80
81
+ __opal_attribute_unused__
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
+ }
118
111
119
112
int main (int argc , char * argv [])
120
113
{
121
114
char * opal_prefix = getenv ("OPAL_PREFIX" );
122
- char * full_prterun_path = NULL ;
123
- char * * prterun_args = NULL ;
115
+ char __opal_attribute_unused__ * full_prterun_path = NULL ;
116
+ char __opal_attribute_unused__ * * prterun_args = NULL ;
124
117
int ret ;
125
- size_t i ;
126
118
127
119
ret = opal_init_util (& argc , & argv );
128
120
if (OMPI_SUCCESS != ret ) {
@@ -154,23 +146,33 @@ int main(int argc, char *argv[])
154
146
#endif
155
147
}
156
148
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
-
163
149
/*
164
150
* set environment variable for our install location
165
151
* used within the OMPI prrte schizo component
166
152
*/
167
-
168
153
setenv ("OMPI_LIBDIR_LOC" , opal_install_dirs .libdir , 1 );
169
154
170
155
// Set environment variable to tell PRTE what MCA prefixes belong
171
156
// to Open MPI.
172
157
setup_mca_prefixes ();
173
158
159
+ #if OMPI_HAVE_PRTE_LAUNCH
160
+
161
+ ret = prte_launch (argc , argv );
162
+ if (OMPI_SUCCESS != ret ) {
163
+ opal_show_help ("help-mpirun.txt" , "prte-launch-failed" , 1 , strerror (errno ));
164
+ exit (1 );
165
+ }
166
+
167
+ return 0 ;
168
+ #else
169
+
170
+ full_prterun_path = find_prterun ();
171
+ if (NULL == full_prterun_path ) {
172
+ opal_show_help ("help-mpirun.txt" , "no-prterun-found" , 1 );
173
+ exit (1 );
174
+ }
175
+
174
176
/* calling mpirun (and now prterun) with a full path has a special
175
177
* meaning in terms of -prefix behavior, so copy that behavior
176
178
* into prterun */
@@ -182,16 +184,16 @@ int main(int argc, char *argv[])
182
184
183
185
/* Copy all the mpirun arguments to prterun.
184
186
* TODO: Need to handle --prefix rationally here. */
185
- for (i = 1 ; NULL != argv [i ]; i ++ ) {
187
+ for (size_t i = 1 ; NULL != argv [i ]; i ++ ) {
186
188
opal_argv_append_nosize (& prterun_args , argv [i ]);
187
189
}
188
190
ret = execv (full_prterun_path , prterun_args );
189
191
opal_show_help ("help-mpirun.txt" , "prterun-exec-failed" ,
190
192
1 , full_prterun_path , strerror (errno ));
191
- exit (1 );
192
- }
193
-
194
- /*
193
+ exit (1 );
194
+ #endif /* OMPI_HAVE_PRTE_LAUNCH*/
195
+ }
196
+ /*
195
197
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
196
198
* University Research and Technology
197
199
* Corporation. All rights reserved.
@@ -206,9 +208,9 @@ int main(int argc, char *argv[])
206
208
* Copyright (c) 2020-2022 Cisco Systems, Inc. All rights reserved
207
209
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
208
210
* Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
209
- * Copyright (c) 2022 Triad National Security, LLC. All rights
211
+ * Copyright (c) 2022-2025 Triad National Security, LLC. All rights
210
212
* reserved.
211
-
213
+
212
214
* $COPYRIGHT$
213
215
*
214
216
* Additional copyrights may follow
0 commit comments