mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[bugfix] Make sure MPI_FInalize is called before the return in main.
A correct MPI program should do that. As MPI_Finalize is part of the destructor of MainObject we need to make sure that it's destructor is called before the return statement. We do that manually by resetting the unique_ptr that we now use to store the MainObject,
This commit is contained in:
@@ -84,8 +84,11 @@ int flowEbosWaterOnlyMain(int argc, char** argv, bool outputCout, bool outputFil
|
||||
int flowEbosWaterOnlyMainStandalone(int argc, char** argv)
|
||||
{
|
||||
using TypeTag = Opm::Properties::TTag::EclFlowProblemWaterOnly;
|
||||
auto mainObject = Opm::Main(argc, argv);
|
||||
return mainObject.runStatic<TypeTag>();
|
||||
auto mainObject = std::make_unique<Opm::Main>(argc, argv);
|
||||
auto ret = mainObject->runStatic<TypeTag>();
|
||||
// Destruct mainObject as the destructor calls MPI_Finalize!
|
||||
mainObject.reset();
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user