mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add collective communication to generic vanguard
This commit is contained in:
@@ -98,11 +98,6 @@ namespace Opm {
|
||||
// with incorrect locale settings.
|
||||
resetLocale();
|
||||
|
||||
# if HAVE_DUNE_FEM
|
||||
Dune::Fem::MPIManager::initialize(argc, argv);
|
||||
# else
|
||||
Dune::MPIHelper::instance(argc, argv);
|
||||
# endif
|
||||
FlowMainEbos<TypeTag> mainfunc(argc, argv, outputCout, outputFiles);
|
||||
return mainfunc.execute();
|
||||
}
|
||||
@@ -152,6 +147,14 @@ namespace Opm
|
||||
{
|
||||
}
|
||||
|
||||
~Main()
|
||||
{
|
||||
#if HAVE_MPI && !HAVE_DUNE_FEM
|
||||
EclGenericVanguard::setCommunication(nullptr);
|
||||
MPI_Finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
int runDynamic()
|
||||
{
|
||||
int exitCode = EXIT_SUCCESS;
|
||||
@@ -361,12 +364,11 @@ namespace Opm
|
||||
Dune::Fem::MPIManager::initialize(argc_, argv_);
|
||||
int mpiRank = Dune::Fem::MPIManager::rank();
|
||||
#else
|
||||
// the design of the plain dune MPIHelper class is quite flawed: there is no way to
|
||||
// get the instance without having the argc and argv parameters available and it is
|
||||
// not possible to determine the MPI rank and size without an instance. (IOW: the
|
||||
// rank() and size() methods are supposed to be static.)
|
||||
const auto& mpiHelper = Dune::MPIHelper::instance(argc_, argv_);
|
||||
int mpiRank = mpiHelper.rank();
|
||||
#if HAVE_MPI
|
||||
MPI_Init(&argc_, &argv_);
|
||||
#endif
|
||||
EclGenericVanguard::setCommunication(std::make_unique<EclGenericVanguard::CommunicationType>());
|
||||
int mpiRank = EclGenericVanguard::comm().rank();
|
||||
#endif
|
||||
|
||||
// we always want to use the default locale, and thus spare us the trouble
|
||||
|
||||
Reference in New Issue
Block a user