From 710d648eda3a71fe2c19a8f90e26a3b373cbea83 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 27 Jan 2022 17:00:39 +0100 Subject: [PATCH] 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 --- opm/simulators/flow/Main.hpp | 5 ++++- opm/simulators/utils/readDeck.cpp | 7 ++++++- opm/simulators/utils/readDeck.hpp | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/opm/simulators/flow/Main.hpp b/opm/simulators/flow/Main.hpp index 085c980d0..dec5706b6 100644 --- a/opm/simulators/flow/Main.hpp +++ b/opm/simulators/flow/Main.hpp @@ -440,11 +440,14 @@ private: const bool init_from_restart_file = !EWOMS_GET_PARAM(PreTypeTag, bool, SchedRestart); if (outputDir.empty()) outputDir = EWOMS_GET_PARAM(PreTypeTag, std::string, OutputDir); + + const bool allRanksDbgPrtLog = EWOMS_GET_PARAM(PreTypeTag, bool, + EnableLoggingFalloutWarning); outputMode = setupLogging(mpiRank, deckFilename, outputDir, EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode), - outputCout_, "STDOUT_LOGGER"); + outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog); auto parseContext = std::make_unique(std::vector> {{ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE}, diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index 56871c88e..e48e5685a 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -343,7 +343,8 @@ Opm::setupLogging(const int mpi_rank_, const std::string& cmdline_output_dir, const std::string& cmdline_output, const bool output_cout_, - const std::string& stdout_log_id) + const std::string& stdout_log_id, + const bool allRanksDbgLog) { if (!cmdline_output_dir.empty()) { ensureOutputDirExists_(cmdline_output_dir); @@ -402,6 +403,10 @@ Opm::setupLogging(const int mpi_rank_, std::cerr << "Value " << cmdline_output << " is not a recognized output mode. Using \"all\" instead.\n"; } + if (!allRanksDbgLog && mpi_rank_ != 0) + { + output = FileOutputMode::OUTPUT_NONE; + } } if (output > FileOutputMode::OUTPUT_NONE) { diff --git a/opm/simulators/utils/readDeck.hpp b/opm/simulators/utils/readDeck.hpp index 4cf9786b9..850843b5e 100644 --- a/opm/simulators/utils/readDeck.hpp +++ b/opm/simulators/utils/readDeck.hpp @@ -64,7 +64,8 @@ setupLogging(int mpi_rank_, const std::string& cmdline_output_dir, const std::string& cmdline_output, 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 ///