Skip to content

Commit b3f0bc5

Browse files
authored
Merge pull request #7544 from rhc54/topic/buf
Re-enable stream buffering option
2 parents 4bb13bc + 757621e commit b3f0bc5

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

ompi/runtime/ompi_rte.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
497497
char *error = NULL;
498498
opal_process_name_t pname;
499499
pmix_proc_t rproc;
500-
int u32, *u32ptr;
500+
uint32_t u32, *u32ptr;
501501
uint16_t u16, *u16ptr;
502502
char **peers=NULL;
503503
char *ev1;
@@ -727,7 +727,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
727727
}
728728

729729
/* retrieve proc-session directory info */
730-
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_PROCDIR, &OPAL_PROC_MY_NAME, &val, OPAL_STRING);
730+
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, PMIX_PROCDIR, &OPAL_PROC_MY_NAME, &val, PMIX_STRING);
731731
if (OPAL_SUCCESS == rc && NULL != val) {
732732
pmix_process_info.proc_session_dir = val;
733733
} else {
@@ -819,6 +819,26 @@ int ompi_rte_init(int *pargc, char ***pargv)
819819
opal_argv_free(peers);
820820
}
821821

822+
/*
823+
* stdout/stderr buffering
824+
* If the user requested to override the default setting then do
825+
* as they wish.
826+
*/
827+
OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, "OMPI_STREAM_BUFFERING",
828+
&pmix_process_info.my_name, &u16ptr, PMIX_UINT16);
829+
if (PMIX_SUCCESS == rc) {
830+
if (0 == u16) {
831+
setvbuf(stdout, NULL, _IONBF, 0);
832+
setvbuf(stderr, NULL, _IONBF, 0);
833+
} else if (1 == u16) {
834+
setvbuf(stdout, NULL, _IOLBF, 0);
835+
setvbuf(stderr, NULL, _IOLBF, 0);
836+
} else if (2 == u16 ) {
837+
setvbuf(stdout, NULL, _IOFBF, 0);
838+
setvbuf(stderr, NULL, _IOFBF, 0);
839+
}
840+
}
841+
822842
/* set the remaining opal_process_info fields. Note that
823843
* the OPAL layer will have initialized these to NULL, and
824844
* anyone between us would not have strdup'd the string, so

0 commit comments

Comments
 (0)