From 757621e1994c4ceed2b77f3cf4cca64905b21c7c Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 18 Mar 2020 16:20:57 -0700 Subject: [PATCH] Re-enable stream buffering option Signed-off-by: Ralph Castain --- ompi/runtime/ompi_rte.c | 24 ++++++++++++++++++++++-- prrte | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ompi/runtime/ompi_rte.c b/ompi/runtime/ompi_rte.c index cc2bebddcb..66a2db21ed 100644 --- a/ompi/runtime/ompi_rte.c +++ b/ompi/runtime/ompi_rte.c @@ -497,7 +497,7 @@ int ompi_rte_init(int *pargc, char ***pargv) char *error = NULL; opal_process_name_t pname; pmix_proc_t rproc; - int u32, *u32ptr; + uint32_t u32, *u32ptr; uint16_t u16, *u16ptr; char **peers=NULL; char *ev1; @@ -727,7 +727,7 @@ int ompi_rte_init(int *pargc, char ***pargv) } /* retrieve proc-session directory info */ - OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_PROCDIR, &OPAL_PROC_MY_NAME, &val, OPAL_STRING); + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_PROCDIR, &OPAL_PROC_MY_NAME, &val, PMIX_STRING); if (OPAL_SUCCESS == rc && NULL != val) { pmix_process_info.proc_session_dir = val; } else { @@ -819,6 +819,26 @@ int ompi_rte_init(int *pargc, char ***pargv) opal_argv_free(peers); } + /* + * stdout/stderr buffering + * If the user requested to override the default setting then do + * as they wish. + */ + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, "OMPI_STREAM_BUFFERING", + &pmix_process_info.my_name, &u16ptr, PMIX_UINT16); + if (PMIX_SUCCESS == rc) { + if (0 == u16) { + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + } else if (1 == u16) { + setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stderr, NULL, _IOLBF, 0); + } else if (2 == u16 ) { + setvbuf(stdout, NULL, _IOFBF, 0); + setvbuf(stderr, NULL, _IOFBF, 0); + } + } + /* set the remaining opal_process_info fields. Note that * the OPAL layer will have initialized these to NULL, and * anyone between us would not have strdup'd the string, so diff --git a/prrte b/prrte index 581dec06fc..6a777040e3 160000 --- a/prrte +++ b/prrte @@ -1 +1 @@ -Subproject commit 581dec06fc808317831a2ea880a837692d17721b +Subproject commit 6a777040e377819062db1532db67d6ed0d2a005e