Only print usage information on one processes.

No matter whether requested via --help or printed due to a wrong
command line parameter.

Closes #2012.
This commit is contained in:
Markus Blatt
2019-10-29 17:00:24 +01:00
parent b3141133e3
commit 10db57f66b
2 changed files with 14 additions and 8 deletions

View File

@@ -329,8 +329,14 @@ int mainFlow(int argc, char** argv)
deckFilename = PreVanguard::canonicalDeckPath(deckFilename).string();
}
catch (const std::exception& e) {
Opm::Parameters::printUsage<PreTypeTag>(PreProblem::helpPreamble(argc, const_cast<const char**>(argv)),
e.what());
if (mpiRank == 0)
{
Opm::Parameters::printUsage<PreTypeTag>(PreProblem::helpPreamble(argc, const_cast<const char**>(argv)),
e.what());
}
#if HAVE_MPI
MPI_Finalize();
#endif
return 1;
}

View File

@@ -142,15 +142,15 @@ namespace Opm
EWOMS_END_PARAM_REGISTRATION(TypeTag);
// read in the command line parameters
int status = Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(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_<TypeTag>(argc, const_cast<const char**>(argv), /*doRegistration=*/false, /*allowUnused=*/true, /*handleHelp=*/(mpiRank==0));
if (status == 0) {
// deal with unknown parameters.
int unknownKeyWords = 0;