Prevent multiple *.?.dbg/prt files in production crashed parallel runs.

There was a fallout when skipping concating these files to the
default ones (PR #1708). We should also have deactivated creating
these files at all. As a result these files appeared in all parallel
runs that were aborted.

This change now prevents creating and logging to these files in
parallel in a default
run (--enable-parallel-logging-fallout-warning=false).

Developers can still activate logging and concating to see whether
everything is only logged on the io process by passing
--enable-parallel-logging-fallout-warning=true.

Closes 3725
This commit is contained in:
Markus Blatt 2022-01-27 17:00:39 +01:00
parent 1322722c9d
commit 710d648eda
3 changed files with 12 additions and 3 deletions

View File

@ -440,11 +440,14 @@ private:
const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart); const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart);
if (outputDir.empty()) if (outputDir.empty())
outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir); outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir);
const bool allRanksDbgPrtLog = EWOMS_GET_PARAM(PreTypeTag, bool,
EnableLoggingFalloutWarning);
outputMode = setupLogging(mpiRank, outputMode = setupLogging(mpiRank,
deckFilename, deckFilename,
outputDir, outputDir,
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode), EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
outputCout_, "STDOUT_LOGGER"); outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
auto parseContext = auto parseContext =
std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputError::Action>> std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputError::Action>>
{{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE}, {{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE},

View File

@ -343,7 +343,8 @@ Opm::setupLogging(const int mpi_rank_,
const std::string& cmdline_output_dir, const std::string& cmdline_output_dir,
const std::string& cmdline_output, const std::string& cmdline_output,
const bool output_cout_, const bool output_cout_,
const std::string& stdout_log_id) const std::string& stdout_log_id,
const bool allRanksDbgLog)
{ {
if (!cmdline_output_dir.empty()) { if (!cmdline_output_dir.empty()) {
ensureOutputDirExists_(cmdline_output_dir); ensureOutputDirExists_(cmdline_output_dir);
@ -402,6 +403,10 @@ Opm::setupLogging(const int mpi_rank_,
std::cerr << "Value " << cmdline_output std::cerr << "Value " << cmdline_output
<< " is not a recognized output mode. Using \"all\" instead.\n"; << " is not a recognized output mode. Using \"all\" instead.\n";
} }
if (!allRanksDbgLog && mpi_rank_ != 0)
{
output = FileOutputMode::OUTPUT_NONE;
}
} }
if (output > FileOutputMode::OUTPUT_NONE) { if (output > FileOutputMode::OUTPUT_NONE) {

View File

@ -64,7 +64,8 @@ setupLogging(int mpi_rank_,
const std::string& cmdline_output_dir, const std::string& cmdline_output_dir,
const std::string& cmdline_output, const std::string& cmdline_output,
bool output_cout_, bool output_cout_,
const std::string& stdout_log_id); const std::string& stdout_log_id,
const bool allRanksDbgLog);
/// \brief Reads the deck and creates all necessary objects if needed /// \brief Reads the deck and creates all necessary objects if needed
/// ///