From 5728d19018d75c7cb1a5bca7183e059cafcd70cb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 6 Mar 2020 11:47:02 +0100 Subject: [PATCH 1/2] remove unused serialization methods --- opm/simulators/utils/ParallelRestart.cpp | 105 ----------------------- opm/simulators/utils/ParallelRestart.hpp | 36 -------- tests/test_ParallelRestart.cpp | 40 --------- 3 files changed, 181 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index fcceba412..10fbd10ed 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -889,39 +889,10 @@ std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator packSize(data.rtemp(), comm); } -template -std::size_t packSize(const Tabulated1DFunction& data, - Dune::MPIHelper::MPICommunicator comm) -{ - return packSize(data.xValues(), comm) + - packSize(data.yValues(), comm); -} - -template -std::size_t packSize(const IntervalTabulated2DFunction& data, - Dune::MPIHelper::MPICommunicator comm) -{ - return packSize(data.xPos(), comm) + - packSize(data.yPos(), comm) + - packSize(data.samples(), comm) + - packSize(data.xExtrapolate(), comm) + - packSize(data.yExtrapolate(), comm); -} - template std::size_t packSize(const std::map& data, Dune::MPIHelper::MPICommunicator comm); -template -std::size_t packSize(const UniformXTabulated2DFunction& data, - Dune::MPIHelper::MPICommunicator comm) -{ - return packSize(data.xPos(), comm) + - packSize(data.yPos(), comm) + - packSize(data.samples(), comm) + - packSize(data.interpolationGuide(), comm); -} - template std::size_t packSize(const EclEpsScalingPointsInfo& data, Dune::MPIHelper::MPICommunicator comm) @@ -2543,35 +2514,6 @@ void pack(const TableManager& data, std::vector& buffer, int& position, pack(data.rtemp(), buffer, position, comm); } -template -void pack(const Tabulated1DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - pack(data.xValues(), buffer, position, comm); - pack(data.yValues(), buffer, position, comm); -} - -template -void pack(const IntervalTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - pack(data.xPos(), buffer, position, comm); - pack(data.yPos(), buffer, position, comm); - pack(data.samples(), buffer, position, comm); - pack(data.xExtrapolate(), buffer, position, comm); - pack(data.yExtrapolate(), buffer, position, comm); -} - -template -void pack(const UniformXTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - pack(data.xPos(), buffer, position, comm); - pack(data.yPos(), buffer, position, comm); - pack(data.samples(), buffer, position, comm); - pack(data.interpolationGuide(), buffer, position, comm); -} - void pack(const OilVaporizationProperties& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) @@ -4535,47 +4477,6 @@ void unpack(TableManager& data, std::vector& buffer, int& position, watDenT, stcond, gas_comp_index, rtemp); } -template -void unpack(Tabulated1DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - std::vector xValues, yValues; - unpack(xValues, buffer, position, comm); - unpack(yValues, buffer, position, comm); - data = Tabulated1DFunction(xValues, yValues, false); -} - -template -void unpack(IntervalTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - std::vector xPos, yPos; - std::vector> samples; - bool xExtrapolate, yExtrapolate; - unpack(xPos, buffer, position, comm); - unpack(yPos, buffer, position, comm); - unpack(samples, buffer, position, comm); - unpack(xExtrapolate, buffer, position, comm); - unpack(yExtrapolate, buffer, position, comm); - data = IntervalTabulated2DFunction(xPos, yPos, samples, - xExtrapolate, yExtrapolate); -} - -template -void unpack(UniformXTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm) -{ - std::vector xPos, yPos; - std::vector::SamplePoint>> samples; - typename UniformXTabulated2DFunction::InterpolationPolicy interpolationGuide; - unpack(xPos, buffer, position, comm); - unpack(yPos, buffer, position, comm); - unpack(samples, buffer, position, comm); - unpack(interpolationGuide, buffer, position, comm); - data = UniformXTabulated2DFunction(xPos, yPos, samples, - interpolationGuide); -} - void unpack(OilVaporizationProperties& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) @@ -6022,10 +5923,8 @@ INSTANTIATE_PACK_VECTOR(std::vector) INSTANTIATE_PACK_VECTOR(bool) INSTANTIATE_PACK_VECTOR(char) INSTANTIATE_PACK_VECTOR(int) -INSTANTIATE_PACK_VECTOR(Tabulated1DFunction) INSTANTIATE_PACK_VECTOR(std::array) INSTANTIATE_PACK_VECTOR(EclEpsScalingPointsInfo) -INSTANTIATE_PACK_VECTOR(IntervalTabulated2DFunction) #undef INSTANTIATE_PACK_VECTOR #define INSTANTIATE_PACK_SHARED_PTR(...) \ @@ -6061,10 +5960,6 @@ INSTANTIATE_PACK(unsigned char) INSTANTIATE_PACK(EclEpsScalingPointsInfo) INSTANTIATE_PACK(EclTwoPhaseApproach) INSTANTIATE_PACK(EclMultiplexerApproach) -INSTANTIATE_PACK(Tabulated1DFunction) -INSTANTIATE_PACK(IntervalTabulated2DFunction) -INSTANTIATE_PACK(UniformXTabulated2DFunction) -INSTANTIATE_PACK(std::map>) #undef INSTANTIATE_PACK } // end namespace Mpi diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 64e183bd5..e7506befc 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -23,9 +23,6 @@ #include #endif -#include -#include -#include #include #include #include @@ -253,15 +250,6 @@ std::size_t packSize(const DynamicVector& data, Dune::MPIHelper::MPICommunica template std::size_t packSize(const DynamicState& data, Dune::MPIHelper::MPICommunicator comm); -template -std::size_t packSize(const Tabulated1DFunction& data, Dune::MPIHelper::MPICommunicator comm); - -template -std::size_t packSize(const IntervalTabulated2DFunction& data, Dune::MPIHelper::MPICommunicator comm); - -template -std::size_t packSize(const UniformXTabulated2DFunction& data, Dune::MPIHelper::MPICommunicator comm); - template std::size_t packSize(const IOrderSet& data, Dune::MPIHelper::MPICommunicator comm); @@ -354,18 +342,6 @@ template void pack(const DynamicVector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); -template -void pack(const Tabulated1DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - -template -void pack(const IntervalTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - -template -void pack(const UniformXTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - template void pack(const IOrderSet& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); @@ -462,18 +438,6 @@ template void unpack(DynamicVector& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); -template -void unpack(Tabulated1DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - -template -void unpack(IntervalTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - -template -void unpack(UniformXTabulated2DFunction& data, std::vector& buffer, - int& position, Dune::MPIHelper::MPICommunicator comm); - template void unpack(IOrderSet& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm); diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index e63f5fec8..fc3c427c5 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1242,46 +1242,6 @@ BOOST_AUTO_TEST_CASE(TableManager) } -BOOST_AUTO_TEST_CASE(TabulatedOneDFunction) -{ -#ifdef HAVE_MPI - Opm::Tabulated1DFunction val1(2, std::vector{1.0, 2.0}, - std::vector{3.0, 4.0}); - auto val2 = PackUnpack(val1); - DO_CHECKS(Tabulated1DFunction) -#endif -} - - -BOOST_AUTO_TEST_CASE(IntervalTabulatedTwoDFunction) -{ -#ifdef HAVE_MPI - std::vector xPos{1.0, 2.0}; - std::vector yPos{3.0, 4.0}; - std::vector> samples{{1.0, 2.0}, {3.0, 4.0}}; - Opm::IntervalTabulated2DFunction val1(xPos, yPos, samples, true, true); - auto val2 = PackUnpack(val1); - DO_CHECKS(IntervalTabulated2DFunction) -#endif -} - - -BOOST_AUTO_TEST_CASE(UniformXTabulatedTwoDFunction) -{ -#ifdef HAVE_MPI - std::vector xPos{1.0, 2.0}; - std::vector yPos{3.0, 4.0}; - using SampleType = std::vector>>; - SampleType samples{{std::make_tuple(1.0, 2.0, 3.0)}, - {std::make_tuple(4.0, 5.0, 6.0)}}; - using FFuncType = Opm::UniformXTabulated2DFunction; - FFuncType val1(xPos, yPos, samples, FFuncType::Vertical); - auto val2 = PackUnpack(val1); - DO_CHECKS(UniformXTabulated2DFunction) -#endif -} - - BOOST_AUTO_TEST_CASE(OilVaporizationProperties) { #ifdef HAVE_MPI From 3162ed067ec1ead84ccfb1424d86f99d172177a2 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 6 Mar 2020 11:55:12 +0100 Subject: [PATCH 2/2] get rid of unused serialization template --- ebos/eclmpiserializer.hh | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/ebos/eclmpiserializer.hh b/ebos/eclmpiserializer.hh index 02ed890d2..79fbf9551 100644 --- a/ebos/eclmpiserializer.hh +++ b/ebos/eclmpiserializer.hh @@ -46,31 +46,6 @@ public: Mpi::unpack(data, buffer, pos, m_comm); } - template - void staticBroadcast() - { - if (m_comm.size() == 1) - return; - -#if HAVE_MPI - if (m_comm.rank() == 0) { - size_t size = T::packSize(*this); - std::vector buffer(size); - int position = 0; - T::pack(buffer, position, *this); - m_comm.broadcast(&position, 1, 0); - m_comm.broadcast(buffer.data(), position, 0); - } else { - int size; - m_comm.broadcast(&size, 1, 0); - std::vector buffer(size); - m_comm.broadcast(buffer.data(), size, 0); - int position = 0; - T::unpack(buffer, position, *this); - } -#endif - } - template void broadcast(T& data) {