@@ -199,7 +199,7 @@ static OBJ_CLASS_INSTANCE(trackr_t,
199199 tcon , tdes ) ;
200200
201201int orte_submit_init (int argc , char * argv [],
202- opal_cmd_line_t * opts )
202+ opal_cmd_line_init_t * opts )
203203{
204204 int rc , i ;
205205 char * param ;
@@ -211,51 +211,32 @@ int orte_submit_init(int argc, char *argv[],
211211 use it in pretty-print error messages */
212212 orte_basename = opal_basename (argv [0 ]);
213213
214- /* see if print version is requested. Do this before
215- * check for help so that --version --help works as
216- * one might expect. */
217- for (i = 0 ; NULL != argv [i ]; i ++ ) {
218- if (0 == strcmp (argv [i ], "--version" ) ||
219- 0 == strcmp (argv [i ], "-V" )) {
220- char * str , * project_name = NULL ;
221- if (0 == strcmp (orte_basename , "mpirun" )) {
222- project_name = "Open MPI" ;
223- } else {
224- project_name = "OpenRTE" ;
225- }
226- str = opal_info_make_version_str ("all" ,
227- OPAL_MAJOR_VERSION , OPAL_MINOR_VERSION ,
228- OPAL_RELEASE_VERSION ,
229- OPAL_GREEK_VERSION ,
230- OPAL_REPO_REV );
231- if (NULL != str ) {
232- fprintf (stdout , "%s (%s) %s\n\nReport bugs to %s\n" ,
233- orte_basename , project_name , str , PACKAGE_BUGREPORT );
234- free (str );
235- }
236- exit (0 );
214+ /* search the argv for MCA params */
215+ for (i = 0 ; NULL != argv [i ]; i ++ ) {
216+ if (':' == argv [i ][0 ] ||
217+ NULL == argv [i + 1 ] || NULL == argv [i + 2 ]) {
218+ break ;
237219 }
238- }
239-
240- /* need to parse mca options *before* opal_init_util() */
241- orte_cmd_line = OBJ_NEW (opal_cmd_line_t );
242- mca_base_cmd_line_setup (orte_cmd_line );
243-
244- /* parse the result to get values */
245- if (OPAL_SUCCESS != (rc = opal_cmd_line_parse (orte_cmd_line ,
246- true, true, argc , argv )) ) {
247- if (OPAL_ERR_SILENT != rc ) {
248- fprintf (stderr , "%s: command line error (%s)\n" , argv [0 ],
249- opal_strerror (rc ));
220+ if (0 == strncmp (argv [i ], "-" OPAL_MCA_CMD_LINE_ID , strlen ("-" OPAL_MCA_CMD_LINE_ID )) ||
221+ 0 == strncmp (argv [i ], "--" OPAL_MCA_CMD_LINE_ID , strlen ("--" OPAL_MCA_CMD_LINE_ID )) ||
222+ 0 == strncmp (argv [i ], "-g" OPAL_MCA_CMD_LINE_ID , strlen ("-g" OPAL_MCA_CMD_LINE_ID )) ||
223+ 0 == strncmp (argv [i ], "--g" OPAL_MCA_CMD_LINE_ID , strlen ("--g" OPAL_MCA_CMD_LINE_ID ))) {
224+ (void ) mca_base_var_env_name (argv [i + 1 ], & param );
225+ opal_setenv (param , argv [i + 2 ], true, & environ );
226+ free (param );
227+ } else if (0 == strcmp (argv [i ], "-am" ) ||
228+ 0 == strcmp (argv [i ], "--am" )) {
229+ (void )mca_base_var_env_name ("mca_base_param_file_prefix" , & param );
230+ opal_setenv (param , argv [i + 1 ], true, & environ );
231+ free (param );
232+ } else if (0 == strcmp (argv [i ], "-tune" ) ||
233+ 0 == strcmp (argv [i ], "--tune" )) {
234+ (void )mca_base_var_env_name ("mca_base_envar_file_prefix" , & param );
235+ opal_setenv (param , argv [i + 1 ], true, & environ );
236+ free (param );
250237 }
251- return rc ;
252238 }
253239
254- if (OPAL_SUCCESS != (rc = mca_base_cmd_line_process_args (orte_cmd_line , & environ , & environ ))) {
255- return rc ;
256- }
257-
258-
259240 /* init only the util portion of OPAL */
260241 if (OPAL_SUCCESS != (rc = opal_init_util (& argc , & argv ))) {
261242 return rc ;
@@ -273,6 +254,10 @@ int orte_submit_init(int argc, char *argv[],
273254 OBJ_CONSTRUCT (& tool_jobs , opal_pointer_array_t );
274255 opal_pointer_array_init (& tool_jobs , 256 , INT_MAX , 128 );
275256
257+
258+ /* setup the cmd line */
259+ orte_cmd_line = OBJ_NEW (opal_cmd_line_t );
260+
276261 /* if they were provided, add the opts */
277262 if (NULL != opts ) {
278263 if (OPAL_SUCCESS != (rc = opal_cmd_line_add (orte_cmd_line , opts ))) {
@@ -298,6 +283,29 @@ int orte_submit_init(int argc, char *argv[],
298283 return rc ;
299284 }
300285
286+ /* see if print version is requested. Do this before
287+ * check for help so that --version --help works as
288+ * one might expect. */
289+ if (orte_cmd_options .version ) {
290+ char * str , * project_name = NULL ;
291+ if (0 == strcmp (orte_basename , "mpirun" )) {
292+ project_name = "Open MPI" ;
293+ } else {
294+ project_name = "OpenRTE" ;
295+ }
296+ str = opal_info_make_version_str ("all" ,
297+ OPAL_MAJOR_VERSION , OPAL_MINOR_VERSION ,
298+ OPAL_RELEASE_VERSION ,
299+ OPAL_GREEK_VERSION ,
300+ OPAL_REPO_REV );
301+ if (NULL != str ) {
302+ fprintf (stdout , "%s (%s) %s\n\nReport bugs to %s\n" ,
303+ orte_basename , project_name , str , PACKAGE_BUGREPORT );
304+ free (str );
305+ }
306+ exit (0 );
307+ }
308+
301309 /* check if we are running as root - if we are, then only allow
302310 * us to proceed if the allow-run-as-root flag was given. Otherwise,
303311 * exit with a giant warning flag
@@ -332,29 +340,26 @@ int orte_submit_init(int argc, char *argv[],
332340 }
333341
334342 /* Check for help request */
335- for (i = 0 ; NULL != argv [i ]; i ++ ) {
336- if (0 == strcmp (argv [i ], "--help" ) ||
337- 0 == strcmp (argv [i ], "-h" )) {
338- char * str , * args = NULL ;
339- char * project_name = NULL ;
340- if (0 == strcmp (orte_basename , "mpirun" )) {
341- project_name = "Open MPI" ;
342- } else {
343- project_name = "OpenRTE" ;
344- }
345- args = opal_cmd_line_get_usage_msg (orte_cmd_line );
346- str = opal_show_help_string ("help-orterun.txt" , "orterun:usage" , false,
347- orte_basename , project_name , OPAL_VERSION ,
348- orte_basename , args ,
349- PACKAGE_BUGREPORT );
350- if (NULL != str ) {
351- printf ("%s" , str );
352- free (str );
353- }
354- free (args );
355- /* If someone asks for help, that should be all we do */
356- exit (0 );
357- }
343+ if (orte_cmd_options .help ) {
344+ char * str , * args = NULL ;
345+ char * project_name = NULL ;
346+ if (0 == strcmp (orte_basename , "mpirun" )) {
347+ project_name = "Open MPI" ;
348+ } else {
349+ project_name = "OpenRTE" ;
350+ }
351+ args = opal_cmd_line_get_usage_msg (orte_cmd_line );
352+ str = opal_show_help_string ("help-orterun.txt" , "orterun:usage" , false,
353+ orte_basename , project_name , OPAL_VERSION ,
354+ orte_basename , args ,
355+ PACKAGE_BUGREPORT );
356+ if (NULL != str ) {
357+ printf ("%s" , str );
358+ free (str );
359+ }
360+ free (args );
361+ /* If someone asks for help, that should be all we do */
362+ exit (0 );
358363 }
359364
360365 /* set the flags - if they gave us a -hnp option, then
0 commit comments