Check if MPI is enabled

Exclude the reservoir coupling stuff if MPI is not enabled
This commit is contained in:
Håkon Hægland committed 2025-01-17 22:04:15 +01:00
1 parent 864b55f99b
commit d4855b08e1
1 file changed
+9
@@ -24,9 +24,14 @@
#include <opm/common/ErrorMacros.hpp>
#if HAVE_MPI
#include <opm/input/eclipse/Schedule/ResCoup/ReservoirCouplingInfo.hpp>
#include <opm/input/eclipse/Schedule/ResCoup/MasterGroup.hpp>
#include <opm/input/eclipse/Schedule/ResCoup/Slaves.hpp>
#include <opm/simulators/flow/ReservoirCouplingMaster.hpp>
#include <opm/simulators/flow/ReservoirCouplingSlave.hpp>
#endif
#include <opm/input/eclipse/Units/UnitSystem.hpp>
#include <opm/grid/utility/StopWatch.hpp>
@@ -199,6 +204,7 @@ public:
// NOTE: The argc and argv will be used when launching a slave process
void init(SimulatorTimer &timer, int argc, char** argv)
{
#if HAVE_MPI
auto slave_mode = Parameters::Get<Parameters::Slave>();
if (slave_mode) {
this->reservoirCouplingSlave_ =
@@ -222,6 +228,7 @@ public:
this->reservoirCouplingMaster_->spawnSlaveProcesses(argc, argv);
}
}
#endif
simulator_.setEpisodeIndex(-1);
// Create timers and file for writing timing info.
@@ -587,9 +594,11 @@ protected:
SimulatorConvergenceOutput convergence_output_;
#if HAVE_MPI
bool slaveMode_{false};
std::unique_ptr<ReservoirCouplingMaster> reservoirCouplingMaster_{nullptr};
std::unique_ptr<ReservoirCouplingSlave> reservoirCouplingSlave_{nullptr};
#endif
SimulatorSerializer serializer_;
};