|
23 | 23 | * Copyright (c) 2018-2021 Triad National Security, LLC. All rights
|
24 | 24 | * reserved.
|
25 | 25 | * Copyright (c) 2021 Nanook Consulting. All rights reserved.
|
| 26 | + * Copyright (c) 2022 IBM Corporation. All rights reserved. |
26 | 27 | * $COPYRIGHT$
|
27 | 28 | *
|
28 | 29 | * Additional copyrights may follow
|
@@ -102,6 +103,8 @@ bool ompi_ftmpi_enabled = false;
|
102 | 103 | #include "ompi/communicator/communicator.h"
|
103 | 104 | #endif /* OPAL_ENABLE_FT_MPI */
|
104 | 105 |
|
| 106 | +static int ompi_stream_buffering_mode = -1; |
| 107 | + |
105 | 108 | int ompi_mpi_register_params(void)
|
106 | 109 | {
|
107 | 110 | int value;
|
@@ -404,6 +407,33 @@ int ompi_mpi_register_params(void)
|
404 | 407 | MCA_BASE_VAR_SCOPE_READONLY,
|
405 | 408 | &ompi_enable_timing);
|
406 | 409 |
|
| 410 | + /* |
| 411 | + * stdout/stderr buffering |
| 412 | + * If the user requested to override the default setting then do |
| 413 | + * as they wish. |
| 414 | + */ |
| 415 | + (void) mca_base_var_register("ompi", "ompi", NULL, "stream_buffering", |
| 416 | + "Adjust buffering for stdout/stderr. " |
| 417 | + "(0) unbuffered, (1) line buffered, (2) fully buffered.", |
| 418 | + MCA_BASE_VAR_TYPE_INT, |
| 419 | + NULL, 0, 0, |
| 420 | + OPAL_INFO_LVL_3, |
| 421 | + MCA_BASE_VAR_SCOPE_READONLY, |
| 422 | + &ompi_stream_buffering_mode); |
| 423 | + if(0 == ompi_stream_buffering_mode) { |
| 424 | + setvbuf(stdout, NULL, _IONBF, 0); |
| 425 | + setvbuf(stderr, NULL, _IONBF, 0); |
| 426 | + } |
| 427 | + else if(1 == ompi_stream_buffering_mode) { |
| 428 | + setvbuf(stdout, NULL, _IOLBF, 0); |
| 429 | + setvbuf(stderr, NULL, _IOLBF, 0); |
| 430 | + } |
| 431 | + else if(2 == ompi_stream_buffering_mode) { |
| 432 | + setvbuf(stdout, NULL, _IOFBF, 0); |
| 433 | + setvbuf(stderr, NULL, _IOFBF, 0); |
| 434 | + } |
| 435 | + |
| 436 | + |
407 | 437 | #if OPAL_ENABLE_FT_MPI
|
408 | 438 | /* Before loading any other part of the MPI library, we need to load
|
409 | 439 | * * the ft-mpi tune file to override default component selection when
|
|
0 commit comments