mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Replacing use of MPI_COMM_WORLD with a variable communicator.
This commit is contained in:
committed by
Atgeirr Flø Rasmussen
parent
61ef539bf5
commit
f53c597f90
@@ -58,7 +58,7 @@ template<class ElementMapper, class GridView, class Scalar>
|
||||
EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::EclGenericCpGridVanguard()
|
||||
{
|
||||
#if HAVE_MPI
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
|
||||
MPI_Comm_rank(EclGenericVanguard::comm(), &mpiRank);
|
||||
#else
|
||||
mpiRank = 0;
|
||||
#endif
|
||||
@@ -85,7 +85,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doLoadBalance_(Dun
|
||||
EclGenericVanguard::ParallelWellStruct& parallelWells)
|
||||
{
|
||||
int mpiSize = 1;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
|
||||
MPI_Comm_size(grid_->comm(), &mpiSize);
|
||||
|
||||
if (mpiSize > 1) {
|
||||
// the CpGrid's loadBalance() method likes to have the transmissibilities as
|
||||
@@ -188,7 +188,7 @@ template<class ElementMapper, class GridView, class Scalar>
|
||||
void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::distributeFieldProps_(EclipseState& eclState1)
|
||||
{
|
||||
int mpiSize = 1;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
|
||||
MPI_Comm_size(grid_->comm(), &mpiSize);
|
||||
|
||||
if (mpiSize > 1) {
|
||||
try
|
||||
@@ -230,7 +230,12 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
OpmLog::info("\nProcessing grid");
|
||||
}
|
||||
|
||||
#if HAVE_MPI
|
||||
grid_.reset(new Dune::CpGrid(EclGenericVanguard::comm()));
|
||||
#else
|
||||
grid_.reset(new Dune::CpGrid());
|
||||
#endif
|
||||
|
||||
const auto& removed_cells = grid_->processEclipseFormat(input_grid,
|
||||
&eclState,
|
||||
/*isPeriodic=*/false,
|
||||
@@ -262,12 +267,13 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
{
|
||||
const bool has_numerical_aquifer = eclState.aquifer().hasNumericalAquifer();
|
||||
int mpiSize = 1;
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
|
||||
MPI_Comm_size(grid_->comm(), &mpiSize);
|
||||
// when there is numerical aquifers, new NNC are generated during grid processing
|
||||
// we need to pass the NNC from root process to other processes
|
||||
if (has_numerical_aquifer && mpiSize > 1) {
|
||||
auto nnc_input = eclState.getInputNNC();
|
||||
EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication());
|
||||
const auto& comm_nnc = Opm::Parallel::Communication();
|
||||
EclMpiSerializer ser(comm_nnc);
|
||||
ser.broadcast(nnc_input);
|
||||
if (mpiRank > 0) {
|
||||
eclState.setInputNNC(nnc_input);
|
||||
@@ -312,7 +318,7 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doFilterConnection
|
||||
{
|
||||
// Broadcast another time to remove inactive peforations on
|
||||
// slave processors.
|
||||
eclScheduleBroadcast(schedule);
|
||||
eclScheduleBroadcast(EclGenericVanguard::comm(), schedule);
|
||||
}
|
||||
catch(const std::exception& broadcast_error)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user