added: command line option for zoltan customization

modeled after the linsolver support. a few built-in presets,
as well as reading options from a json file
This commit is contained in:
Arne Morten Kvarving
2022-09-16 13:51:29 +02:00
parent 5d0a4d588c
commit c1c850538a
8 changed files with 130 additions and 2 deletions
+17
View File
@@ -107,6 +107,11 @@ struct ZoltanImbalanceTol {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct ZoltanParams {
using type = UndefinedProperty;
};
template<class TypeTag, class MyTypeTag>
struct AllowDistributedWells {
using type = UndefinedProperty;
@@ -162,6 +167,11 @@ struct ZoltanImbalanceTol<TypeTag, TTag::EclBaseVanguard> {
static constexpr double value = 1.1;
};
template<class TypeTag>
struct ZoltanParams<TypeTag,TTag::EclBaseVanguard> {
static constexpr auto value = "graph";
};
template<class TypeTag>
struct AllowDistributedWells<TypeTag, TTag::EclBaseVanguard> {
static constexpr bool value = false;
@@ -235,10 +245,14 @@ public:
EWOMS_REGISTER_PARAM(TypeTag, bool, OwnerCellsFirst,
"Order cells owned by rank before ghost/overlap cells.");
#if HAVE_MPI
EWOMS_REGISTER_PARAM(TypeTag, bool, SerialPartitioning,
"Perform partitioning for parallel runs on a single process.");
EWOMS_REGISTER_PARAM(TypeTag, double, ZoltanImbalanceTol,
"Tolerable imbalance of the loadbalancing provided by Zoltan (default: 1.1).");
EWOMS_REGISTER_PARAM(TypeTag, std::string, ZoltanParams,
"Configuration of Zoltan partitioner. Valid options are: graph (default)), hypergrah or scotch. Alternatively, you can request a configuration to be read from a JSON file by giving the filename here, ending with '.json.'");
#endif
EWOMS_REGISTER_PARAM(TypeTag, bool, AllowDistributedWells,
"Allow the perforations of a well to be distributed to interior of multiple processes");
// register here for the use in the tests without BlackoildModelParametersEbos
@@ -263,8 +277,11 @@ public:
#endif
ownersFirst_ = EWOMS_GET_PARAM(TypeTag, bool, OwnerCellsFirst);
#if HAVE_MPI
serialPartitioning_ = EWOMS_GET_PARAM(TypeTag, bool, SerialPartitioning);
zoltanImbalanceTol_ = EWOMS_GET_PARAM(TypeTag, double, ZoltanImbalanceTol);
zoltanParams_ = EWOMS_GET_PARAM(TypeTag, std::string, ZoltanParams);
#endif
enableDistributedWells_ = EWOMS_GET_PARAM(TypeTag, bool, AllowDistributedWells);
ignoredKeywords_ = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
eclStrictParsing_ = EWOMS_GET_PARAM(TypeTag, bool, EclStrictParsing);
+7
View File
@@ -197,6 +197,13 @@ protected:
return globalTrans_->transmissibility(I,J);
}
#if HAVE_MPI
const std::string& zoltanParams() const override
{
return this->zoltanParams_;
}
#endif
// removing some connection located in inactive grid cells
void filterConnections_()
{
+4
View File
@@ -32,6 +32,7 @@
#include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>
#include <opm/simulators/utils/PropsCentroidsDataHandle.hpp>
#include <opm/simulators/utils/SetupZoltanParams.hpp>
#include <opm/grid/cpgrid/GridHelpers.hpp>
@@ -97,6 +98,9 @@ doLoadBalance_(const Dune::EdgeWeightMethod edgeWeightsMethod,
EclGenericVanguard::ParallelWellStruct& parallelWells,
const int numJacobiBlocks)
{
if (!this->zoltanParams().empty())
this->grid_->setZoltanParams(setupZoltanParams(this->zoltanParams()));
const auto mpiSize = this->grid_->comm().size();
const auto partitionJacobiBlocks =
+2
View File
@@ -164,6 +164,8 @@ private:
EclGenericVanguard::ParallelWellStruct& parallelWells);
protected:
virtual const std::string& zoltanParams() const = 0;
#endif // HAVE_MPI
void allocCartMapper();
+5
View File
@@ -218,6 +218,7 @@ public:
bool ownersFirst() const
{ return ownersFirst_; }
#if HAVE_MPI
/*!
* \brief Parameter that decides if partitioning for parallel runs
* should be performed on a single process only.
@@ -230,6 +231,7 @@ public:
*/
double zoltanImbalanceTol() const
{ return zoltanImbalanceTol_; }
#endif
/*!
* \brief Whether perforations of a well might be distributed.
@@ -281,8 +283,11 @@ protected:
#endif // HAVE_OPENCL
bool ownersFirst_;
#if HAVE_MPI
bool serialPartitioning_;
double zoltanImbalanceTol_;
std::string zoltanParams_;
#endif
bool enableDistributedWells_;
std::string ignoredKeywords_;
bool eclStrictParsing_;