Merge pull request #2240 from akva2/noecl_flush

More MPI serialization support
This commit is contained in:
Arne Morten Kvarving 2019-12-18 16:56:22 +01:00 committed by GitHub
commit e84fd74da5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 248 additions and 0 deletions

View File

@ -34,6 +34,8 @@
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
@ -206,12 +208,18 @@ HANDLE_AS_POD(Actdims)
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(EquilRecord)
HANDLE_AS_POD(FoamData)
HANDLE_AS_POD(JFunc)
HANDLE_AS_POD(RestartSchedule)
HANDLE_AS_POD(PVTWRecord)
HANDLE_AS_POD(PVCDORecord)
HANDLE_AS_POD(Tabdims)
HANDLE_AS_POD(TimeMap::StepData)
HANDLE_AS_POD(VISCREFRecord)
HANDLE_AS_POD(WATDENTRecord)
HANDLE_AS_POD(Welldims)
HANDLE_AS_POD(WellSegmentDims)
@ -444,6 +452,31 @@ std::size_t packSize(const PvtoTable& data, Dune::MPIHelper::MPICommunicator com
return packSize(static_cast<const PvtxTable&>(data), comm);
}
std::size_t packSize(const PvtwTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<PVTWRecord>&>(data), comm);
}
std::size_t packSize(const PvcdoTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<PVCDORecord>&>(data), comm);
}
std::size_t packSize(const DensityTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<DENSITYRecord>&>(data), comm);
}
std::size_t packSize(const ViscrefTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<VISCREFRecord>&>(data), comm);
}
std::size_t packSize(const WatdentTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<WATDENTRecord>&>(data), comm);
}
////// pack routines
template<class T>
@ -877,6 +910,36 @@ void pack(const PvtoTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const PvtxTable&>(data), buffer, position, comm);
}
void pack(const PvtwTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<PVTWRecord>&>(data), buffer, position, comm);
}
void pack(const PvcdoTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<PVCDORecord>&>(data), buffer, position, comm);
}
void pack(const DensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<DENSITYRecord>&>(data), buffer, position, comm);
}
void pack(const ViscrefTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<VISCREFRecord>&>(data), buffer, position, comm);
}
void pack(const WatdentTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<WATDENTRecord>&>(data), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -1421,6 +1484,45 @@ void unpack(PvtoTable& data, std::vector<char>& buffer, int& position,
unpack_pvt(data, buffer, position, comm);
}
void unpack(PvtwTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<PVTWRecord> pdata;
unpack(pdata, buffer, position, comm);
data = PvtwTable(pdata);
}
void unpack(PvcdoTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<PVCDORecord> pdata;
unpack(pdata, buffer, position, comm);
data = PvcdoTable(pdata);
}
void unpack(DensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<DENSITYRecord> pdata;
unpack(pdata, buffer, position, comm);
data = DensityTable(pdata);
}
void unpack(ViscrefTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<VISCREFRecord> pdata;
unpack(pdata, buffer, position, comm);
data = ViscrefTable(pdata);
}
void unpack(WatdentTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<WATDENTRecord> pdata;
unpack(pdata, buffer, position, comm);
data = WatdentTable(pdata);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,

View File

@ -41,6 +41,8 @@ namespace Opm
class Actdims;
class ColumnSchema;
class DENSITYRecord;
class DensityTable;
class EclHysterConfig;
class EDITNNC;
class EndpointScaling;
@ -50,11 +52,16 @@ class FoamConfig;
class FoamData;
class InitConfig;
class IOConfig;
class JFunc;
class NNC;
struct NNCdata;
class Phases;
class PVCDORecord;
class PvcdoTable;
class PvtgTable;
class PvtoTable;
class PVTWRecord;
class PvtwTable;
class RestartConfig;
class RestartSchedule;
class Rock2dTable;
@ -68,6 +75,10 @@ class TableContainer;
class TableSchema;
class ThresholdPressure;
class UDQParams;
class VISCREFRecord;
class ViscrefTable;
class WATDENTRecord;
class WatdentTable;
class Welldims;
class WellSegmentDims;
@ -254,6 +265,8 @@ ADD_PACK_PROTOTYPES(data::Segment)
ADD_PACK_PROTOTYPES(data::Solution)
ADD_PACK_PROTOTYPES(data::Well)
ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(DENSITYRecord)
ADD_PACK_PROTOTYPES(DensityTable)
ADD_PACK_PROTOTYPES(EDITNNC)
ADD_PACK_PROTOTYPES(EndpointScaling)
ADD_PACK_PROTOTYPES(Equil)
@ -263,11 +276,16 @@ ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(EclHysterConfig)
ADD_PACK_PROTOTYPES(InitConfig)
ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(JFunc)
ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(Phases)
ADD_PACK_PROTOTYPES(PVCDORecord)
ADD_PACK_PROTOTYPES(PvcdoTable)
ADD_PACK_PROTOTYPES(PvtgTable)
ADD_PACK_PROTOTYPES(PvtoTable)
ADD_PACK_PROTOTYPES(PVTWRecord)
ADD_PACK_PROTOTYPES(PvtwTable)
ADD_PACK_PROTOTYPES(RestartConfig)
ADD_PACK_PROTOTYPES(RestartKey)
ADD_PACK_PROTOTYPES(RestartSchedule)
@ -286,6 +304,10 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
ADD_PACK_PROTOTYPES(TimeMap)
ADD_PACK_PROTOTYPES(TimeMap::StepData)
ADD_PACK_PROTOTYPES(UDQParams)
ADD_PACK_PROTOTYPES(VISCREFRecord)
ADD_PACK_PROTOTYPES(ViscrefTable)
ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Welldims)
ADD_PACK_PROTOTYPES(WellSegmentDims)

View File

@ -37,6 +37,8 @@
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
@ -703,6 +705,128 @@ BOOST_AUTO_TEST_CASE(PvtoTable)
}
BOOST_AUTO_TEST_CASE(JFunc)
{
#if HAVE_MPI
Opm::JFunc val1(Opm::JFunc::Flag::BOTH, 1.0, 2.0,
3.0, 4.0, Opm::JFunc::Direction::XY);
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(PVTWRecord)
{
#if HAVE_MPI
Opm::PVTWRecord val1{1.0, 2.0, 3.0, 4.0, 5.0};
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(PvtwTable)
{
#if HAVE_MPI
Opm::PvtwTable val1({Opm::PVTWRecord{1.0, 2.0, 3.0, 4.0, 5.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(PVCDORecord)
{
#if HAVE_MPI
Opm::PVTWRecord val1{1.0, 2.0, 3.0, 4.0, 5.0};
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(PvcdoTable)
{
#if HAVE_MPI
Opm::PvcdoTable val1({Opm::PVCDORecord{1.0, 2.0, 3.0, 4.0, 5.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(DENSITYRecord)
{
#if HAVE_MPI
Opm::DENSITYRecord val1{1.0, 2.0, 3.0};
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(DensityTable)
{
#if HAVE_MPI
Opm::DensityTable val1({Opm::DENSITYRecord{1.0, 2.0, 3.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(VISCREFRecord)
{
#if HAVE_MPI
Opm::VISCREFRecord val1{1.0, 2.0};
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(ViscrefTable)
{
#if HAVE_MPI
Opm::ViscrefTable val1({Opm::VISCREFRecord{1.0, 2.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(WATDENTRecord)
{
#if HAVE_MPI
Opm::WATDENTRecord val1{1.0, 2.0, 3.0};
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
BOOST_AUTO_TEST_CASE(WatdentTable)
{
#if HAVE_MPI
Opm::WatdentTable val1({Opm::WATDENTRecord{1.0, 2.0, 3.0}});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
bool init_unit_test_func()
{
return true;