mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Expose CornerCells and OverlapLayers Load Balancing Settings
We introduce two new run-time parameters, AddCorners (--add-corners=BOOL, default 'false') NumOverlap (--num-overlap=INT, default '1') that are passed on to the grid's load-balancing engine as the 'addCornerCells' and 'overlapLayers' settings.
This commit is contained in:
parent
d2f1b576bd
commit
cfbb4a9573
@ -227,6 +227,7 @@ public:
|
||||
}
|
||||
|
||||
this->doLoadBalance_(this->edgeWeightsMethod(), this->ownersFirst(),
|
||||
this->addCorners(), this->numOverlap(),
|
||||
this->partitionMethod(), this->serialPartitioning(),
|
||||
this->enableDistributedWells(),
|
||||
this->allow_splitting_inactive_wells_,
|
||||
|
@ -118,6 +118,8 @@ FlowGenericVanguard::FlowGenericVanguard(SimulationModelParams&& params)
|
||||
|
||||
ownersFirst_ = Parameters::Get<Parameters::OwnerCellsFirst>();
|
||||
#if HAVE_MPI
|
||||
numOverlap_ = Parameters::Get<Parameters::NumOverlap>();
|
||||
addCorners_ = Parameters::Get<Parameters::AddCorners>();
|
||||
partitionMethod_ = Dune::PartitionMethod(Parameters::Get<Parameters::PartitionMethod>());
|
||||
serialPartitioning_ = Parameters::Get<Parameters::SerialPartitioning>();
|
||||
zoltanParams_ = Parameters::Get<Parameters::ZoltanParams>();
|
||||
@ -452,8 +454,13 @@ void FlowGenericVanguard::registerParameters_()
|
||||
Parameters::Register<Parameters::OwnerCellsFirst>
|
||||
("Order cells owned by rank before ghost/overlap cells.");
|
||||
#if HAVE_MPI
|
||||
Parameters::Register<Parameters::AddCorners>
|
||||
("Add corners to partition.");
|
||||
Parameters::Register<Parameters::NumOverlap>
|
||||
("Numbers of layers overlap in parallel partition");
|
||||
Parameters::Register<Parameters::PartitionMethod>
|
||||
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS, 3=Zoltan with all cells of well represented by one vertex.");
|
||||
("Choose partitioning strategy: 0=simple, 1=Zoltan, 2=METIS, "
|
||||
"3=Zoltan with all cells of well represented by one vertex.");
|
||||
Parameters::Register<Parameters::SerialPartitioning>
|
||||
("Perform partitioning for parallel runs on a single process.");
|
||||
Parameters::Register<Parameters::ZoltanImbalanceTol<Scalar>>
|
||||
|
@ -75,6 +75,8 @@ struct ActionParsingStrictness { static constexpr auto value = "normal"; };
|
||||
/// 0: simple, 1: Zoltan, 2: METIS, 3: Zoltan with a all cells of a well
|
||||
/// represented by one vertex in the graph, see GridEnums.hpp
|
||||
struct PartitionMethod { static constexpr int value = 3; };
|
||||
struct AddCorners { static constexpr bool value = false; };
|
||||
struct NumOverlap { static constexpr int value = 1; };
|
||||
|
||||
struct SchedRestart{ static constexpr bool value = false; };
|
||||
struct SerialPartitioning{ static constexpr bool value = false; };
|
||||
@ -256,11 +258,18 @@ public:
|
||||
{ return ownersFirst_; }
|
||||
|
||||
#if HAVE_MPI
|
||||
bool addCorners() const
|
||||
{ return addCorners_; }
|
||||
|
||||
int numOverlap() const
|
||||
{ return numOverlap_; }
|
||||
|
||||
/*!
|
||||
* \brief Parameter deciding which partition method to use
|
||||
*/
|
||||
Dune::PartitionMethod partitionMethod() const
|
||||
{ return partitionMethod_; }
|
||||
|
||||
/*!
|
||||
* \brief Parameter that decides if partitioning for parallel runs
|
||||
* should be performed on a single process only.
|
||||
@ -269,12 +278,15 @@ public:
|
||||
{ return serialPartitioning_; }
|
||||
|
||||
/*!
|
||||
* \brief Parameter that sets the imbalance tolarance, depending on the chosen partition method
|
||||
* \brief Parameter that sets the imbalance tolarance, depending on the
|
||||
* chosen partition method
|
||||
*/
|
||||
double imbalanceTol() const
|
||||
{
|
||||
if (zoltanImbalanceTolSet_) {
|
||||
OpmLog::info("The parameter --zoltan-imbalance-tol is deprecated and has been renamed to --imbalance-tol, please adjust your calls and scripts!");
|
||||
OpmLog::info("The parameter --zoltan-imbalance-tol is deprecated "
|
||||
"and has been renamed to --imbalance-tol, please "
|
||||
"adjust your calls and scripts!");
|
||||
return zoltanImbalanceTol_;
|
||||
} else {
|
||||
return imbalanceTol_;
|
||||
@ -294,14 +306,16 @@ public:
|
||||
{ return enableDistributedWells_; }
|
||||
|
||||
/*!
|
||||
* \brief Wheter to write binary output which is compatible with the commercial Eclipse simulator.
|
||||
* \brief Whether or not to emit result files that are compatible with
|
||||
* a commercial reservoir simulator.
|
||||
*/
|
||||
bool enableEclOutput() const
|
||||
{ return enableEclOutput_; }
|
||||
|
||||
/*!
|
||||
* \brief Returns vector with name and whether the has local perforated cells
|
||||
* for all wells.
|
||||
* \brief Retrieve collection (a vector of pairs) of well names and
|
||||
* whether or not the corresponding well objects are perforated on the
|
||||
* current rank.
|
||||
*
|
||||
* Will only have usable values for CpGrid.
|
||||
*/
|
||||
@ -315,7 +329,7 @@ public:
|
||||
//! \brief Obtain global communicator.
|
||||
static Parallel::Communication& comm()
|
||||
{
|
||||
assert(comm_);
|
||||
assert(comm_ != nullptr);
|
||||
return *comm_;
|
||||
}
|
||||
|
||||
@ -357,6 +371,8 @@ protected:
|
||||
|
||||
bool ownersFirst_;
|
||||
#if HAVE_MPI
|
||||
bool addCorners_;
|
||||
int numOverlap_;
|
||||
Dune::PartitionMethod partitionMethod_;
|
||||
bool serialPartitioning_;
|
||||
double imbalanceTol_;
|
||||
|
@ -144,6 +144,8 @@ template<class ElementMapper, class GridView, class Scalar>
|
||||
void GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
|
||||
doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
@ -176,7 +178,11 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
auto loadBalancerSet = static_cast<int>(externalLoadBalancer.has_value());
|
||||
this->grid_->comm().broadcast(&loadBalancerSet, 1, 0);
|
||||
|
||||
if ((this->grid_->size(0) > 0) && (enableEclOutput || loadBalancerSet == 0 || partitionJacobiBlocks)) {
|
||||
if ((this->grid_->size(0) > 0) &&
|
||||
(enableEclOutput ||
|
||||
(loadBalancerSet == 0) ||
|
||||
partitionJacobiBlocks))
|
||||
{
|
||||
this->allocTrans();
|
||||
}
|
||||
|
||||
@ -200,7 +206,8 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const auto& possibleFutureConnections = schedule.getPossibleFutureConnections();
|
||||
// Distribute the grid and switch to the distributed view.
|
||||
if (mpiSize > 1) {
|
||||
this->distributeGrid(edgeWeightsMethod, ownersFirst, partitionMethod,
|
||||
this->distributeGrid(edgeWeightsMethod, ownersFirst,
|
||||
addCorners, numOverlap, partitionMethod,
|
||||
serialPartitioning, enableDistributedWells,
|
||||
imbalanceTol, loadBalancerSet != 0,
|
||||
faceTrans, wells,
|
||||
@ -328,6 +335,8 @@ void
|
||||
GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
|
||||
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
@ -342,10 +351,12 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeights
|
||||
if (auto* eclState = dynamic_cast<ParallelEclipseState*>(&eclState1);
|
||||
eclState != nullptr)
|
||||
{
|
||||
this->distributeGrid(edgeWeightsMethod, ownersFirst, partitionMethod,
|
||||
this->distributeGrid(edgeWeightsMethod, ownersFirst, addCorners,
|
||||
numOverlap, partitionMethod,
|
||||
serialPartitioning, enableDistributedWells,
|
||||
imbalanceTol, loadBalancerSet, faceTrans,
|
||||
wells, possibleFutureConnections, eclState, parallelWells);
|
||||
wells, possibleFutureConnections,
|
||||
eclState, parallelWells);
|
||||
}
|
||||
else {
|
||||
const auto message = std::string {
|
||||
@ -366,6 +377,8 @@ void
|
||||
GenericCpGridVanguard<ElementMapper, GridView, Scalar>::
|
||||
distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
@ -384,27 +397,29 @@ distributeGrid(const Dune::EdgeWeightMethod edgeWeights
|
||||
*this->grid_, *eclState
|
||||
};
|
||||
|
||||
const auto addCornerCells = false;
|
||||
const auto overlapLayers = 1;
|
||||
const auto addCornerCells = addCorners;
|
||||
const auto overlapLayers = numOverlap;
|
||||
|
||||
if (loadBalancerSet) {
|
||||
auto parts = isIORank
|
||||
? (*externalLoadBalancer)(*this->grid_)
|
||||
: std::vector<int>{};
|
||||
//For this case, simple partitioning is selected automatically
|
||||
parallelWells =
|
||||
std::get<1>(this->grid_->loadBalance(handle, parts, &wells, possibleFutureConnections, ownersFirst,
|
||||
addCornerCells, overlapLayers));
|
||||
|
||||
// For this case, simple partitioning is selected automatically.
|
||||
parallelWells = std::get<1>
|
||||
(this->grid_->loadBalance(handle, parts, &wells,
|
||||
possibleFutureConnections, ownersFirst,
|
||||
addCornerCells, overlapLayers));
|
||||
}
|
||||
else {
|
||||
parallelWells =
|
||||
std::get<1>(this->grid_->loadBalance(handle, edgeWeightsMethod,
|
||||
&wells, possibleFutureConnections,
|
||||
serialPartitioning,
|
||||
faceTrans.data(), ownersFirst,
|
||||
addCornerCells, overlapLayers,
|
||||
partitionMethod, imbalanceTol,
|
||||
enableDistributedWells));
|
||||
parallelWells = std::get<1>
|
||||
(this->grid_->loadBalance(handle, edgeWeightsMethod,
|
||||
&wells, possibleFutureConnections,
|
||||
serialPartitioning,
|
||||
faceTrans.data(), ownersFirst,
|
||||
addCornerCells, overlapLayers,
|
||||
partitionMethod, imbalanceTol,
|
||||
enableDistributedWells));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,8 @@ protected:
|
||||
#if HAVE_MPI
|
||||
void doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
@ -177,6 +179,8 @@ private:
|
||||
|
||||
void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
@ -190,6 +194,8 @@ private:
|
||||
|
||||
void distributeGrid(const Dune::EdgeWeightMethod edgeWeightsMethod,
|
||||
const bool ownersFirst,
|
||||
const bool addCorners,
|
||||
const int numOverlap,
|
||||
const Dune::PartitionMethod partitionMethod,
|
||||
const bool serialPartitioning,
|
||||
const bool enableDistributedWells,
|
||||
|
Loading…
Reference in New Issue
Block a user