1
1

A bunch of fixes and improvements to Open MPI's various command line tools.

* fixed some bugs where "unknown" tokens were allowed on the command
   line (which should really only be used for ortertun).
 * if an unknown token is encountered, print a short error to stderr
   and quit with a nonzero exit status
 * if we don't find the right number of parameters to an option, print
   a short error to stderr and quit with a nonzero exit status
 * when --help is given, print the help message to stdout (not stderr)
   and quit with a zero exit status
 * added --showme:help option to the wrapper compilers
 * updated docs in opal/util/cmd_line.h
 * other small/miscellaneous CLI parsing bugs in various tools

I won't bore you with what we did before.  :-)  Here's some examples
of what the new behavior looks like:

{{{
% ompi_info --bogus
ompi_info: Error: unknown option "--bogus"
Type 'ompi_info --help' for usage.
% ompi_info --param bogus
ompi_info: Error: option "--param" did not have enough parameters (2)
Type 'ompi_info --help' for usage.
%
}}}

This commit was SVN r26072.
Этот коммит содержится в:
Jeff Squyres 2012-02-29 17:52:38 +00:00
родитель b2f1bade37
Коммит 97b3603036
27 изменённых файлов: 539 добавлений и 257 удалений

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -24,4 +25,3 @@ Start an Open MPI data server
Usage: %s [OPTIONS] Usage: %s [OPTIONS]
%s %s

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* $COPYRIGHT$ * $COPYRIGHT$
@ -47,7 +47,7 @@
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/opal_sos.h" #include "opal/util/opal_sos.h"
#include "orte/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/daemon_init.h" #include "opal/util/daemon_init.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
@ -123,22 +123,27 @@ int main(int argc, char *argv[])
mca_base_cmd_line_setup(cmd_line); mca_base_cmd_line_setup(cmd_line);
if (OPAL_SUCCESS != (ret = opal_cmd_line_parse(cmd_line, false, if (OPAL_SUCCESS != (ret = opal_cmd_line_parse(cmd_line, false,
argc, argv))) { argc, argv))) {
char *args = NULL; if (OPAL_ERR_SILENT != ret) {
args = opal_cmd_line_get_usage_msg(cmd_line); fprintf(stderr, "%s: command line error (%s)\n", argv[0],
orte_show_help("help-ompi-server.txt", "ompiserver:usage", false, opal_strerror(ret));
argv[0], args); }
free(args); return 1;
return ret;
} }
/* check for help request */ /* check for help request */
if (help) { if (help) {
char *args = NULL; char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(cmd_line); args = opal_cmd_line_get_usage_msg(cmd_line);
orte_show_help("help-ompi-server.txt", "ompiserver:usage", false, str = opal_show_help_string("help-ompi-server.txt",
argv[0], args); "ompiserver:usage", false,
argv[0], args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args); free(args);
return 1; /* If we show the help message, that should be all we do */
return 0;
} }
/* /*

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copryight (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 University of Houston. All rights reserved. * Copyright (c) 2011 University of Houston. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
@ -42,7 +42,9 @@
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
#endif #endif
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/error.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "orte/util/show_help.h" #include "orte/util/show_help.h"
@ -145,18 +147,33 @@ int main(int argc, char *argv[])
/* Do the parsing */ /* Do the parsing */
if (OMPI_SUCCESS != opal_cmd_line_parse(ompi_info_cmd_line, false, argc, argv)) { ret = opal_cmd_line_parse(ompi_info_cmd_line, false, argc, argv);
if (OMPI_SUCCESS != ret) {
cmd_error = true; cmd_error = true;
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
} }
if (!cmd_error && if (!cmd_error &&
(opal_cmd_line_is_taken(ompi_info_cmd_line, "help") || (opal_cmd_line_is_taken(ompi_info_cmd_line, "help") ||
opal_cmd_line_is_taken(ompi_info_cmd_line, "h"))) { opal_cmd_line_is_taken(ompi_info_cmd_line, "h"))) {
char *str, *usage;
want_help = true; want_help = true;
} usage = opal_cmd_line_get_usage_msg(ompi_info_cmd_line);
if (cmd_error || want_help) { str = opal_show_help_string("help-ompi_info.txt", "usage",
char *usage = opal_cmd_line_get_usage_msg(ompi_info_cmd_line); true, usage);
orte_show_help("help-ompi_info.txt", "usage", true, usage); if (NULL != str) {
printf("%s", str);
free(str);
}
free(usage); free(usage);
}
/* If we had a cmd line parse error, or we showed the help
message, it's time to exit. */
if (cmd_error || want_help) {
mca_base_close(); mca_base_close();
OBJ_RELEASE(ompi_info_cmd_line); OBJ_RELEASE(ompi_info_cmd_line);
opal_finalize_util(); opal_finalize_util();

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -23,20 +24,20 @@ opal-checkpoint PID
Open PAL Single Process Checkpoint Tool Open PAL Single Process Checkpoint Tool
%s %s
#
[invalid_pid] [invalid_pid]
Error: The PID (%d) is invalid because either you have not provided a PID Error: The PID (%d) is invalid because either you have not provided a PID
or provided an invalid PID. or provided an invalid PID.
Please see --help for usage. Please see --help for usage.
#
[ckpt_failure] [ckpt_failure]
Error: The application (PID = %d) failed to checkpoint properly. Error: The application (PID = %d) failed to checkpoint properly.
Returned %d, state %d. Returned %d, state %d.
#
[restart_cmd_failure] [restart_cmd_failure]
Error: Unable to obtain the proper restart command to restart from the Error: Unable to obtain the proper restart command to restart from the
checkpoint file (%s). Returned %d. checkpoint file (%s). Returned %d.
#
[pid_does_not_exist] [pid_does_not_exist]
Error: The process with PID %d is not checkpointable. Error: The process with PID %d is not checkpointable.
This could be due to one of the following: This could be due to one of the following:
@ -46,13 +47,16 @@ Error: The process with PID %d is not checkpointable.
We were looking for the named files: We were looking for the named files:
%s %s
%s %s
#
[ckpt:in_progress] [ckpt:in_progress]
The process with PID %d is currently not checkpointable. The process with PID %d is currently not checkpointable.
This is because it is already checkpointing itself. This is because it is already checkpointing itself.
Wait until the checkpoint completes then try again. Wait until the checkpoint completes then try again.
#
[ckpt:req_error] [ckpt:req_error]
The process with PID %d is currently not checkpointable. The process with PID %d is currently not checkpointable.
This is due to an error during the checkpointing process. This is due to an error during the checkpointing process.
#
[ckpt:req_null] [ckpt:req_null]
The process with PID %d is not checkpointable. The process with PID %d is not checkpointable.
This can be due to one of the following reasons: This can be due to one of the following reasons:

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -60,6 +61,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/error.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
@ -276,6 +278,7 @@ static int parse_args(int argc, char *argv[]) {
opal_cmd_line_t cmd_line; opal_cmd_line_t cmd_line;
char **app_env = NULL, **global_env = NULL; char **app_env = NULL, **global_env = NULL;
char * tmp_env_var = NULL; char * tmp_env_var = NULL;
char *argv0 = NULL;
memset(&opal_checkpoint_globals, 0, sizeof(opal_checkpoint_globals_t)); memset(&opal_checkpoint_globals, 0, sizeof(opal_checkpoint_globals_t));
@ -287,6 +290,27 @@ static int parse_args(int argc, char *argv[]) {
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, true, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return 1;
}
if (opal_checkpoint_globals.help) {
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-opal-checkpoint.txt", "usage", true,
args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If we show the help message, that should be all we do */
exit(0);
}
/** /**
* Put all of the MCA arguments in the environment * Put all of the MCA arguments in the environment
@ -313,16 +337,6 @@ static int parse_args(int argc, char *argv[]) {
/** /**
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
if (OPAL_SUCCESS != ret ||
opal_checkpoint_globals.help ||
1 >= argc) {
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-opal-checkpoint.txt", "usage", true,
args);
free(args);
return OPAL_ERROR;
}
if( NULL == opal_checkpoint_globals.snapshot_name ) if( NULL == opal_checkpoint_globals.snapshot_name )
opal_checkpoint_globals.snapshot_name = strdup(""); opal_checkpoint_globals.snapshot_name = strdup("");
@ -331,8 +345,17 @@ static int parse_args(int argc, char *argv[]) {
} }
/* get the remaining bits */ /* get the remaining bits */
argv0 = strdup(argv[0]);
opal_cmd_line_get_tail(&cmd_line, &argc, &argv); opal_cmd_line_get_tail(&cmd_line, &argc, &argv);
if (0 == argc) {
fprintf(stderr, "%s: Nothing to do\n", argv0);
fprintf(stderr, "Type '%s --help' for usage.\n", argv0);
free(argv0);
return OPAL_ERROR;
}
free(argv0);
opal_checkpoint_globals.pid = atoi(argv[0]); opal_checkpoint_globals.pid = atoi(argv[0]);
if ( 0 >= opal_checkpoint_globals.pid ) { if ( 0 >= opal_checkpoint_globals.pid ) {
opal_show_help("help-opal-checkpoint.txt", "invalid_pid", true, opal_show_help("help-opal-checkpoint.txt", "invalid_pid", true,

Просмотреть файл

@ -13,6 +13,7 @@
# Copyright (c) 2007 Evergrid, Inc. All rights reserved. # Copyright (c) 2007 Evergrid, Inc. All rights reserved.
# Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
# #
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -26,46 +27,49 @@ opal-restart -r FILENAME
Open PAL Single Process Restart Tool Open PAL Single Process Restart Tool
%s %s
#
[invalid_filename] [invalid_filename]
Error: The filename (%s) is invalid because either you have not provided a filename Error: The filename is invalid because either you have not provided a filename
or provided an invalid filename. or provided an invalid filename.
Please see --help for usage.
Filename: %s
Please see --help for usage.
#
[invalid_metadata] [invalid_metadata]
Error: The local checkpoint contains invalid or incomplete metadata. Error: The local checkpoint contains invalid or incomplete metadata.
This usually indicates that the original checkpoint was invalid. This usually indicates that the original checkpoint was invalid.
Check the metadata file (%s) in the following directory: Check the metadata file (%s) in the following directory:
%s %s
#
[restart_cmd_failure] [restart_cmd_failure]
Error: Unable to obtain the proper restart command to restart from the Error: Unable to obtain the proper restart command to restart from the
checkpoint file (%s). Returned %d. checkpoint file (%s). Returned %d.
Check the installation of the %s checkpoint/restart service Check the installation of the %s checkpoint/restart service
on all of the machines in your system. on all of the machines in your system.
#
[comp_open_failure] [comp_open_failure]
Error: Unable to open the %s framework. Error: Unable to open the %s framework.
#
[comp_select_failure] [comp_select_failure]
Error: Unable to select the %s component needed to restart this Error: Unable to select the %s component needed to restart this
application. (Returned %d) application. (Returned %d)
This likely indicates that the checkpointer needed is not This likely indicates that the checkpointer needed is not
available on this machine. You should move to a machine that available on this machine. You should move to a machine that
has this checkpointer enabled. has this checkpointer enabled.
#
[comp_select_mismatch] [comp_select_mismatch]
Error: For an unknown reason the selected and requested components do Error: For an unknown reason the selected and requested components do
not match. not match.
Expected Component: %s Expected Component: %s
Selected Component: %s Selected Component: %s
#
[restart_failure] [restart_failure]
Error: The restart command: Error: The restart command:
shell$ %s shell$ %s
returned an error code %d, and was unable to restart properly. returned an error code %d, and was unable to restart properly.
#
[failed-to-exec] [failed-to-exec]
Error: The restart command failed to properly exec the process per Error: The restart command failed to properly exec the process per
the user's request. It is possible that the incorrect OPAL CRS the user's request. It is possible that the incorrect OPAL CRS
@ -73,10 +77,9 @@ Error: The restart command failed to properly exec the process per
Expected Component: %s Expected Component: %s
Selected Component: %s Selected Component: %s
#
[cache_not_avail] [cache_not_avail]
Warning: Recommended cache directory could not be accessed. Falling back Warning: Recommended cache directory could not be accessed. Falling back
to the snapshot location. to the snapshot location.
Cache Dir : %s Cache Dir : %s
Snapshot Dir: %s Snapshot Dir: %s

Просмотреть файл

@ -13,7 +13,7 @@
* reserved. * reserved.
* Copyright (c) 2007 Evergrid, Inc. All rights reserved. * Copyright (c) 2007 Evergrid, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -62,6 +62,7 @@
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/error.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
@ -514,7 +515,27 @@ static int parse_args(int argc, char *argv[])
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return 1;
}
if (opal_restart_globals.help ) {
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-opal-restart.txt", "usage", true,
args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If we show the help message, that should be all we do */
exit(0);
}
/** /**
* Put all of the MCA arguments in the environment * Put all of the MCA arguments in the environment
@ -534,23 +555,13 @@ static int parse_args(int argc, char *argv[])
/** /**
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
if (OPAL_SUCCESS != ret ||
opal_restart_globals.help ) {
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-opal-restart.txt", "usage", true,
args);
free(args);
return OPAL_ERROR;
}
/* get the remaining bits */ /* get the remaining bits */
opal_cmd_line_get_tail(&cmd_line, &argc, &argv); opal_cmd_line_get_tail(&cmd_line, &argc, &argv);
if ( NULL == opal_restart_globals.snapshot_ref || if ( NULL == opal_restart_globals.snapshot_ref ||
0 >= strlen(opal_restart_globals.snapshot_ref) ) { 0 >= strlen(opal_restart_globals.snapshot_ref) ) {
opal_show_help("help-opal-restart.txt", "invalid_filename", true, opal_show_help("help-opal-restart.txt", "invalid_filename", true,
opal_restart_globals.snapshot_ref); "<none provided>");
return OPAL_ERROR; return OPAL_ERROR;
} }
@ -590,9 +601,6 @@ static int check_file(void)
path_to_check); path_to_check);
if (0 > (ret = access(path_to_check, F_OK)) ) { if (0 > (ret = access(path_to_check, F_OK)) ) {
opal_output(opal_restart_globals.output,
"Error: Unable to access the path [%s]!",
path_to_check);
exit_status = OPAL_ERROR; exit_status = OPAL_ERROR;
goto cleanup; goto cleanup;
} }

Просмотреть файл

@ -1,5 +1,5 @@
.\" Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. .\" Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
.\" Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. .\" Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
.TH #COMMAND# 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" .TH #COMMAND# 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
. .
.SH NAME .SH NAME
@ -56,6 +56,9 @@ application. For example: "mpi open-rte open-pal util".
.TP .TP
--showme:version --showme:version
Outputs the version number of Open MPI. Outputs the version number of Open MPI.
.TP
--showme:help
Output a brief usage help message.
.PP .PP
See the man page for your underlying #LANGUAGE# compiler for other See the man page for your underlying #LANGUAGE# compiler for other
options that can be passed through #COMMAND#. options that can be passed through #COMMAND#.

Просмотреть файл

@ -11,6 +11,7 @@
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -46,7 +47,7 @@ one of several possible environment variables.
# #
[usage] [usage]
%s [-showme[:<command,compile,link,incdirs, %s [-showme[:<command,compile,link,incdirs,
libdirs,libs,version>]] args libdirs,libs,version,help>]] args
-showme:command Show command used to invoke real compiler -showme:command Show command used to invoke real compiler
-showme:compile Show flags added when compiling -showme:compile Show flags added when compiling
@ -55,6 +56,7 @@ one of several possible environment variables.
-showme:libdirs Show list of library dirs added when linking -showme:libdirs Show list of library dirs added when linking
-showme:libs Show list of libraries added when linking -showme:libs Show list of libraries added when linking
-showme:version Show version of %s -showme:version Show version of %s
-showme:help This help message
# #
[file-not-found] [file-not-found]
%s could not find the file %s, needed for %s support. %s could not find the file %s, needed for %s support.

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
@ -395,9 +395,9 @@ data_init(const char *appname)
if (NULL == datafile) return OPAL_ERR_TEMP_OUT_OF_RESOURCE; if (NULL == datafile) return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
ret = opal_util_keyval_parse(datafile, data_callback); ret = opal_util_keyval_parse(datafile, data_callback);
if( OPAL_SUCCESS != ret ) { if( OPAL_SUCCESS != ret ) {
fprintf(stderr, "Cannot open configuration file %s\n", datafile ); fprintf(stderr, "Cannot open configuration file %s\n", datafile );
} }
free(datafile); free(datafile);
return ret; return ret;
@ -637,13 +637,36 @@ main(int argc, char *argv[])
goto cleanup; goto cleanup;
} else if (0 == strncmp(user_argv[i], "-showme:version", strlen("-showme:version")) || } else if (0 == strncmp(user_argv[i], "-showme:version", strlen("-showme:version")) ||
0 == strncmp(user_argv[i], "--showme:version", strlen("--showme:version"))) { 0 == strncmp(user_argv[i], "--showme:version", strlen("--showme:version"))) {
opal_show_help("help-opal-wrapper.txt", "version", false, char * str;
argv[0], options_data[user_data_idx].project, options_data[user_data_idx].version, options_data[user_data_idx].language, NULL); str = opal_show_help_string("help-opal-wrapper.txt",
"version", false,
argv[0], options_data[user_data_idx].project, options_data[user_data_idx].version, options_data[user_data_idx].language, NULL);
if (NULL != str) {
printf("%s", str);
free(str);
}
goto cleanup;
} else if (0 == strncmp(user_argv[i], "-showme:help", strlen("-showme:help")) ||
0 == strncmp(user_argv[i], "--showme:help", strlen("--showme:help"))) {
char *str;
str = opal_show_help_string("help-opal-wrapper.txt", "usage",
false, argv[0],
options_data[user_data_idx].project,
NULL);
if (NULL != str) {
printf("%s", str);
free(str);
}
exit_status = 0;
goto cleanup; goto cleanup;
} else if (0 == strncmp(user_argv[i], "-showme:", strlen("-showme:")) || } else if (0 == strncmp(user_argv[i], "-showme:", strlen("-showme:")) ||
0 == strncmp(user_argv[i], "--showme:", strlen("--showme:"))) { 0 == strncmp(user_argv[i], "--showme:", strlen("--showme:"))) {
opal_show_help("help-opal-wrapper.txt", "usage", true, fprintf(stderr, "%s: unrecognized option: %s\n", argv[0],
argv[0], options_data[user_data_idx].project, NULL); user_argv[i]);
fprintf(stderr, "Type '%s --showme:help' for usage.\n",
argv[0]);
exit_status = 1;
goto cleanup; goto cleanup;
} }

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC. * Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -272,6 +273,8 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown,
char **shortsv; char **shortsv;
int shortsc; int shortsc;
int num_args_used; int num_args_used;
bool have_help_option = false;
bool printed_error = false;
/* Bozo check */ /* Bozo check */
@ -292,6 +295,13 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown,
cmd->lcl_argc = argc; cmd->lcl_argc = argc;
cmd->lcl_argv = opal_argv_copy(argv); cmd->lcl_argv = opal_argv_copy(argv);
/* Check up front: do we have a --help option? */
option = find_option(cmd, "help");
if (NULL != option) {
have_help_option = true;
}
/* Now traverse the easy-to-parse sequence of tokens. Note that /* Now traverse the easy-to-parse sequence of tokens. Note that
incrementing i must happen elsehwere; it can't be the third incrementing i must happen elsehwere; it can't be the third
clause in the "if" statement. */ clause in the "if" statement. */
@ -407,25 +417,36 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown,
/* If we run out of parameters, error */ /* If we run out of parameters, error */
if (i >= cmd->lcl_argc) { if (i >= cmd->lcl_argc) {
opal_output(0, "Error: option \"%s\" did not have " fprintf(stderr, "%s: Error: option \"%s\" did not "
"enough parameters (%d)", "have enough parameters (%d)\n",
cmd->lcl_argv[orig], cmd->lcl_argv[0],
option->clo_num_params); cmd->lcl_argv[orig],
option->clo_num_params);
if (have_help_option) {
fprintf(stderr, "Type '%s --help' for usage.\n",
cmd->lcl_argv[0]);
}
OBJ_RELEASE(param); OBJ_RELEASE(param);
i = cmd->lcl_argc; printed_error = true;
break; goto error;
} else { } else {
if (0 == strcmp(cmd->lcl_argv[i], if (0 == strcmp(cmd->lcl_argv[i],
special_empty_token)) { special_empty_token)) {
opal_output(0, "Error: option \"%s\" did not have " fprintf(stderr, "%s: Error: option \"%s\" did not "
"enough parameters (%d)", "have enough parameters (%d)\n",
cmd->lcl_argv[orig], cmd->lcl_argv[0],
option->clo_num_params); cmd->lcl_argv[orig],
if (NULL != param->clp_argv) option->clo_num_params);
if (have_help_option) {
fprintf(stderr, "Type '%s --help' for usage.\n",
cmd->lcl_argv[0]);
}
if (NULL != param->clp_argv) {
opal_argv_free(param->clp_argv); opal_argv_free(param->clp_argv);
}
OBJ_RELEASE(param); OBJ_RELEASE(param);
i = cmd->lcl_argc; printed_error = true;
break; goto error;
} }
/* Otherwise, save this parameter */ /* Otherwise, save this parameter */
@ -474,20 +495,26 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown,
/* If we figured out above that this was an unknown option, /* If we figured out above that this was an unknown option,
handle it. Copy everything (including the current token) handle it. Copy everything (including the current token)
into the tail. If we're not ignoring unknowns, then print into the tail. If we're not ignoring unknowns, then print
an error and return. an error and return. */
*/
if (is_unknown) { if (is_unknown) {
has_unknowns = true; has_unknowns = true;
if (!ignore_unknown) { if (!ignore_unknown) {
opal_output(0, "Error: unknown option \"%s\"", fprintf(stderr, "%s: Error: unknown option \"%s\"\n",
cmd->lcl_argv[i]); cmd->lcl_argv[0], cmd->lcl_argv[i]);
printed_error = true;
if (have_help_option) {
fprintf(stderr, "Type '%s --help' for usage.\n",
cmd->lcl_argv[0]);
}
} }
error:
while (i < cmd->lcl_argc) { while (i < cmd->lcl_argc) {
opal_argv_append(&cmd->lcl_tail_argc, &cmd->lcl_tail_argv, opal_argv_append(&cmd->lcl_tail_argc, &cmd->lcl_tail_argv,
cmd->lcl_argv[i]); cmd->lcl_argv[i]);
++i; ++i;
} }
/* Because i has advanced, we'll fall out of the loop */
} }
} }
@ -496,8 +523,8 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown,
opal_mutex_unlock(&cmd->lcl_mutex); opal_mutex_unlock(&cmd->lcl_mutex);
/* All done */ /* All done */
if(has_unknowns && !ignore_unknown) { if (printed_error) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_SILENT;
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
@ -1190,8 +1217,8 @@ static int set_dest(cmd_line_option_t *option, char *sval)
/* show help isn't going to be available yet, so just /* show help isn't going to be available yet, so just
* print the msg * print the msg
*/ */
fprintf(stderr, "-----------------------------------------------------------\n"); fprintf(stderr, "----------------------------------------------------------------------------\n");
fprintf(stderr, "Open MPI has detected that a parameter given to a cmd line\n"); fprintf(stderr, "Open MPI has detected that a parameter given to a command line\n");
fprintf(stderr, "option does not match the expected format:\n\n"); fprintf(stderr, "option does not match the expected format:\n\n");
if (NULL != option->clo_long_name) { if (NULL != option->clo_long_name) {
fprintf(stderr, " Option: %s\n", option->clo_long_name); fprintf(stderr, " Option: %s\n", option->clo_long_name);
@ -1202,8 +1229,8 @@ static int set_dest(cmd_line_option_t *option, char *sval)
} }
fprintf(stderr, " Param: %s\n\n", sval); fprintf(stderr, " Param: %s\n\n", sval);
fprintf(stderr, "This is frequently caused by omitting to provide the parameter\n"); fprintf(stderr, "This is frequently caused by omitting to provide the parameter\n");
fprintf(stderr, "to an option that requires one. Please check the cmd line and try again.\n"); fprintf(stderr, "to an option that requires one. Please check the command line and try again.\n");
fprintf(stderr, "-----------------------------------------------------------\n\n"); fprintf(stderr, "----------------------------------------------------------------------------\n");
return OPAL_ERR_SILENT; return OPAL_ERR_SILENT;
} }
} }
@ -1216,8 +1243,8 @@ static int set_dest(cmd_line_option_t *option, char *sval)
/* show help isn't going to be available yet, so just /* show help isn't going to be available yet, so just
* print the msg * print the msg
*/ */
fprintf(stderr, "-----------------------------------------------------------\n"); fprintf(stderr, "----------------------------------------------------------------------------\n");
fprintf(stderr, "Open MPI has detected that a parameter given to a cmd line\n"); fprintf(stderr, "Open MPI has detected that a parameter given to a command line\n");
fprintf(stderr, "option does not match the expected format:\n\n"); fprintf(stderr, "option does not match the expected format:\n\n");
if (NULL != option->clo_long_name) { if (NULL != option->clo_long_name) {
fprintf(stderr, " Option: %s\n", option->clo_long_name); fprintf(stderr, " Option: %s\n", option->clo_long_name);
@ -1228,8 +1255,8 @@ static int set_dest(cmd_line_option_t *option, char *sval)
} }
fprintf(stderr, " Param: %s\n\n", sval); fprintf(stderr, " Param: %s\n\n", sval);
fprintf(stderr, "This is frequently caused by omitting to provide the parameter\n"); fprintf(stderr, "This is frequently caused by omitting to provide the parameter\n");
fprintf(stderr, "to an option that requires one. Please check the cmd line and try again.\n"); fprintf(stderr, "to an option that requires one. Please check the command line and try again.\n");
fprintf(stderr, "-----------------------------------------------------------\n\n"); fprintf(stderr, "----------------------------------------------------------------------------\n");
return OPAL_ERR_SILENT; return OPAL_ERR_SILENT;
} }
} }

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -349,6 +350,9 @@ BEGIN_C_DECLS
* @param argv Array of strings from the command line. * @param argv Array of strings from the command line.
* *
* @retval OPAL_SUCCESS Upon success. * @retval OPAL_SUCCESS Upon success.
* @retval OPAL_ERR_SILENT If an error message was printed. This
* value will only be returned if the command line was not
* successfully parsed.
* *
* Parse a series of command line tokens according to the option * Parse a series of command line tokens according to the option
* descriptions from a OPAL command line handle. The OPAL command line * descriptions from a OPAL command line handle. The OPAL command line
@ -361,15 +365,25 @@ BEGIN_C_DECLS
* is displayed. If ignore_unknown is true, the error message is * is displayed. If ignore_unknown is true, the error message is
* not displayed. * not displayed.
* *
* Error messages are always displayed (to stderr, and
* OPAL_ERR_SILENT is returned) if a token was encountered that
* required N parameters, but <N parameters were found (e.g., "cmd
* --param foo", but --param was registered to require 2 option
* tokens).
*
* The contents of argc and argv are not changed during parsing. * The contents of argc and argv are not changed during parsing.
* argv[0] is assumed to be the executable name, and is ignored during * argv[0] is assumed to be the executable name, and is ignored during
* parsing. It can later be retrieved with * parsing, except when printing error messages.
* *
* Parsing will stop in the following conditions: * Parsing will stop in the following conditions:
* *
* - all argv tokens are processed * - all argv tokens are processed
* - the token "--" is found * - the token "--" is found
* - an unrecognized token is found * - an unrecognized token is found
* - a parameter registered with an integer type option finds a
* non-integer option token
* - a parameted registered N option tokens, but finds less then
* <N tokens available
* *
* Upon any of these conditions, any remaining tokens will be placed * Upon any of these conditions, any remaining tokens will be placed
* in the "tail" (and therefore not examined by the parser), * in the "tail" (and therefore not examined by the parser),

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -23,7 +24,7 @@ ompi-checkpoint PID_OF_MPIRUN
Open MPI Checkpoint Tool Open MPI Checkpoint Tool
%s %s
#
[usage-no-cr] [usage-no-cr]
This build of Open MPI does *not* include Checkpoint/Restart functionality. This build of Open MPI does *not* include Checkpoint/Restart functionality.
If you require this functionality re-configure Open MPI with the proper If you require this functionality re-configure Open MPI with the proper
@ -33,16 +34,16 @@ ompi-checkpoint PID_OF_MPIRUN
Open MPI Checkpoint Tool Open MPI Checkpoint Tool
%s %s
#
[invalid_pid] [invalid_pid]
Error: The PID (%d) is invalid because either you have not provided a PID Error: The PID (%d) is invalid because either you have not provided a PID
or provided an invalid PID. or provided an invalid PID.
Please see --help for usage. Please see --help for usage.
#
[ckpt_failure] [ckpt_failure]
Error: The application (PID = %d) failed to checkpoint properly. Error: The application (PID = %d) failed to checkpoint properly.
Returned %d. Returned %d.
#
[pid_does_not_exist] [pid_does_not_exist]
Error: The process with PID %d is not checkpointable. Error: The process with PID %d is not checkpointable.
This could be due to one of the following: This could be due to one of the following:
@ -51,7 +52,7 @@ Error: The process with PID %d is not checkpointable.
- The application with this PID isn't an Open MPI application. - The application with this PID isn't an Open MPI application.
We were looking for the named file: We were looking for the named file:
%s %s
#
[no_hnps] [no_hnps]
Error: Unable to find a list of active MPIRUN processes on this machine. Error: Unable to find a list of active MPIRUN processes on this machine.
This could be due to one of the following: This could be due to one of the following:
@ -64,7 +65,7 @@ Error: Unable to find a list of active MPIRUN processes on this machine.
process is running. process is running.
Return Code: %d (%s) Return Code: %d (%s)
#
[no_universe] [no_universe]
Error: Unable to find the requested, active MPIRUN process on this machine. Error: Unable to find the requested, active MPIRUN process on this machine.
This could be due to one of the following: This could be due to one of the following:
@ -77,7 +78,7 @@ Error: Unable to find the requested, active MPIRUN process on this machine.
ompi-checkpoint attempted to use the session directory: ompi-checkpoint attempted to use the session directory:
%s/%s %s/%s
#
[unable_to_connect] [unable_to_connect]
Error: Unable to connect to the Head Node Process to initiate the Error: Unable to connect to the Head Node Process to initiate the
checkpoint of the application. checkpoint of the application.
@ -87,7 +88,7 @@ Error: Unable to connect to the Head Node Process to initiate the
- The PID is not that of an active MPIRUN. - The PID is not that of an active MPIRUN.
- The application with this PID isn't checkpointable - The application with this PID isn't checkpointable
- The application with this PID isn't an Open MPI application. - The application with this PID isn't an Open MPI application.
#
[non-ckptable] [non-ckptable]
Error: The job with pid %d is not checkpointable. Error: The job with pid %d is not checkpointable.
This could be caused by one of the following: This could be caused by one of the following:
@ -96,6 +97,7 @@ Error: The job with pid %d is not checkpointable.
To enable checkpointing in an application use the following AMCA parameter To enable checkpointing in an application use the following AMCA parameter
argument to mpirun: argument to mpirun:
-am ft-enable-cr -am ft-enable-cr
#
[not_impl] [not_impl]
The following feature was requested, but is not currently implemented. The following feature was requested, but is not currently implemented.
%s %s
@ -106,6 +108,6 @@ Error: The process with PID %d is not checkpointable.
This could be due to one of the following: This could be due to one of the following:
- An application with this PID doesn't currently exist - An application with this PID doesn't currently exist
- The application with this PID isn't an Open MPI application. - The application with this PID isn't an Open MPI application.
#
[hnp_not_found] [hnp_not_found]
Error: The jobid specified by the '--hnp-jobid' option does not exist. Error: The jobid specified by the '--hnp-jobid' option does not exist.

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -345,6 +346,7 @@ static int parse_args(int argc, char *argv[]) {
opal_cmd_line_t cmd_line; opal_cmd_line_t cmd_line;
char **app_env = NULL, **global_env = NULL; char **app_env = NULL, **global_env = NULL;
char * tmp_env_var = NULL; char * tmp_env_var = NULL;
char *argv0 = NULL;
/* Init structure */ /* Init structure */
memset(&orte_checkpoint_globals, 0, sizeof(orte_checkpoint_globals_t)); memset(&orte_checkpoint_globals, 0, sizeof(orte_checkpoint_globals_t));
@ -370,12 +372,52 @@ static int parse_args(int argc, char *argv[]) {
orte_checkpoint_globals.detach_debugger = false; orte_checkpoint_globals.detach_debugger = false;
#endif #endif
#if OPAL_ENABLE_FT_CR == 0
/* Warn and exit if not configured with Checkpoint/Restart */
{
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-checkpoint.txt", "usage-no-cr",
true, args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
exit_status = ORTE_ERROR;
goto cleanup;
}
#endif
/* Parse the command line options */ /* Parse the command line options */
opal_cmd_line_create(&cmd_line, cmd_line_opts); opal_cmd_line_create(&cmd_line, cmd_line_opts);
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
exit_status = 1;
goto cleanup;
}
if (orte_checkpoint_globals.help) {
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-checkpoint.txt", "usage", true,
args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If we show the help message, that should be all we do */
exit(0);
}
/** /**
* Put all of the MCA arguments in the environment * Put all of the MCA arguments in the environment
*/ */
@ -402,6 +444,7 @@ static int parse_args(int argc, char *argv[]) {
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
/* get the remaining bits */ /* get the remaining bits */
argv0 = strdup(argv[0]);
opal_cmd_line_get_tail(&cmd_line, &argc, &argv); opal_cmd_line_get_tail(&cmd_line, &argc, &argv);
if(orte_checkpoint_globals.list_only ) { if(orte_checkpoint_globals.list_only ) {
@ -409,28 +452,10 @@ static int parse_args(int argc, char *argv[]) {
goto cleanup; goto cleanup;
} }
#if OPAL_ENABLE_FT_CR == 0 if (0 >= argc && ORTE_JOBID_INVALID == orte_checkpoint_globals.req_hnp) {
/* Warn and exit if not configured with Checkpoint/Restart */ fprintf(stderr, "%s: Nothing to do\n", argv0);
{ fprintf(stderr, "Type '%s --help' for usage.\n", argv0);
char *args = NULL; exit_status = 1;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-orte-checkpoint.txt", "usage-no-cr",
true, args);
free(args);
exit_status = ORTE_ERROR;
goto cleanup;
}
#endif
if (OPAL_SUCCESS != ret ||
orte_checkpoint_globals.help ||
(0 >= argc && ORTE_JOBID_INVALID == orte_checkpoint_globals.req_hnp)) {
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-orte-checkpoint.txt", "usage", true,
args);
free(args);
exit_status = ORTE_ERROR;
goto cleanup; goto cleanup;
} }
@ -482,6 +507,10 @@ static int parse_args(int argc, char *argv[]) {
} }
cleanup: cleanup:
if (NULL != argv0) {
free(argv0);
}
return exit_status; return exit_status;
} }

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -23,4 +24,3 @@ ompi-clean [OPTIONS]
Open MPI Runtime Environment Cleaning tool Open MPI Runtime Environment Cleaning tool
%s %s

Просмотреть файл

@ -12,6 +12,7 @@
* Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -56,10 +57,11 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/os_dirpath.h" #include "opal/util/os_dirpath.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/util/error.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
#include "opal/util/show_help.h"
#include "orte/util/show_help.h"
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
@ -200,19 +202,31 @@ static int parse_args(int argc, char *argv[]) {
* Initialize list of available command line options. * Initialize list of available command line options.
*/ */
opal_cmd_line_create(&cmd_line, cmd_line_opts); opal_cmd_line_create(&cmd_line, cmd_line_opts);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return ret;
}
/** /**
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
if (OPAL_SUCCESS != ret || if (orte_clean_globals.help) {
orte_clean_globals.help) { char *str, *args = NULL;
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line); args = opal_cmd_line_get_usage_msg(&cmd_line);
orte_show_help("help-orte-clean.txt", "usage", true, str = opal_show_help_string("help-orte-clean.txt", "usage", true,
args); args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args); free(args);
return ORTE_ERROR; /* If we show the help message, that should be all we do */
exit(0);
} }
OBJ_DESTRUCT(&cmd_line); OBJ_DESTRUCT(&cmd_line);

Просмотреть файл

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -25,6 +25,7 @@ The orte-info command can be used to provide detailed information on
your ORTE installation. Syntax: your ORTE installation. Syntax:
%s %s
#
[lib-call-fail] [lib-call-fail]
A library call unexpectedly failed. This is a terminal error; please A library call unexpectedly failed. This is a terminal error; please
show this message to an ORTE wizard: show this message to an ORTE wizard:

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copryight (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010 Los Alamos National Security, LLC. * Copyright (c) 2010 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
@ -40,9 +40,12 @@
#include "opal/class/opal_pointer_array.h" #include "opal/class/opal_pointer_array.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/error.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/util/show_help.h"
#include "orte/constants.h"
#include "orte/util/show_help.h" #include "orte/util/show_help.h"
#include "orte/runtime/orte_locks.h" #include "orte/runtime/orte_locks.h"
@ -142,18 +145,30 @@ int main(int argc, char *argv[])
/* Do the parsing */ /* Do the parsing */
if (ORTE_SUCCESS != opal_cmd_line_parse(orte_info_cmd_line, false, argc, argv)) { ret = opal_cmd_line_parse(orte_info_cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
cmd_error = true; cmd_error = true;
} }
if (!cmd_error && if (!cmd_error &&
(opal_cmd_line_is_taken(orte_info_cmd_line, "help") || (opal_cmd_line_is_taken(orte_info_cmd_line, "help") ||
opal_cmd_line_is_taken(orte_info_cmd_line, "h"))) { opal_cmd_line_is_taken(orte_info_cmd_line, "h"))) {
char *str, *usage;
want_help = true; want_help = true;
usage = opal_cmd_line_get_usage_msg(orte_info_cmd_line);
str = opal_show_help_string("help-orte-info.txt", "usage", true,
usage);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(usage);
} }
if (cmd_error || want_help) { if (cmd_error || want_help) {
char *usage = opal_cmd_line_get_usage_msg(orte_info_cmd_line);
orte_show_help("help-orte-info.txt", "usage", true, usage);
free(usage);
mca_base_close(); mca_base_close();
OBJ_RELEASE(orte_info_cmd_line); OBJ_RELEASE(orte_info_cmd_line);
opal_finalize_util(); opal_finalize_util();

Просмотреть файл

@ -4,6 +4,7 @@
# University Research and Technology # University Research and Technology
# Corporation. All rights reserved. # Corporation. All rights reserved.
# #
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -17,12 +18,12 @@ ompi-migrate PID_OF_MPIRUN
Open MPI Process Migration Tool Open MPI Process Migration Tool
%s %s
#
[invalid_pid] [invalid_pid]
Error: The PID (%d) is invalid because either you have not provided a PID Error: The PID (%d) is invalid because either you have not provided a PID
or provided an invalid PID. or provided an invalid PID.
Please see --help for usage. Please see --help for usage.
#
[no_universe] [no_universe]
Error: Unable to find the contact information for PID %d. Error: Unable to find the contact information for PID %d.
This could be due to one of the following: This could be due to one of the following:
@ -31,7 +32,7 @@ Error: Unable to find the contact information for PID %d.
- The application with this PID isn't an Open MPI application. - The application with this PID isn't an Open MPI application.
ompi-migrate attempted to find the session directory: ompi-migrate attempted to find the session directory:
%s %s
#
[unable_to_connect] [unable_to_connect]
Error: Unable to connect to the Head Node Process to initiate the Error: Unable to connect to the Head Node Process to initiate the
migration of the application. migration of the application.
@ -39,16 +40,17 @@ Error: Unable to connect to the Head Node Process to initiate the
- The PID is not that of an active MPIRUN. - The PID is not that of an active MPIRUN.
- The application with this PID isn't migratable - The application with this PID isn't migratable
- The application with this PID isn't an Open MPI application. - The application with this PID isn't an Open MPI application.
#
[not_impl] [not_impl]
The following feature was requested, but is not currently implemented. The following feature was requested, but is not currently implemented.
%s %s
If you require this feature contact the Open MPI development group. If you require this feature contact the Open MPI development group.
#
[err-inprogress] [err-inprogress]
Error: The Job identified by PID (%d) is currently migrating other processes. Error: The Job identified by PID (%d) is currently migrating other processes.
Only one migration request can be processed at a time. Please try again Only one migration request can be processed at a time. Please try again
later. later.
#
[err-other] [err-other]
Error: The Job identified by PID (%d) was not able to migrate processes in this Error: The Job identified by PID (%d) was not able to migrate processes in this
job. This could be caused by any of the following: job. This could be caused by any of the following:

Просмотреть файл

@ -2,7 +2,7 @@
* Copyright (c) 2009-2010 The Trustees of Indiana University and Indiana * Copyright (c) 2009-2010 The Trustees of Indiana University and Indiana
* University Research and Technology * University Research and Technology
* Corporation. All rights reserved. * Corporation. All rights reserved.
* * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -245,6 +245,7 @@ static int parse_args(int argc, char *argv[]) {
opal_cmd_line_t cmd_line; opal_cmd_line_t cmd_line;
char **app_env = NULL, **global_env = NULL; char **app_env = NULL, **global_env = NULL;
char * tmp_env_var = NULL; char * tmp_env_var = NULL;
char *argv0 = NULL;
/* Init structure */ /* Init structure */
memset(&orte_migrate_globals, 0, sizeof(orte_migrate_globals_t)); memset(&orte_migrate_globals, 0, sizeof(orte_migrate_globals_t));
@ -258,12 +259,52 @@ static int parse_args(int argc, char *argv[]) {
orte_migrate_globals.off_procs = NULL; orte_migrate_globals.off_procs = NULL;
orte_migrate_globals.onto_nodes = NULL; orte_migrate_globals.onto_nodes = NULL;
#if OPAL_ENABLE_FT_CR == 0
/* Warn and exit if not configured with Migrate/Restart */
{
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-migrate.txt", "usage-no-cr",
true, args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
exit_status = ORTE_ERROR;
goto cleanup;
}
#endif
/* Parse the command line options */ /* Parse the command line options */
opal_cmd_line_create(&cmd_line, cmd_line_opts); opal_cmd_line_create(&cmd_line, cmd_line_opts);
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
exit_status = 1;
goto cleanup;
}
if (orte_migrate_globals.help) {
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-migrate.txt", "usage", true,
args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If we show the help message, that should be all we do */
exit(0);
}
/** /**
* Put all of the MCA arguments in the environment * Put all of the MCA arguments in the environment
*/ */
@ -290,31 +331,14 @@ static int parse_args(int argc, char *argv[]) {
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
/* get the remaining bits */ /* get the remaining bits */
argv0 = strdup(argv[0]);
opal_cmd_line_get_tail(&cmd_line, &argc, &argv); opal_cmd_line_get_tail(&cmd_line, &argc, &argv);
#if OPAL_ENABLE_FT_CR == 0 if (NULL == orte_migrate_globals.off_nodes &&
/* Warn and exit if not configured with Migrate/Restart */ NULL == orte_migrate_globals.off_procs) {
{ fprintf(stderr, "%s: Nothing to do\n", argv0);
char *args = NULL; fprintf(stderr, "Type '%s --help' for usage.\n", argv0);
args = opal_cmd_line_get_usage_msg(&cmd_line); exit_status = 1;
opal_show_help("help-orte-migrate.txt", "usage-no-cr",
true, args);
free(args);
exit_status = ORTE_ERROR;
goto cleanup;
}
#endif
if (OPAL_SUCCESS != ret ||
orte_migrate_globals.help ||
0 >= argc ||
(NULL == orte_migrate_globals.off_nodes && NULL == orte_migrate_globals.off_procs) ) {
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-orte-migrate.txt", "usage", true,
args);
free(args);
exit_status = ORTE_ERROR;
goto cleanup; goto cleanup;
} }
@ -331,7 +355,10 @@ static int parse_args(int argc, char *argv[]) {
* supply the PID of MPIRUN * supply the PID of MPIRUN
*/ */
if(0 >= argc ) { if(0 >= argc ) {
exit_status = ORTE_SUCCESS; fprintf(stderr, "%s: Nothing to do\n", argv[0]);
fprintf(stderr, "Type '%s --help' for usage.\n", argv[0]);
exit_status = ORTE_ERROR;
goto cleanup; goto cleanup;
} }
@ -352,6 +379,10 @@ static int parse_args(int argc, char *argv[]) {
} }
cleanup: cleanup:
if (NULL != argv0) {
free(argv0);
}
return exit_status; return exit_status;
} }

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -23,14 +24,18 @@ ompi-ps [OPTIONS]
Open MPI Job and Process Status Tool Open MPI Job and Process Status Tool
%s %s
#
[vpid-usage] [vpid-usage]
Error: You specified a vpid (%d) without also specifying a jobid. Error: You specified a vpid (%d) without also specifying a jobid.
Use the '-j' option to specify a jobid. Use the '-j' option to specify a jobid.
#
[need-vpid]
Error: You specified a jobid (%d) without also specifying a vpid.
Use the '-p' option to specify a vpid.
#
[invalid-vpid] [invalid-vpid]
Error: The specified vpid (%d) is not valid for job %d. Error: The specified vpid (%d) is not valid for job %d.
#
[stale-hnp] [stale-hnp]
An attempt was made to obtain ps information from a non-responsive An attempt was made to obtain ps information from a non-responsive
HNP: HNP:

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
@ -58,6 +58,7 @@
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/show_help.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
@ -327,29 +328,38 @@ static int parse_args(int argc, char *argv[]) {
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return ret;
}
/** /**
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
if (OPAL_SUCCESS != ret || if (orte_ps_globals.help) {
orte_ps_globals.help) { char *str, *args = NULL;
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line); args = opal_cmd_line_get_usage_msg(&cmd_line);
orte_show_help("help-orte-ps.txt", "usage", true, str = opal_show_help_string("help-orte-ps.txt", "usage", true,
args); args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args); free(args);
return ORTE_ERROR; /* If we show the help message, that should be all we do */
exit(0);
} }
/* if the jobid is given, then we need a pid */ /* if the jobid is given, then we need a pid */
if (ORTE_JOBID_WILDCARD != orte_ps_globals.jobid && if (ORTE_JOBID_WILDCARD != orte_ps_globals.jobid &&
0 == orte_ps_globals.pid) { 0 == orte_ps_globals.pid) {
char *args = NULL; orte_show_help("help-orte-ps.txt", "need-vpid", true,
args = opal_cmd_line_get_usage_msg(&cmd_line); orte_ps_globals.jobid);
orte_show_help("help-orte-ps.txt", "usage", true,
args);
free(args);
return ORTE_ERROR; return ORTE_ERROR;
} }

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -23,7 +24,7 @@ ompi-restart GLOBAL_SNAPSHOT_REF
Open MPI Parallel Job Restart Tool Open MPI Parallel Job Restart Tool
%s %s
#
[usage-no-cr] [usage-no-cr]
This build of Open MPI does *not* include Checkpoint/Restart functionality. This build of Open MPI does *not* include Checkpoint/Restart functionality.
If you require this functionality re-configure Open MPI with the proper If you require this functionality re-configure Open MPI with the proper
@ -33,7 +34,7 @@ ompi-restart GLOBAL_SNAPSHOT_REF
Open MPI Parallel Job Restart Tool Open MPI Parallel Job Restart Tool
%s %s
#
[invalid_filename] [invalid_filename]
Error: The filename provided (referenced below) could not be used for Error: The filename provided (referenced below) could not be used for
restarting the job. This could be for a variety of reasons: restarting the job. This could be for a variety of reasons:
@ -43,28 +44,28 @@ Error: The filename provided (referenced below) could not be used for
Please see --help for usage. Please see --help for usage.
Filename: %s Filename: %s
#
[restart_cmd_failure] [restart_cmd_failure]
Error: Unable to obtain the proper restart command to restart from the Error: Unable to obtain the proper restart command to restart from the
checkpoint file (%s). Returned %d. checkpoint file (%s). Returned %d.
#
[comp_select_failure] [comp_select_failure]
Error: Unable to select the %s component needed to restart this Error: Unable to select the %s component needed to restart this
application. (Returned %d) application. (Returned %d)
This likely indicates that the checkpointer needed is not This likely indicates that the checkpointer needed is not
available on this machine. You should move to a machine that available on this machine. You should move to a machine that
has this checkpointer enabled. has this checkpointer enabled.
#
[restart_failure] [restart_failure]
Error: The restart command: Error: The restart command:
shell$ %s shell$ %s
returned an error code %d, and was unable to restart properly. returned an error code %d, and was unable to restart properly.
#
[invalid_seq_num] [invalid_seq_num]
Error: The filename (%s) and sequence number (%d) could not be used. Error: The filename (%s) and sequence number (%d) could not be used.
This may be caused by an invalid sequence number. Try using the This may be caused by an invalid sequence number. Try using the
'-i' option to determine a correct value. '-i' option to determine a correct value.
#
[amca_param_not_found] [amca_param_not_found]
Warning: Unable to find the AMCA parameter in the checkpoint metadata. Warning: Unable to find the AMCA parameter in the checkpoint metadata.
This is the option supplied to mpirun as '-am '. Restart will This is the option supplied to mpirun as '-am '. Restart will

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -55,6 +56,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/util/error.h"
#include "opal/util/path.h" #include "opal/util/path.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_param.h" #include "opal/mca/base/mca_base_param.h"
@ -398,6 +400,7 @@ static int parse_args(int argc, char *argv[])
opal_cmd_line_t cmd_line; opal_cmd_line_t cmd_line;
char **app_env = NULL, **global_env = NULL; char **app_env = NULL, **global_env = NULL;
char * tmp_env_var = NULL; char * tmp_env_var = NULL;
char *argv0 = NULL;
orte_restart_globals_t tmp = { false, /* help */ orte_restart_globals_t tmp = { false, /* help */
NULL, /* filename */ NULL, /* filename */
NULL, /* appfile */ NULL, /* appfile */
@ -416,6 +419,22 @@ static int parse_args(int argc, char *argv[])
orte_restart_globals.enable_crdebug = false; orte_restart_globals.enable_crdebug = false;
#endif #endif
#if OPAL_ENABLE_FT_CR == 0
/* Warn and exit if not configured with Checkpoint/Restart */
{
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-restart.txt", "usage-no-cr",
true, args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
return ORTE_ERROR;
}
#endif
/* Parse the command line options */ /* Parse the command line options */
opal_cmd_line_create(&cmd_line, cmd_line_opts); opal_cmd_line_create(&cmd_line, cmd_line_opts);
@ -423,6 +442,28 @@ static int parse_args(int argc, char *argv[])
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, true, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return 1;
}
if (orte_restart_globals.help) {
char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
str = opal_show_help_string("help-orte-restart.txt", "usage", true,
args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args);
/* If we show the help message, that should be all we do */
exit(0);
}
/** /**
* Put all of the MCA arguments in the environment * Put all of the MCA arguments in the environment
*/ */
@ -449,45 +490,22 @@ static int parse_args(int argc, char *argv[])
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
#if OPAL_ENABLE_FT_CR == 0
/* Warn and exit if not configured with Checkpoint/Restart */
{
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-orte-restart.txt", "usage-no-cr",
true, args);
free(args);
return ORTE_ERROR;
}
#endif
if (OPAL_SUCCESS != ret ||
orte_restart_globals.help ||
1 >= argc) {
char *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line);
opal_show_help("help-orte-restart.txt", "usage", true,
args);
free(args);
return ORTE_ERROR;
}
/* get the remaining bits */ /* get the remaining bits */
argv0 = strdup(argv[0]);
opal_cmd_line_get_tail(&cmd_line, &argc, &argv); opal_cmd_line_get_tail(&cmd_line, &argc, &argv);
if ( 1 > argc ) { if (0 == argc) {
char *args = NULL; fprintf(stderr, "%s: Nothing to do\n", argv0);
args = opal_cmd_line_get_usage_msg(&cmd_line); fprintf(stderr, "Type '%s --help' for usge.\n", argv0);
opal_show_help("help-orte-restart.txt", "usage", true, free(argv0);
args);
free(args);
return ORTE_ERROR; return ORTE_ERROR;
} }
free(argv0);
orte_restart_globals.snapshot_ref = strdup(argv[0]); orte_restart_globals.snapshot_ref = strdup(argv[0]);
if ( NULL == orte_restart_globals.snapshot_ref || if ( NULL == orte_restart_globals.snapshot_ref ||
0 >= strlen(orte_restart_globals.snapshot_ref) ) { 0 >= strlen(orte_restart_globals.snapshot_ref) ) {
opal_show_help("help-orte-restart.txt", "invalid_filename", true, opal_show_help("help-orte-restart.txt", "invalid_filename", true,
orte_restart_globals.snapshot_ref); "<none provided>");
return ORTE_ERROR; return ORTE_ERROR;
} }

Просмотреть файл

@ -10,6 +10,7 @@
# University of Stuttgart. All rights reserved. # University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California. # Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved. # All rights reserved.
# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$ # $COPYRIGHT$
# #
# Additional copyrights may follow # Additional copyrights may follow
@ -29,12 +30,10 @@ Usage: %s [OPTIONS]
We could not find an mpirun matching the provided pid on this machine. We could not find an mpirun matching the provided pid on this machine.
Pid provided: %d Pid provided: %d
# #
[orte-top:no-contact-given] [orte-top:no-contact-given]
This tool requires that you specify contact info for the mpirun executing This tool requires that you specify contact info for the mpirun executing
the specified rank(s). Please use the --help option for more information. the specified rank(s). Please use the --help option for more information.
# #
[orte-top:hnp-filename-bad] [orte-top:hnp-filename-bad]
We are unable to parse the filename where contact info for the We are unable to parse the filename where contact info for the

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* $COPYRIGHT$ * $COPYRIGHT$
@ -39,9 +39,10 @@
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h"
#include "opal/util/opal_environ.h"
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/util/opal_environ.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
@ -240,17 +241,30 @@ main(int argc, char *argv[])
mca_base_open(); mca_base_open();
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
ret = opal_cmd_line_parse(&cmd_line, true, argc, argv); ret = opal_cmd_line_parse(&cmd_line, false, argc, argv);
if (OPAL_SUCCESS != ret) {
if (OPAL_ERR_SILENT != ret) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(ret));
}
return 1;
}
/** /**
* Now start parsing our specific arguments * Now start parsing our specific arguments
*/ */
if (OPAL_SUCCESS != ret || help) { if (help) {
char *args = NULL; char *str, *args = NULL;
args = opal_cmd_line_get_usage_msg(&cmd_line); args = opal_cmd_line_get_usage_msg(&cmd_line);
orte_show_help("help-orte-top.txt", "orte-top:usage", true, "orte-top", args); str = opal_show_help_string("help-orte-top.txt", "orte-top:usage",
true, "orte-top", args);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args); free(args);
return ORTE_ERROR; /* If we show the help message, that should be all we do */
return 0;
} }
/*************************** /***************************

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights * Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
@ -67,7 +67,7 @@
#include "opal/util/cmd_line.h" #include "opal/util/cmd_line.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/opal_getcwd.h" #include "opal/util/opal_getcwd.h"
#include "orte/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/sys/atomic.h" #include "opal/sys/atomic.h"
#if OPAL_ENABLE_FT_CR == 1 #if OPAL_ENABLE_FT_CR == 1
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
@ -84,6 +84,7 @@
#include "orte/util/pre_condition_transports.h" #include "orte/util/pre_condition_transports.h"
#include "orte/util/session_dir.h" #include "orte/util/session_dir.h"
#include "orte/util/hnp_contact.h" #include "orte/util/hnp_contact.h"
#include "orte/util/show_help.h"
#include "orte/mca/odls/odls.h" #include "orte/mca/odls/odls.h"
#include "orte/mca/plm/plm.h" #include "orte/mca/plm/plm.h"
@ -546,8 +547,12 @@ int orterun(int argc, char *argv[])
init_globals(); init_globals();
opal_cmd_line_create(&cmd_line, cmd_line_init); opal_cmd_line_create(&cmd_line, cmd_line_init);
mca_base_cmd_line_setup(&cmd_line); mca_base_cmd_line_setup(&cmd_line);
if (ORTE_SUCCESS != (rc = opal_cmd_line_parse(&cmd_line, true, if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(&cmd_line, true,
argc, argv)) ) { argc, argv)) ) {
if (OPAL_ERR_SILENT != rc) {
fprintf(stderr, "%s: command line error (%s)\n", argv[0],
opal_strerror(rc));
}
return rc; return rc;
} }
@ -926,24 +931,27 @@ static int parse_globals(int argc, char* argv[], opal_cmd_line_t *cmd_line)
{ {
/* print version if requested. Do this before check for help so /* print version if requested. Do this before check for help so
that --version --help works as one might expect. */ that --version --help works as one might expect. */
if (orterun_globals.version && if (orterun_globals.version) {
!(1 == argc || orterun_globals.help)) { char *str, *project_name = NULL;
char *project_name = NULL;
if (0 == strcmp(orte_basename, "mpirun")) { if (0 == strcmp(orte_basename, "mpirun")) {
project_name = "Open MPI"; project_name = "Open MPI";
} else { } else {
project_name = "OpenRTE"; project_name = "OpenRTE";
} }
orte_show_help("help-orterun.txt", "orterun:version", false, str = opal_show_help_string("help-orterun.txt", "orterun:version",
orte_basename, project_name, OPAL_VERSION, false,
PACKAGE_BUGREPORT); orte_basename, project_name, OPAL_VERSION,
/* if we were the only argument, exit */ PACKAGE_BUGREPORT);
if (2 == argc) exit(0); if (NULL != str) {
printf("%s", str);
free(str);
}
exit(0);
} }
/* Check for help request */ /* Check for help request */
if (1 == argc || orterun_globals.help) { if (orterun_globals.help) {
char *args = NULL; char *str, *args = NULL;
char *project_name = NULL; char *project_name = NULL;
if (0 == strcmp(orte_basename, "mpirun")) { if (0 == strcmp(orte_basename, "mpirun")) {
project_name = "Open MPI"; project_name = "Open MPI";
@ -951,10 +959,14 @@ static int parse_globals(int argc, char* argv[], opal_cmd_line_t *cmd_line)
project_name = "OpenRTE"; project_name = "OpenRTE";
} }
args = opal_cmd_line_get_usage_msg(cmd_line); args = opal_cmd_line_get_usage_msg(cmd_line);
orte_show_help("help-orterun.txt", "orterun:usage", false, str = opal_show_help_string("help-orterun.txt", "orterun:usage", false,
orte_basename, project_name, OPAL_VERSION, orte_basename, project_name, OPAL_VERSION,
orte_basename, args, orte_basename, args,
PACKAGE_BUGREPORT); PACKAGE_BUGREPORT);
if (NULL != str) {
printf("%s", str);
free(str);
}
free(args); free(args);
/* If someone asks for help, that should be all we do */ /* If someone asks for help, that should be all we do */