Merge pull request #2810 from jjhursey/fix/ibm/stdiag-to-stdout
Extend options for stddiag routing
Этот коммит содержится в:
Коммит
2e64bf42fb
@ -13,6 +13,7 @@
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -121,7 +122,13 @@ int mca_base_open(void)
|
||||
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
||||
|
||||
/* What verbosity level do we want for the default 0 stream? */
|
||||
mca_base_verbose = "stderr";
|
||||
char *str = getenv("OPAL_OUTPUT_INTERNAL_TO_STDOUT");
|
||||
if (NULL != str && str[0] == '1') {
|
||||
mca_base_verbose = "stdout";
|
||||
}
|
||||
else {
|
||||
mca_base_verbose = "stderr";
|
||||
}
|
||||
var_id = mca_base_var_register("opal", "mca", "base", "verbose",
|
||||
"Specifies where the default error output stream goes (this is separate from distinct help messages). Accepts a comma-delimited list of: stderr, stdout, syslog, syslogpri:<notice|info|debug>, syslogid:<str> (where str is the prefix string for all syslog notices), file[:filename] (if filename is not specified, a default filename is used), fileappend (if not specified, the file is opened for truncation), level[:N] (if specified, integer verbose level; otherwise, 0 is implied)",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
|
@ -15,6 +15,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -174,7 +175,13 @@ bool opal_output_init(void)
|
||||
verbose.lds_want_stderr = false;
|
||||
verbose.lds_want_stdout = false;
|
||||
} else {
|
||||
verbose.lds_want_stderr = true;
|
||||
str = getenv("OPAL_OUTPUT_INTERNAL_TO_STDOUT");
|
||||
if (NULL != str && str[0] == '1') {
|
||||
verbose.lds_want_stdout = true;
|
||||
}
|
||||
else {
|
||||
verbose.lds_want_stderr = true;
|
||||
}
|
||||
}
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid());
|
||||
|
@ -13,6 +13,7 @@
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -136,6 +137,7 @@ struct orte_iof_base_t {
|
||||
char *input_files;
|
||||
orte_iof_sink_t *iof_write_stdout;
|
||||
orte_iof_sink_t *iof_write_stderr;
|
||||
bool redirect_app_stderr_to_stdout;
|
||||
};
|
||||
typedef struct orte_iof_base_t orte_iof_base_t;
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2015-2017 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -79,6 +80,15 @@ static int orte_iof_base_register(mca_base_register_flag_t flags)
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&orte_iof_base.input_files);
|
||||
|
||||
/* Redirect application stderr to stdout (at source) */
|
||||
orte_iof_base.redirect_app_stderr_to_stdout = false;
|
||||
(void) mca_base_var_register("orte", "iof","base", "redirect_app_stderr_to_stdout",
|
||||
"Redirect application stderr to stdout at source (default: false)",
|
||||
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9,
|
||||
MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&orte_iof_base.redirect_app_stderr_to_stdout);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -67,6 +68,7 @@
|
||||
#include "orte/runtime/orte_globals.h"
|
||||
|
||||
#include "orte/mca/iof/iof.h"
|
||||
#include "orte/mca/iof/base/base.h"
|
||||
#include "orte/mca/iof/base/iof_base_setup.h"
|
||||
|
||||
int
|
||||
@ -152,11 +154,19 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
}
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if( orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
close(opts->p_stdout[1]);
|
||||
} else {
|
||||
if(opts->p_stdout[1] != fileno(stdout)) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stdout));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if( orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
ret = dup2(opts->p_stdout[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
close(opts->p_stdout[1]);
|
||||
}
|
||||
}
|
||||
@ -177,13 +187,16 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
if(opts->p_stderr[1] != fileno(stderr)) {
|
||||
ret = dup2(opts->p_stderr[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
if( !orte_iof_base.redirect_app_stderr_to_stdout ) {
|
||||
ret = dup2(opts->p_stderr[1], fileno(stderr));
|
||||
if (ret < 0) return ORTE_ERR_PIPE_SETUP_FAILURE;
|
||||
}
|
||||
close(opts->p_stderr[1]);
|
||||
}
|
||||
|
||||
if (!orte_map_stddiag_to_stderr) {
|
||||
if (!orte_map_stddiag_to_stderr && !orte_map_stddiag_to_stdout ) {
|
||||
/* Set an environment variable that the new child process can use
|
||||
to get the fd of the pipe connected to the INTERNAL IOF tag. */
|
||||
asprintf(&str, "%d", opts->p_internal[1]);
|
||||
@ -192,6 +205,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts, char ***env)
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
else if( orte_map_stddiag_to_stdout ) {
|
||||
opal_setenv("OPAL_OUTPUT_INTERNAL_TO_STDOUT", "1", true, env);
|
||||
}
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1378,6 +1378,11 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
|
||||
opal_argv_append(argc, argv, "orte_map_stddiag_to_stderr");
|
||||
opal_argv_append(argc, argv, "1");
|
||||
}
|
||||
else if (orte_map_stddiag_to_stdout) {
|
||||
opal_argv_append(argc, argv, "-"OPAL_MCA_CMD_LINE_ID);
|
||||
opal_argv_append(argc, argv, "orte_map_stddiag_to_stdout");
|
||||
opal_argv_append(argc, argv, "1");
|
||||
}
|
||||
|
||||
/* the following is not an mca param */
|
||||
if (NULL != getenv("ORTE_TEST_ORTED_SUICIDE")) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -184,6 +185,7 @@ char **orte_forwarded_envars = NULL;
|
||||
|
||||
/* map stddiag output to stderr so it isn't forwarded to mpirun */
|
||||
bool orte_map_stddiag_to_stderr = false;
|
||||
bool orte_map_stddiag_to_stdout = false;
|
||||
|
||||
/* maximum size of virtual machine - used to subdivide allocation */
|
||||
int orte_max_vm_size = -1;
|
||||
|
@ -14,6 +14,7 @@
|
||||
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -564,6 +565,7 @@ ORTE_DECLSPEC extern char **orte_forwarded_envars;
|
||||
|
||||
/* map stddiag output to stderr so it isn't forwarded to mpirun */
|
||||
ORTE_DECLSPEC extern bool orte_map_stddiag_to_stderr;
|
||||
ORTE_DECLSPEC extern bool orte_map_stddiag_to_stdout;
|
||||
|
||||
/* maximum size of virtual machine - used to subdivide allocation */
|
||||
ORTE_DECLSPEC extern int orte_max_vm_size;
|
||||
|
@ -16,6 +16,7 @@
|
||||
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2017 IBM Corporation. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -545,6 +546,18 @@ int orte_register_params(void)
|
||||
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&orte_map_stddiag_to_stderr);
|
||||
|
||||
/* whether or not to map stddiag to stderr */
|
||||
orte_map_stddiag_to_stdout = false;
|
||||
(void) mca_base_var_register ("orte", "orte", NULL, "map_stddiag_to_stdout",
|
||||
"Map output from opal_output to stdout of the local process [default: no]",
|
||||
MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
||||
&orte_map_stddiag_to_stdout);
|
||||
if( orte_map_stddiag_to_stderr && orte_map_stddiag_to_stdout ) {
|
||||
opal_output(0, "The options \"orte_map_stddiag_to_stderr\" and \"orte_map_stddiag_to_stdout\" are mutually exclusive. They cannot both be set to true.");
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
/* generate new terminal windows to display output from specified ranks */
|
||||
orte_xterm = NULL;
|
||||
(void) mca_base_var_register ("orte", "orte", NULL, "xterm",
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user