From 10db57f66b8fa3c3703b404931d99eb524a9cbfd Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Tue, 29 Oct 2019 17:00:24 +0100 Subject: [PATCH] Only print usage information on one processes. No matter whether requested via --help or printed due to a wrong command line parameter. Closes #2012. --- flow/flow_tag.hpp | 10 ++++++++-- opm/simulators/flow/FlowMainEbos.hpp | 12 ++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/flow/flow_tag.hpp b/flow/flow_tag.hpp index 6b238a29a..7773e3056 100644 --- a/flow/flow_tag.hpp +++ b/flow/flow_tag.hpp @@ -329,8 +329,14 @@ int mainFlow(int argc, char** argv) deckFilename = PreVanguard::canonicalDeckPath(deckFilename).string(); } catch (const std::exception& e) { - Opm::Parameters::printUsage(PreProblem::helpPreamble(argc, const_cast(argv)), - e.what()); + if (mpiRank == 0) + { + Opm::Parameters::printUsage(PreProblem::helpPreamble(argc, const_cast(argv)), + e.what()); + } +#if HAVE_MPI + MPI_Finalize(); +#endif return 1; } diff --git a/opm/simulators/flow/FlowMainEbos.hpp b/opm/simulators/flow/FlowMainEbos.hpp index 0acb23170..e23b1784d 100644 --- a/opm/simulators/flow/FlowMainEbos.hpp +++ b/opm/simulators/flow/FlowMainEbos.hpp @@ -142,15 +142,15 @@ namespace Opm EWOMS_END_PARAM_REGISTRATION(TypeTag); - // read in the command line parameters - int status = Opm::setupParameters_(argc, const_cast(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/true); - if (status == 0) { - - int mpiRank = 0; + int mpiRank = 0; #if HAVE_MPI - MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); + MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); #endif + // read in the command line parameters + int status = Opm::setupParameters_(argc, const_cast(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/(mpiRank==0)); + if (status == 0) { + // deal with unknown parameters. int unknownKeyWords = 0;