From 41853c26220600faacfc9e74c2e5a81395f10fa2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 9 Jan 2020 11:08:12 +0100 Subject: [PATCH 01/17] fixed: we have to reconstruct the exact pointer map for these we cannot just deserialize as new entities --- opm/simulators/utils/ParallelRestart.cpp | 215 +++++++++++++++++++---- 1 file changed, 179 insertions(+), 36 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 76795e979..9e28e2ab0 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -102,6 +102,146 @@ unpack(data, buffer, position, comm, std::integral_constant()); \ } +namespace +{ +template class Map, class Type, class Key> +std::pair, std::vector>>> +splitDynMap(const Map>& map) +{ + // we have to pack the unique ptrs separately, and use an index map + // to allow reconstructing the appropriate structures. + std::vector>> asMap; + std::vector unique; + for (const auto& it : map) { + for (const auto& w : it.second.data()) { + if (std::find(unique.begin(), unique.end(), w) == unique.end()) + unique.push_back(w); + } + } + for (const auto& it : map) { + std::vector idxVec; + idxVec.reserve(it.second.size()+1); + for (const auto& w : it.second.data()) { + auto uIt = std::find(unique.begin(), unique.end(), w); + idxVec.push_back(uIt-unique.begin()); + } + idxVec.push_back(it.second.initialRange()); + asMap.push_back(std::make_pair(it.first, idxVec)); + } + + return std::make_pair(unique, asMap); +} + +template +std::pair, std::vector> +splitDynState(const Opm::DynamicState& state) +{ + std::vector unique; + for (const auto& w : state.data()) { + if (std::find(unique.begin(), unique.end(), w) == unique.end()) + unique.push_back(w); + } + std::vector idxVec; + idxVec.reserve(state.data().size()+1); + for (const auto& w : state.data()) { + auto uIt = std::find(unique.begin(), unique.end(), w); + idxVec.push_back(uIt-unique.begin()); + } + idxVec.push_back(state.initialRange()); + + return std::make_pair(unique, idxVec); +} + +template +void reconstructDynState(const std::vector& unique, + const std::vector& idxVec, + Opm::DynamicState& result) +{ + std::vector ptrData; + for (size_t i = 0; i < idxVec.size()-1; ++i) { + ptrData.push_back(unique[idxVec[i]]); + } + result = Opm::DynamicState(ptrData, idxVec.back()); +} + +template class Map, class Type, class Key> +void reconstructDynMap(const std::vector& unique, + const std::vector>>& asMap, + Map>& result) +{ + for (const auto& it : asMap) { + reconstructDynState(unique, it.second, result[it.first]); + } +} + +template class Map, class Type, class Key> +std::size_t packSizeDynMap(const Map>& data, + Dune::MPIHelper::MPICommunicator comm) +{ + auto split = splitDynMap(data); + return Opm::Mpi::packSize(split.first, comm) + + Opm::Mpi::packSize(split.second, comm); +} + +template +std::size_t packSizeDynState(const Opm::DynamicState& data, + Dune::MPIHelper::MPICommunicator comm) +{ + auto split = splitDynState(data); + return Opm::Mpi::packSize(split.first, comm) + + Opm::Mpi::packSize(split.second, comm); +} + +template +void packDynState(const Opm::DynamicState& data, + std::vector& buffer, + int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + auto split = splitDynState(data); + Opm::Mpi::pack(split.first, buffer, position, comm); + Opm::Mpi::pack(split.second, buffer, position, comm); +} + +template class Map, class Type, class Key> +void packDynMap(const Map>& data, + std::vector& buffer, + int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + auto split = splitDynMap(data); + Opm::Mpi::pack(split.first, buffer, position, comm); + Opm::Mpi::pack(split.second, buffer, position, comm); +} + +template +void unpackDynState(Opm::DynamicState& data, + std::vector& buffer, + int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector unique; + std::vector indices; + Opm::Mpi::unpack(unique, buffer, position, comm); + Opm::Mpi::unpack(indices, buffer, position, comm); + reconstructDynState(unique, indices, data); +} + +template class Map, class Type, class Key> +void unpackDynMap(Map>& data, + std::vector& buffer, + int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector unique; + std::vector>> indices; + Opm::Mpi::unpack(unique, buffer, position, comm); + Opm::Mpi::unpack(indices, buffer, position, comm); + reconstructDynMap(unique, indices, data); +} + +} + namespace Opm { namespace Mpi @@ -1654,29 +1794,31 @@ std::size_t packSize(const Action::Actions& data, return packSize(data.getActions(), comm); } +template using Map2 = std::map; + std::size_t packSize(const Schedule& data, Dune::MPIHelper::MPICommunicator comm) { return packSize(data.getTimeMap(), comm) + - packSize(data.getStaticWells(), comm) + - packSize(data.getGroups(), comm) + + packSizeDynMap(data.getStaticWells(), comm) + + packSizeDynMap(data.getGroups(), comm) + packSize(data.getOilVapProps(), comm) + packSize(data.getEvents(), comm) + packSize(data.getModifierDeck(), comm) + packSize(data.getTuning(), comm) + packSize(data.getMessageLimits(), comm) + packSize(data.getRunspec(), comm) + - packSize(data.getVFPProdTables(), comm) + - packSize(data.getVFPInjTables(), comm) + - packSize(data.getWellTestConfig(), comm) + - packSize(data.getWListManager(), comm) + - packSize(data.getUDQConfig(), comm) + - packSize(data.getUDQActive(), comm) + - packSize(data.getGuideRateConfig(), comm) + - packSize(data.getGConSale(), comm) + - packSize(data.getGConSump(), comm) + + packSizeDynMap(data.getVFPProdTables(), comm) + + packSizeDynMap(data.getVFPInjTables(), comm) + + packSizeDynState(data.getWellTestConfig(), comm) + + packSizeDynState(data.getWListManager(), comm) + + packSizeDynState(data.getUDQConfig(), comm) + + packSizeDynState(data.getUDQActive(), comm) + + packSizeDynState(data.getGuideRateConfig(), comm) + + packSizeDynState(data.getGConSale(), comm) + + packSizeDynState(data.getGConSump(), comm) + packSize(data.getGlobalWhistCtlMode(), comm) + - packSize(data.getActions(), comm) + + packSizeDynState(data.getActions(), comm) + packSize(data.rftConfig(), comm) + packSize(data.getNupCol(), comm) + packSize(data.getWellGroupEvents(), comm); @@ -3395,25 +3537,25 @@ void pack(const Schedule& data, Dune::MPIHelper::MPICommunicator comm) { pack(data.getTimeMap(), buffer, position, comm); - pack(data.getStaticWells(), buffer, position, comm); - pack(data.getGroups(), buffer, position, comm); + packDynMap(data.getStaticWells(), buffer, position, comm); + packDynMap(data.getGroups(), buffer, position, comm); pack(data.getOilVapProps(), buffer, position, comm); pack(data.getEvents(), buffer, position, comm); pack(data.getModifierDeck(), buffer, position, comm); pack(data.getTuning(), buffer, position, comm); pack(data.getMessageLimits(), buffer, position, comm); pack(data.getRunspec(), buffer, position, comm); - pack(data.getVFPProdTables(), buffer, position, comm); - pack(data.getVFPInjTables(), buffer, position, comm); - pack(data.getWellTestConfig(), buffer, position, comm); - pack(data.getWListManager(), buffer, position, comm); - pack(data.getUDQConfig(), buffer, position, comm); - pack(data.getUDQActive(), buffer, position, comm); - pack(data.getGuideRateConfig(), buffer, position, comm); - pack(data.getGConSale(), buffer, position, comm); - pack(data.getGConSump(), buffer, position, comm); + packDynMap(data.getVFPProdTables(), buffer, position, comm); + packDynMap(data.getVFPInjTables(), buffer, position, comm); + packDynState(data.getWellTestConfig(), buffer, position, comm); + packDynState(data.getWListManager(), buffer, position, comm); + packDynState(data.getUDQConfig(), buffer, position, comm); + packDynState(data.getUDQActive(), buffer, position, comm); + packDynState(data.getGuideRateConfig(), buffer, position, comm); + packDynState(data.getGConSale(), buffer, position, comm); + packDynState(data.getGConSump(), buffer, position, comm); pack(data.getGlobalWhistCtlMode(), buffer, position, comm); - pack(data.getActions(), buffer, position, comm); + packDynState(data.getActions(), buffer, position, comm); pack(data.rftConfig(), buffer, position, comm); pack(data.getNupCol(), buffer, position, comm); pack(data.getWellGroupEvents(), buffer, position, comm); @@ -5872,25 +6014,26 @@ void unpack(Schedule& data, std::vector& buffer, int& position, std::map wellGroupEvents; unpack(timeMap, buffer, position, comm); - unpack(staticWells, buffer, position, comm); - unpack(groups, buffer, position, comm); + unpackDynMap(staticWells, buffer, position, comm); + unpackDynMap(groups, buffer, position, comm); unpack(oilVapProps, buffer, position, comm); unpack(events, buffer, position, comm); unpack(modifierDeck, buffer, position, comm); unpack(tuning, buffer, position, comm); unpack(messageLimits, buffer, position, comm); unpack(runspec, buffer, position, comm); - unpack(vfpProdTables, buffer, position, comm); - unpack(vfpInjTables, buffer, position, comm); - unpack(wellTestConfig, buffer, position, comm); - unpack(wListManager, buffer, position, comm); - unpack(udqConfig, buffer, position, comm); - unpack(udqActive, buffer, position, comm); - unpack(guideRateConfig, buffer, position, comm); - unpack(gconSale, buffer, position, comm); - unpack(gconSump, buffer, position, comm); + unpackDynMap(vfpProdTables, buffer, position, comm); + unpackDynMap(vfpInjTables, buffer, position, comm); + unpackDynState(wellTestConfig, buffer, position, comm); + unpackDynState(wListManager, buffer, position, comm); + unpackDynState(udqConfig, buffer, position, comm); + unpackDynState(udqActive, buffer, position, comm); + unpackDynState(guideRateConfig, buffer, position, comm); + unpackDynState(gconSale, buffer, position, comm); + unpackDynState(gconSump, buffer, position, comm); unpack(globalWhistCtlMode, buffer, position, comm); - unpack(actions, buffer, position, comm); + unpackDynState(actions, buffer, position, comm); + unpack(rftConfig, buffer, position, comm); unpack(nupCol, buffer, position, comm); unpack(wellGroupEvents, buffer, position, comm); From c463bcc54a057ecb52af1346080f562c907cf18d Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 9 Jan 2020 11:14:06 +0100 Subject: [PATCH 02/17] fixed: disable sanity check when reconstructing Dimension --- opm/simulators/utils/ParallelRestart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 9e28e2ab0..47d69f399 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -5271,7 +5271,7 @@ void unpack(Dimension& data, unpack(name, buffer, position, comm); unpack(siScaling, buffer, position, comm); unpack(siOffset, buffer, position, comm); - data = Dimension(name, siScaling, siOffset); + data = Dimension(name, siScaling, siOffset, false); } void unpack(UnitSystem& data, From 2a2379dce95351ed9fb55c7ad6a586ef3ad2f2ed Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:55:20 +0100 Subject: [PATCH 03/17] update serialization for UDAValue due to new dim member --- opm/simulators/utils/ParallelRestart.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 47d69f399..77c7861db 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1169,7 +1169,8 @@ std::size_t packSize(const WellTracerProperties& data, std::size_t packSize(const UDAValue& data, Dune::MPIHelper::MPICommunicator comm) { - return packSize(data.is(), comm) + + return packSize(data.get_dim(), comm) + + packSize(data.is(), comm) + (data.is() ? packSize(data.get(), comm) : packSize(data.get(), comm)); } @@ -2866,6 +2867,7 @@ void pack(const UDAValue& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) { + pack(data.get_dim(), buffer, position, comm); pack(data.is(), buffer, position, comm); if (data.is()) pack(data.get(), buffer, position, comm); @@ -4974,15 +4976,17 @@ void unpack(UDAValue& data, Dune::MPIHelper::MPICommunicator comm) { bool isDouble; + Dimension dim; + unpack(dim, buffer, position, comm); unpack(isDouble, buffer, position, comm); if (isDouble) { double val; unpack(val, buffer, position, comm); - data = UDAValue(val); + data = UDAValue(val, dim); } else { std::string val; unpack(val, buffer, position, comm); - data = UDAValue(val); + data = UDAValue(val, dim); } } From b2b398e217d3f10ad01fa61c24a7863d78e8df5e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:56:10 +0100 Subject: [PATCH 04/17] fixed: missing Kind in Connection serialization --- opm/simulators/utils/ParallelRestart.cpp | 7 ++++++- tests/test_ParallelRestart.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 77c7861db..ab7b47db3 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1191,6 +1191,7 @@ std::size_t packSize(const Connection& data, packSize(data.getI(), comm) + packSize(data.getJ(), comm) + packSize(data.getK(), comm) + + packSize(data.kind(), comm) + packSize(data.getSeqIndex(), comm) + packSize(data.getSegDistStart(), comm) + packSize(data.getSegDistEnd(), comm) + @@ -2892,6 +2893,7 @@ void pack(const Connection& data, pack(data.getI(), buffer, position, comm); pack(data.getJ(), buffer, position, comm); pack(data.getK(), buffer, position, comm); + pack(data.kind(), buffer, position, comm); pack(data.getSeqIndex(), buffer, position, comm); pack(data.getSegDistStart(), buffer, position, comm); pack(data.getSegDistEnd(), buffer, position, comm); @@ -5006,6 +5008,8 @@ void unpack(Connection& data, size_t compSegSeqIndex; int segment; double wellPi; + Connection::CTFKind kind; + unpack(dir, buffer, position, comm); unpack(depth, buffer, position, comm); unpack(state, buffer, position, comm); @@ -5019,6 +5023,7 @@ void unpack(Connection& data, unpack(I, buffer, position, comm); unpack(J, buffer, position, comm); unpack(K, buffer, position, comm); + unpack(kind, buffer, position, comm); unpack(seqIndex, buffer, position, comm); unpack(segDistStart, buffer, position, comm); unpack(segDistEnd, buffer, position, comm); @@ -5029,7 +5034,7 @@ void unpack(Connection& data, data = Connection(dir, depth, state, satTableId, complnum, CF, Kh, rw, r0, - skinFactor, {I,J,K}, seqIndex, + skinFactor, {I,J,K}, kind, seqIndex, segDistStart, segDistEnd, defaultSatTabId, compSegSeqIndex, segment, wellPi); diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 86c147988..8eb38cc57 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1564,7 +1564,8 @@ BOOST_AUTO_TEST_CASE(Connection) Opm::Connection val1(Opm::Connection::Direction::Y, 1.0, Opm::Connection::State::SHUT, 2, 3, 4.0, 5.0, 6.0, 7.0, 8.0, - {9, 10, 11}, 12, 13.0, 14.0, true, + {9, 10, 11}, Opm::Connection::CTFKind::Defaulted, + 12, 13.0, 14.0, true, 15, 16, 17.0); auto val2 = PackUnpack(val1); BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2)); @@ -1629,7 +1630,8 @@ BOOST_AUTO_TEST_CASE(WellConnections) Opm::Connection conn(Opm::Connection::Direction::Y, 1.0, Opm::Connection::State::SHUT, 2, 3, 4.0, 5.0, 6.0, 7.0, 8.0, - {9, 10, 11}, 12, 13.0, 14.0, true, + {9, 10, 11}, Opm::Connection::CTFKind::Defaulted, + 12, 13.0, 14.0, true, 15, 16, 17.0); Opm::WellConnections val1(1, 2, 3, {conn, conn}); auto val2 = PackUnpack(val1); From 6bf2f8e285b95ae73c520b2c207801da69810eb0 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:57:19 +0100 Subject: [PATCH 05/17] add missing Connection serialization in Well --- opm/simulators/utils/ParallelRestart.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index ab7b47db3..5e1d1f8c6 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1406,6 +1406,7 @@ std::size_t packSize(const Well& data, packSize(data.getPolymerProperties(), comm) + packSize(data.getBrineProperties(), comm) + packSize(data.getTracerProperties(), comm) + + packSize(data.getConnections(), comm) + packSize(data.getProductionProperties(), comm) + packSize(data.getInjectionProperties(), comm) + packSize(data.hasSegments(), comm); @@ -3114,6 +3115,7 @@ void pack(const Well& data, pack(data.getPolymerProperties(), buffer, position, comm); pack(data.getBrineProperties(), buffer, position, comm); pack(data.getTracerProperties(), buffer, position, comm); + pack(data.getConnections(), buffer, position, comm); pack(data.getProductionProperties(), buffer, position, comm); pack(data.getInjectionProperties(), buffer, position, comm); pack(data.hasSegments(), buffer, position, comm); @@ -5379,6 +5381,7 @@ void unpack(Well& data, unpack(*polymerProperties, buffer, position, comm); unpack(*brineProperties, buffer, position, comm); unpack(*tracerProperties, buffer, position, comm); + unpack(*connection, buffer, position, comm); unpack(*production, buffer, position, comm); unpack(*injection, buffer, position, comm); bool hasSegments; From 72b33edf81de651e69696c1bcd0b2db9ed76ff9e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 11:58:24 +0100 Subject: [PATCH 06/17] fixed: cannot simply deserialize the udq function table rather we simply create it based on the params as elsewhere. --- opm/simulators/utils/ParallelRestart.cpp | 4 +--- tests/test_ParallelRestart.cpp | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 5e1d1f8c6..bb66c1e1c 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1547,7 +1547,6 @@ std::size_t packSize(const UDQConfig& data, Dune::MPIHelper::MPICommunicator comm) { return packSize(data.params(), comm) + - packSize(data.function_table(), comm) + packSize(data.definitionMap(), comm) + packSize(data.assignmentMap(), comm) + packSize(data.unitsMap(), comm) + @@ -3267,7 +3266,6 @@ void pack(const UDQConfig& data, Dune::MPIHelper::MPICommunicator comm) { pack(data.params(), buffer, position, comm); - pack(data.function_table(), buffer, position, comm); pack(data.definitionMap(), buffer, position, comm); pack(data.assignmentMap(), buffer, position, comm); pack(data.unitsMap(), buffer, position, comm); @@ -5600,7 +5598,7 @@ void unpack(UDQConfig& data, std::map typeCount; unpack(params, buffer, position, comm); - unpack(function_table, buffer, position, comm); + function_table = UDQFunctionTable(params); unpack(definitionsMap, buffer, position, comm); unpack(assignmentsMap, buffer, position, comm); unpack(units, buffer, position, comm); diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 8eb38cc57..79d28be64 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -327,7 +327,6 @@ Opm::VFPProdTable getVFPProdTable() Opm::UDQConfig getUDQConfig() { Opm::UDQParams params(true, 1, 2.0, 3.0, 4.0); - Opm::UDQFunctionTable::FunctionMap map{{"test", std::make_shared()}}; std::shared_ptr n0; Opm::UDQASTNode n1(Opm::UDQVarType::NONE, Opm::UDQTokenType::error, @@ -343,7 +342,7 @@ Opm::UDQConfig getUDQConfig() omap.insert({"test9", Opm::UDQIndex(3, 4, Opm::UDQAction::ASSIGN, Opm::UDQVarType::WELL_VAR)}); return Opm::UDQConfig(params, - Opm::UDQFunctionTable(params, map), + Opm::UDQFunctionTable(params), {{"test1", def}, {"test2", def}}, {{"test3", ass}, {"test4", ass}}, {{"test5", "test6"}, {"test7", "test8"}}, From 64e943176b32a1ea69acd2f0de93c1d6d085e120 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 07/17] fixed: do not handle EquilRecord as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 55 +++++++++++++++++++++++- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index bb66c1e1c..470a4c637 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -448,7 +448,6 @@ HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(EclHysterConfig) HANDLE_AS_POD(Eqldims) -HANDLE_AS_POD(EquilRecord) HANDLE_AS_POD(FoamData) HANDLE_AS_POD(GuideRateConfig::GroupTarget); HANDLE_AS_POD(GuideRateConfig::WellTarget); @@ -1860,6 +1859,20 @@ std::size_t packSize(const SummaryConfig& data, packSize(data.getSmryKwds(), comm); } +std::size_t packSize(const EquilRecord& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.datumDepth(), comm) + + packSize(data.datumDepthPressure(), comm) + + packSize(data.waterOilContactDepth(), comm) + + packSize(data.waterOilContactCapillaryPressure(), comm) + + packSize(data.gasOilContactDepth(), comm) + + packSize(data.gasOilContactCapillaryPressure(), comm) + + packSize(data.liveOilInitConstantRs(), comm) + + packSize(data.wetGasInitConstantRv(), comm) + + packSize(data.initializationTargetAccuracy(), comm); +} + ////// pack routines template @@ -3602,8 +3615,21 @@ void pack(const SummaryConfig& data, pack(data.getShortKwds(), buffer, position, comm); pack(data.getSmryKwds(), buffer, position, comm); } - +void pack(const EquilRecord& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.datumDepth(), buffer, position, comm); + pack(data.datumDepthPressure(), buffer, position, comm); + pack(data.waterOilContactDepth(), buffer, position, comm); + pack(data.waterOilContactCapillaryPressure(), buffer, position, comm); + pack(data.gasOilContactDepth(), buffer, position, comm); + pack(data.gasOilContactCapillaryPressure(), buffer, position, comm); + pack(data.liveOilInitConstantRs(), buffer, position, comm); + pack(data.wetGasInitConstantRv(), buffer, position, comm); + pack(data.initializationTargetAccuracy(), buffer, position, comm); +} /// unpack routines @@ -6115,6 +6141,31 @@ void unpack(SummaryConfig& data, data = SummaryConfig(kwds, shortKwds, smryKwds); } +void unpack(EquilRecord& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + double datumDepth, datumDepthPressure, waterOilContactDepth; + double waterOilContactCapillaryPressure, gasOilContactDepth; + double gasOilContactCapillaryPressure; + bool liveOilInitConstantRs, wetGasInitConstantRv; + int initializationTargetAccuracy; + + unpack(datumDepth, buffer, position, comm); + unpack(datumDepthPressure, buffer, position, comm); + unpack(waterOilContactDepth, buffer, position, comm); + unpack(waterOilContactCapillaryPressure, buffer, position, comm); + unpack(gasOilContactDepth, buffer, position, comm); + unpack(gasOilContactCapillaryPressure, buffer, position, comm); + unpack(liveOilInitConstantRs, buffer, position, comm); + unpack(wetGasInitConstantRv, buffer, position, comm); + unpack(initializationTargetAccuracy, buffer, position, comm); + data = EquilRecord(datumDepth, datumDepthPressure, waterOilContactDepth, + waterOilContactCapillaryPressure, gasOilContactDepth, + gasOilContactCapillaryPressure, liveOilInitConstantRs, + wetGasInitConstantRv, initializationTargetAccuracy); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 1b81e43e7332ac56c6d44feb6483b1d22584ad3a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 08/17] fixed: do not handle FoamData as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 40 +++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 470a4c637..c5c910b72 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -448,7 +448,6 @@ HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(EclHysterConfig) HANDLE_AS_POD(Eqldims) -HANDLE_AS_POD(FoamData) HANDLE_AS_POD(GuideRateConfig::GroupTarget); HANDLE_AS_POD(GuideRateConfig::WellTarget); HANDLE_AS_POD(JFunc) @@ -1873,6 +1872,16 @@ std::size_t packSize(const EquilRecord& data, packSize(data.initializationTargetAccuracy(), comm); } +std::size_t packSize(const FoamData& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.referenceSurfactantConcentration(), comm) + + packSize(data.exponent(), comm) + + packSize(data.minimumSurfactantConcentration(), comm) + + packSize(data.allowDesorption(), comm) + + packSize(data.rockDensity(), comm); +} + ////// pack routines template @@ -3631,6 +3640,17 @@ void pack(const EquilRecord& data, pack(data.initializationTargetAccuracy(), buffer, position, comm); } +void pack(const FoamData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.referenceSurfactantConcentration(), buffer, position, comm); + pack(data.exponent(), buffer, position, comm); + pack(data.minimumSurfactantConcentration(), buffer, position, comm); + pack(data.allowDesorption(), buffer, position, comm); + pack(data.rockDensity(), buffer, position, comm); +} + /// unpack routines template @@ -6166,6 +6186,24 @@ void unpack(EquilRecord& data, wetGasInitConstantRv, initializationTargetAccuracy); } +void unpack(FoamData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + double referenceSurfactantConcentration, exponent; + double minimumSurfactantConcentration; + bool allowDesorption; + double rockDensity; + + unpack(referenceSurfactantConcentration, buffer, position, comm); + unpack(exponent, buffer, position, comm); + unpack(minimumSurfactantConcentration, buffer, position, comm); + unpack(allowDesorption, buffer, position, comm); + unpack(rockDensity, buffer, position, comm); + data = FoamData(referenceSurfactantConcentration, exponent, + minimumSurfactantConcentration, allowDesorption, rockDensity); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From b7d7ced43db9e420569b2ae981924ad7e601f1be Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 09/17] fixed: do not handle RestartSchedule as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index c5c910b72..cb6586575 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -455,7 +455,6 @@ HANDLE_AS_POD(MLimits) HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Regdims) -HANDLE_AS_POD(RestartSchedule) HANDLE_AS_POD(ROCKRecord) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) @@ -1882,6 +1881,16 @@ std::size_t packSize(const FoamData& data, packSize(data.rockDensity(), comm); } +std::size_t packSize(const RestartSchedule& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.timestep, comm) + + packSize(data.basic, comm) + + packSize(data.frequency, comm) + + packSize(data.rptsched_restart_set, comm) + + packSize(data.rptsched_restart, comm); +} + ////// pack routines template @@ -3651,6 +3660,17 @@ void pack(const FoamData& data, pack(data.rockDensity(), buffer, position, comm); } +void pack(const RestartSchedule& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.timestep, buffer, position, comm); + pack(data.basic, buffer, position, comm); + pack(data.frequency, buffer, position, comm); + pack(data.rptsched_restart_set, buffer, position, comm); + pack(data.rptsched_restart, buffer, position, comm); +} + /// unpack routines template @@ -6204,6 +6224,17 @@ void unpack(FoamData& data, minimumSurfactantConcentration, allowDesorption, rockDensity); } +void unpack(RestartSchedule& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.timestep, buffer, position, comm); + unpack(data.basic, buffer, position, comm); + unpack(data.frequency, buffer, position, comm); + unpack(data.rptsched_restart_set, buffer, position, comm); + unpack(data.rptsched_restart, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 720fd6663825c421eff8f34aa6b03b320e9c6b2c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 10/17] fixed: do not handle TimeMap::StepData as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 61 +++++++++++++++++++++++- opm/simulators/utils/ParallelRestart.hpp | 2 + 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index cb6586575..d128abfc5 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -457,7 +457,7 @@ HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Regdims) HANDLE_AS_POD(ROCKRecord) HANDLE_AS_POD(Tabdims) -HANDLE_AS_POD(TimeMap::StepData) +HANDLE_AS_POD(TimeStampUTC::YMD) HANDLE_AS_POD(VISCREFRecord) HANDLE_AS_POD(WATDENTRecord) HANDLE_AS_POD(Well::WellGuideRate) @@ -1891,6 +1891,23 @@ std::size_t packSize(const RestartSchedule& data, packSize(data.rptsched_restart, comm); } +std::size_t packSize(const TimeStampUTC& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.ymd(), comm) + + packSize(data.hour(), comm) + + packSize(data.minutes(), comm) + + packSize(data.seconds(), comm) + + packSize(data.microseconds(), comm); +} + +std::size_t packSize(const TimeMap::StepData& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.stepnumber, comm) + + packSize(data.timestamp, comm); +} + ////// pack routines template @@ -3671,6 +3688,25 @@ void pack(const RestartSchedule& data, pack(data.rptsched_restart, buffer, position, comm); } +void pack(const TimeStampUTC& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.ymd(), buffer, position, comm); + pack(data.hour(), buffer, position, comm); + pack(data.minutes(), buffer, position, comm); + pack(data.seconds(), buffer, position, comm); + pack(data.microseconds(), buffer, position, comm); +} + +void pack(const TimeMap::StepData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.stepnumber, buffer, position, comm); + pack(data.timestamp, buffer, position, comm); +} + /// unpack routines template @@ -6235,6 +6271,29 @@ void unpack(RestartSchedule& data, unpack(data.rptsched_restart, buffer, position, comm); } +void unpack(TimeStampUTC& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + TimeStampUTC::YMD ymd; + int hour, minutes, seconds, usec; + + unpack(ymd, buffer, position, comm); + unpack(hour, buffer, position, comm); + unpack(minutes, buffer, position, comm); + unpack(seconds, buffer, position, comm); + unpack(usec, buffer, position, comm); + data = TimeStampUTC(ymd, hour, minutes, seconds, usec); +} + +void unpack(TimeMap::StepData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.stepnumber, buffer, position, comm); + unpack(data.timestamp, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index f81590386..715a97911 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -136,6 +136,7 @@ class TableContainer; class TableManager; class TableSchema; class ThresholdPressure; +class TimeStampUTC; class Tuning; class UDAValue; class UDQASTNode; @@ -720,6 +721,7 @@ ADD_PACK_PROTOTYPES(TableSchema) ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) +ADD_PACK_PROTOTYPES(TimeStampUTC) ADD_PACK_PROTOTYPES(Tuning) ADD_PACK_PROTOTYPES(UDAValue) ADD_PACK_PROTOTYPES(UDQActive) From eca6108cbf26ca9a36c5eed5376c4c15a0340f7f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 11/17] fixed: do not handle EclHysterConfig as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 31 +++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index d128abfc5..f82a3e040 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -446,7 +446,6 @@ HANDLE_AS_POD(data::Connection) HANDLE_AS_POD(data::Rates) HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(DENSITYRecord) -HANDLE_AS_POD(EclHysterConfig) HANDLE_AS_POD(Eqldims) HANDLE_AS_POD(GuideRateConfig::GroupTarget); HANDLE_AS_POD(GuideRateConfig::WellTarget); @@ -1908,6 +1907,14 @@ std::size_t packSize(const TimeMap::StepData& data, packSize(data.timestamp, comm); } +std::size_t packSize(const EclHysterConfig& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.active(), comm) + + packSize(data.pcHysteresisModel(), comm) + + packSize(data.krHysteresisModel(), comm); +} + ////// pack routines template @@ -3707,6 +3714,15 @@ void pack(const TimeMap::StepData& data, pack(data.timestamp, buffer, position, comm); } +void pack(const EclHysterConfig& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.active(), buffer, position, comm); + pack(data.pcHysteresisModel(), buffer, position, comm); + pack(data.krHysteresisModel(), buffer, position, comm); +} + /// unpack routines template @@ -6294,6 +6310,19 @@ void unpack(TimeMap::StepData& data, unpack(data.timestamp, buffer, position, comm); } +void unpack(EclHysterConfig& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + bool active; + int pcHysteresisModel, krHysteresisModel; + + unpack(active, buffer, position, comm); + unpack(pcHysteresisModel, buffer, position, comm); + unpack(krHysteresisModel, buffer, position, comm); + data = EclHysterConfig(active, pcHysteresisModel, krHysteresisModel); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 486602ea9848578d5cd9a87d10eb647464bef35e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 12/17] fixed: do not handle JFunc as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 43 +++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index f82a3e040..6a8df618c 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -449,7 +449,6 @@ HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(Eqldims) HANDLE_AS_POD(GuideRateConfig::GroupTarget); HANDLE_AS_POD(GuideRateConfig::WellTarget); -HANDLE_AS_POD(JFunc) HANDLE_AS_POD(MLimits) HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) @@ -1915,6 +1914,17 @@ std::size_t packSize(const EclHysterConfig& data, packSize(data.krHysteresisModel(), comm); } +std::size_t packSize(const JFunc& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.flag(), comm) + + packSize(data.owSurfaceTension(), comm) + + packSize(data.goSurfaceTension(), comm) + + packSize(data.alphaFactor(), comm) + + packSize(data.betaFactor(), comm) + + packSize(data.direction(), comm); +} + ////// pack routines template @@ -3723,6 +3733,18 @@ void pack(const EclHysterConfig& data, pack(data.krHysteresisModel(), buffer, position, comm); } +void pack(const JFunc& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.flag(), buffer, position, comm); + pack(data.owSurfaceTension(), buffer, position, comm); + pack(data.goSurfaceTension(), buffer, position, comm); + pack(data.alphaFactor(), buffer, position, comm); + pack(data.betaFactor(), buffer, position, comm); + pack(data.direction(), buffer, position, comm); +} + /// unpack routines template @@ -6323,6 +6345,25 @@ void unpack(EclHysterConfig& data, data = EclHysterConfig(active, pcHysteresisModel, krHysteresisModel); } +void unpack(JFunc& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + JFunc::Flag flag; + double owSurfaceTension, goSurfaceTension; + double alphaFactor, betaFactor; + JFunc::Direction dir; + + unpack(flag, buffer, position, comm); + unpack(owSurfaceTension, buffer, position, comm); + unpack(goSurfaceTension, buffer, position, comm); + unpack(alphaFactor, buffer, position, comm); + unpack(betaFactor, buffer, position, comm); + unpack(dir, buffer, position, comm); + data = JFunc(flag, owSurfaceTension, goSurfaceTension, + alphaFactor, betaFactor, dir); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 8668ecaa644bfaa382d10baff4217b3f18422fd3 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 13/17] fixed: do not handle WellPolymerProperties as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 33 +++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 6a8df618c..926a03a64 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -462,7 +462,6 @@ HANDLE_AS_POD(Well::WellGuideRate) HANDLE_AS_POD(WellBrineProperties) HANDLE_AS_POD(Welldims) HANDLE_AS_POD(WellFoamProperties) -HANDLE_AS_POD(WellPolymerProperties) HANDLE_AS_POD(WellSegmentDims) std::size_t packSize(const data::Well& data, Dune::MPIHelper::MPICommunicator comm) @@ -1925,6 +1924,16 @@ std::size_t packSize(const JFunc& data, packSize(data.direction(), comm); } +std::size_t packSize(const WellPolymerProperties& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.m_polymerConcentration, comm) + + packSize(data.m_saltConcentration, comm) + + packSize(data.m_plymwinjtable, comm) + + packSize(data.m_skprwattable, comm) + + packSize(data.m_skprpolytable, comm); +} + ////// pack routines template @@ -3745,6 +3754,17 @@ void pack(const JFunc& data, pack(data.direction(), buffer, position, comm); } +void pack(const WellPolymerProperties& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.m_polymerConcentration, buffer, position, comm); + pack(data.m_saltConcentration, buffer, position, comm); + pack(data.m_plymwinjtable, buffer, position, comm); + pack(data.m_skprwattable, buffer, position, comm); + pack(data.m_skprpolytable, buffer, position, comm); +} + /// unpack routines template @@ -6364,6 +6384,17 @@ void unpack(JFunc& data, alphaFactor, betaFactor, dir); } +void unpack(WellPolymerProperties& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.m_polymerConcentration, buffer, position, comm); + unpack(data.m_saltConcentration, buffer, position, comm); + unpack(data.m_plymwinjtable, buffer, position, comm); + unpack(data.m_skprwattable, buffer, position, comm); + unpack(data.m_skprpolytable, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 4d0bf970fd5d1a255e45d8a043a6d4195aff5fc2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 14/17] fixed: do not handle Well::WellGuideRate as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 30 +++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 926a03a64..381aa0677 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -458,7 +458,6 @@ HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeStampUTC::YMD) HANDLE_AS_POD(VISCREFRecord) HANDLE_AS_POD(WATDENTRecord) -HANDLE_AS_POD(Well::WellGuideRate) HANDLE_AS_POD(WellBrineProperties) HANDLE_AS_POD(Welldims) HANDLE_AS_POD(WellFoamProperties) @@ -1934,6 +1933,15 @@ std::size_t packSize(const WellPolymerProperties& data, packSize(data.m_skprpolytable, comm); } +std::size_t packSize(const Well::WellGuideRate& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.available, comm) + + packSize(data.guide_rate, comm) + + packSize(data.guide_phase, comm) + + packSize(data.scale_factor, comm); +} + ////// pack routines template @@ -3765,6 +3773,16 @@ void pack(const WellPolymerProperties& data, pack(data.m_skprpolytable, buffer, position, comm); } +void pack(const Well::WellGuideRate& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.available, buffer, position, comm); + pack(data.guide_rate, buffer, position, comm); + pack(data.guide_phase, buffer, position, comm); + pack(data.scale_factor, buffer, position, comm); +} + /// unpack routines template @@ -6395,6 +6413,16 @@ void unpack(WellPolymerProperties& data, unpack(data.m_skprpolytable, buffer, position, comm); } +void unpack(Well::WellGuideRate& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.available, buffer, position, comm); + unpack(data.guide_rate, buffer, position, comm); + unpack(data.guide_phase, buffer, position, comm); + unpack(data.scale_factor, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 446af27a42e4f5a08eabc7ffca722458b51ff3f5 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 15/17] fixed: do not handle GuideRateConfig::WellTarget as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 27 +++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 381aa0677..577065c7a 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -448,7 +448,6 @@ HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(Eqldims) HANDLE_AS_POD(GuideRateConfig::GroupTarget); -HANDLE_AS_POD(GuideRateConfig::WellTarget); HANDLE_AS_POD(MLimits) HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) @@ -1942,6 +1941,14 @@ std::size_t packSize(const Well::WellGuideRate& data, packSize(data.scale_factor, comm); } +std::size_t packSize(const GuideRateConfig::WellTarget& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.guide_rate, comm) + + packSize(data.target, comm) + + packSize(data.scaling_factor, comm); +} + ////// pack routines template @@ -3783,6 +3790,15 @@ void pack(const Well::WellGuideRate& data, pack(data.scale_factor, buffer, position, comm); } +void pack(const GuideRateConfig::WellTarget& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.guide_rate, buffer, position, comm); + pack(data.target, buffer, position, comm); + pack(data.scaling_factor, buffer, position, comm); +} + /// unpack routines template @@ -6423,6 +6439,15 @@ void unpack(Well::WellGuideRate& data, unpack(data.scale_factor, buffer, position, comm); } +void unpack(GuideRateConfig::WellTarget& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.guide_rate, buffer, position, comm); + unpack(data.target, buffer, position, comm); + unpack(data.scaling_factor, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 1d68e377639280c659185e4ca1cfe52782124938 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH 16/17] fixed: do not handle GuideRateConfig::GroupTarget as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 577065c7a..4aec9ca06 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -447,7 +447,6 @@ HANDLE_AS_POD(data::Rates) HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(Eqldims) -HANDLE_AS_POD(GuideRateConfig::GroupTarget); HANDLE_AS_POD(MLimits) HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) @@ -1949,6 +1948,13 @@ std::size_t packSize(const GuideRateConfig::WellTarget& data, packSize(data.scaling_factor, comm); } +std::size_t packSize(const GuideRateConfig::GroupTarget& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.guide_rate, comm) + + packSize(data.target, comm); +} + ////// pack routines template @@ -3799,6 +3805,14 @@ void pack(const GuideRateConfig::WellTarget& data, pack(data.scaling_factor, buffer, position, comm); } +void pack(const GuideRateConfig::GroupTarget& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.guide_rate, buffer, position, comm); + pack(data.target, buffer, position, comm); +} + /// unpack routines template @@ -6448,6 +6462,14 @@ void unpack(GuideRateConfig::WellTarget& data, unpack(data.scaling_factor, buffer, position, comm); } +void unpack(GuideRateConfig::GroupTarget& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.guide_rate, buffer, position, comm); + unpack(data.target, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ From 3fca2ae631e4b047b8281eed21e11bc323fc1111 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 13 Jan 2020 12:01:14 +0100 Subject: [PATCH 17/17] changed: avoid using deck setting up schedule on non-root processes --- flow/flow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flow/flow.cpp b/flow/flow.cpp index ae363a392..72be2bae5 100644 --- a/flow/flow.cpp +++ b/flow/flow.cpp @@ -347,18 +347,21 @@ int main(int argc, char** argv) Opm::checkDeck(*deck, parser, parseContext, errorGuard); eclipseState.reset( new Opm::EclipseState(*deck, parseContext, errorGuard )); - schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard)); if (mpiRank == 0) { + schedule.reset(new Opm::Schedule(*deck, *eclipseState, parseContext, errorGuard)); setupMessageLimiter(schedule->getMessageLimits(), "STDOUT_LOGGER"); summaryConfig.reset( new Opm::SummaryConfig(*deck, *schedule, eclipseState->getTableManager(), parseContext, errorGuard)); #ifdef HAVE_MPI Opm::Mpi::packAndSend(*summaryConfig, mpiHelper.getCollectiveCommunication()); + Opm::Mpi::packAndSend(*schedule, mpiHelper.getCollectiveCommunication()); #endif } #ifdef HAVE_MPI else { summaryConfig.reset(new Opm::SummaryConfig); + schedule.reset(new Opm::Schedule); Opm::Mpi::receiveAndUnpack(*summaryConfig, mpiHelper.getCollectiveCommunication()); + Opm::Mpi::receiveAndUnpack(*schedule, mpiHelper.getCollectiveCommunication()); } #endif