start: use actual rank

This commit is contained in:
Arne Morten Kvarving committed 2025-05-22 11:13:45 +02:00
1 parent cb511312b1
commit 2291ddb298
6 files changed
+19 -17

No files matched your search

+1 -1
View File
@@ -86,7 +86,7 @@ main(int argc, char** argv)
// At the moment, this is probably as optimal as can be.
// We only read the RUNSPEC of the Deck file to get the numComp,
// and for this we need to first read the CLI arguments.
Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), true, false, true);
Opm::setupParameters_<TypeTag>(argc, const_cast<const char**>(argv), true, false, true, 0);
auto inputFilename
= Opm::FlowGenericVanguard::canonicalDeckPath(Opm::Parameters::Get<Opm::Parameters::EclDeckFileName>());
+11 -12
View File
@@ -93,13 +93,11 @@ static inline int setupParameters_(int argc,
const char **argv,
bool registerParams,
bool allowUnused,
bool handleHelp)
bool handleHelp,
const int myRank)
{
using Problem = GetPropType<TypeTag, Properties::Problem>;
// first, get the MPI rank of the current process
int myRank = 0;
////////////////////////////////////////////////////////////
// Register all parameters
////////////////////////////////////////////////////////////
@@ -216,12 +214,20 @@ static inline int start(int argc, char **argv, bool registerParams)
int myRank = 0;
try
{
// initialize MPI, finalize is done automatically on exit
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
myRank = Dune::Fem::MPIManager::rank();
#else
myRank = Dune::MPIHelper::instance(argc, argv).rank();
#endif
const int paramStatus =
setupParameters_<TypeTag>(argc,
const_cast<const char**>(argv),
registerParams,
false,
true);
true,
myRank);
if (paramStatus == 1) {
return 1;
}
@@ -231,13 +237,6 @@ static inline int start(int argc, char **argv, bool registerParams)
TM::init();
// initialize MPI, finalize is done automatically on exit
#if HAVE_DUNE_FEM
Dune::Fem::MPIManager::initialize(argc, argv);
myRank = Dune::Fem::MPIManager::rank();
#else
myRank = Dune::MPIHelper::instance(argc, argv).rank();
#endif
// setting up backend for STDCOUT logger
if (myRank == 0) {
setupStreamLogging("STDOUT_LOGGER");
+2 -1
View File
@@ -120,7 +120,8 @@ namespace Opm {
const_cast<const char**>(argv),
/*doRegistration=*/false,
/*allowUnused=*/true,
/*handleHelp=*/(mpiRank==0));
/*handleHelp=*/(mpiRank==0),
mpiRank);
if (status == 0) {
// deal with unknown parameters.
+1 -1
View File
@@ -530,7 +530,7 @@ struct AquiferFixture {
AdaptiveTimeStepping<TT>::registerParameters();
BlackoilModelParameters<double>::registerParameters();
Parameters::Register<Parameters::EnableTerminalOutput>("Do *NOT* use!");
setupParameters_<TT>(2, argv, /*registerParams=*/true, false, true);
setupParameters_<TT>(2, argv, /*registerParams=*/true, false, true, 0);
Opm::FlowGenericVanguard::setCommunication(std::make_unique<Opm::Parallel::Communication>());
}
};
+2 -1
View File
@@ -126,7 +126,8 @@ initSimulator(const char *filename)
argv,
/*registerParams=*/false,
/*allowUnused*/false,
/*handleHelp*/true);
/*handleHelp*/true,
/*myRank*/0);
Opm::FlowGenericVanguard::readDeck(filename);
+2 -1
View File
@@ -96,7 +96,8 @@ initSimulator(const char *filename)
argv,
/*registerParams=*/false,
/*allowUnused*/false,
/*handleHelp*/true);
/*handleHelp*/true,
/*myRank*/0);
FlowGenericVanguard::readDeck(filename);
return std::make_unique<Simulator>();