changed: put eclipse state broadcast in separate compilation unit

to avoid compiling several times for each flow variant
This commit is contained in:
Arne Morten Kvarving
2020-03-19 09:10:19 +01:00
parent 4c5f9f2241
commit a2d840a5f7
6 changed files with 93 additions and 25 deletions

View File

@@ -46,7 +46,8 @@ if(CUDA_FOUND)
list (APPEND MAIN_SOURCE_FILES opm/simulators/linalg/bda/cusparseSolverBackend.cu)
endif()
if(MPI_FOUND)
list(APPEND MAIN_SOURCE_FILES opm/simulators/utils/ParallelEclipseState.cpp)
list(APPEND MAIN_SOURCE_FILES opm/simulators/utils/ParallelEclipseState.cpp
opm/simulators/utils/ParallelSerialization.cpp)
endif()
# originally generated with the command:

View File

@@ -56,13 +56,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
@@ -76,8 +70,8 @@
#endif
#if HAVE_MPI
#include <ebos/eclmpiserializer.hh>
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#endif
BEGIN_PROPERTIES
@@ -395,10 +389,7 @@ int main(int argc, char** argv)
schedule.reset(new Opm::Schedule);
eclipseState.reset(new Opm::ParallelEclipseState);
}
Opm::EclMpiSerializer ser(mpiHelper.getCollectiveCommunication());
ser.broadcast(*summaryConfig);
ser.broadcast(*eclipseState);
ser.broadcast(*schedule);
Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig);
#endif
Opm::checkConsistentArrayDimensions(*eclipseState, *schedule, parseContext, errorGuard);

View File

@@ -38,13 +38,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/checkDeck.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQAssign.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp>
//#include <opm/material/fluidsystems/BlackOilFluidSystemSimple.hpp>
//#include <opm/material/fluidsystems/BlackOilFluidSystemSimple.hpp>
@@ -59,8 +53,8 @@
#endif
#if HAVE_MPI
#include <ebos/eclmpiserializer.hh>
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#endif
@@ -406,10 +400,7 @@ int mainFlow(int argc, char** argv)
schedule.reset(new Opm::Schedule);
eclipseState.reset(new Opm::ParallelEclipseState);
}
Opm::EclMpiSerializer ser(mpiHelper.getCollectiveCommunication());
ser.broadcast(*summaryConfig);
ser.broadcast(*eclipseState);
ser.broadcast(*schedule);
Opm::eclStateBroadcast(*eclipseState, *schedule, *summaryConfig);
#endif
Opm::checkConsistentArrayDimensions(*eclipseState, *schedule, parseContext, errorGuard);

View File

@@ -27,8 +27,6 @@
namespace Opm {
class EclMpiSerializer;
/*! \brief Parallel frontend to the field properties.
*
* \details This is a parallel frontend to the mpi-unaware

View File

@@ -0,0 +1,49 @@
/*
Copyright 2020 Equinor AS.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WListManager.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <ebos/eclmpiserializer.hh>
#include <dune/common/parallel/mpihelper.hh>
namespace Opm {
void eclStateBroadcast(EclipseState& eclState, Schedule& schedule,
SummaryConfig& summaryConfig)
{
Opm::EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication());
ser.broadcast(eclState);
ser.broadcast(schedule);
ser.broadcast(summaryConfig);
}
}

View File

@@ -0,0 +1,38 @@
/*
Copyright 2020 Equinor AS.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PARALLEL_SERIALIZATION_HPP
#define PARALLEL_SERIALIZATION_HPP
namespace Opm {
class EclipseState;
class Schedule;
class SummaryConfig;
/*! \brief Broadcasts an eclipse state from root node in parallel runs.
*! \param eclState EclipseState to broadcast
*! \param schedule Schedule to broadcast
*! \param summaryConfig SummaryConfig to broadcast
*/
void eclStateBroadcast(EclipseState& eclState, Schedule& schedule,
SummaryConfig& summaryConfig);
} // end namespace Opm
#endif // PARALLEL_SERIALIZATION_HPP