Create an MCA parameter (ess_base_stream_buffering) that allows the user to override the system default for buffering of stdout/stderr streams. See 'man setvbuf' for more information.
Note: I am working on a system that buffered all output until the application fishished due to a default of 'fully buffered.' This makes debugging painful. This switch fixed the problem by allowing me to adjust the buffering. This commit was SVN r26119.
Этот коммит содержится в:
родитель
4630c4060c
Коммит
4dd9f89a99
@ -10,6 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -56,6 +57,11 @@ ORTE_DECLSPEC int orte_ess_base_close(void);
|
||||
*/
|
||||
ORTE_DECLSPEC extern int orte_ess_base_output;
|
||||
|
||||
/*
|
||||
* stdout/stderr buffering control parameter
|
||||
*/
|
||||
ORTE_DECLSPEC extern int orte_ess_base_std_buffering;
|
||||
|
||||
ORTE_DECLSPEC extern opal_list_t orte_ess_base_components_available;
|
||||
|
||||
#if ORTE_ENABLE_EPOCH
|
||||
|
@ -10,6 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -51,10 +52,19 @@ orte_ess_base_module_t orte_ess = {
|
||||
NULL /* ft_event */
|
||||
};
|
||||
int orte_ess_base_output;
|
||||
int orte_ess_base_std_buffering = -1;
|
||||
|
||||
int
|
||||
orte_ess_base_open(void)
|
||||
{
|
||||
mca_base_param_reg_int_name("ess_base",
|
||||
"stream_buffering",
|
||||
"Adjust buffering for stdout/stderr "
|
||||
"[-1 system default] [0 unbuffered] [1 line buffered] [2 fully buffered] "
|
||||
"(Default: -1)",
|
||||
false, false,
|
||||
-1, &orte_ess_base_std_buffering);
|
||||
|
||||
orte_ess_base_output = opal_output_open(NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&orte_ess_base_components_available, opal_list_t);
|
||||
|
@ -9,7 +9,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010-2011 Oak Ridge National Labs. All rights reserved.
|
||||
* Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -65,6 +65,26 @@ int orte_ess_base_app_setup(void)
|
||||
int ret;
|
||||
char *error = NULL;
|
||||
|
||||
/*
|
||||
* stdout/stderr buffering
|
||||
* If the user requested to override the default setting then do
|
||||
* as they wish.
|
||||
*/
|
||||
if( orte_ess_base_std_buffering > -1 ) {
|
||||
if( 0 == orte_ess_base_std_buffering ) {
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
}
|
||||
else if( 1 == orte_ess_base_std_buffering ) {
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
setvbuf(stderr, NULL, _IOLBF, 0);
|
||||
}
|
||||
else if( 2 == orte_ess_base_std_buffering ) {
|
||||
setvbuf(stdout, NULL, _IOFBF, 0);
|
||||
setvbuf(stderr, NULL, _IOFBF, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* open the errmgr */
|
||||
if (ORTE_SUCCESS != (ret = orte_errmgr_base_open())) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user