mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ebos: notify the user about parallelism and Dune::CpGrid in a better way
now, we abort at run time if the user tries to use with Dune::CpGrid in parallel simulations. The advantages are that during build there will be no warning anymore (before the warning was printed at compile time regardless of which grid was actually chosen), and that such simulations cannot be started with more than a single process (before they started just fine, but they did not work properly). This code should be removed as soon as "Dune::CpGrid" gets its act together and fixes the bug in the loadBalance() method.
This commit is contained in:
parent
4d5d3491c0
commit
003983cc87
@ -93,6 +93,11 @@ public:
|
||||
EclBaseGridManager(Simulator &simulator)
|
||||
: ParentType(simulator)
|
||||
{
|
||||
int myRank = 0;
|
||||
#if HAVE_MPI
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
|
||||
#endif
|
||||
|
||||
std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName);
|
||||
|
||||
// compute the base name of the input file name
|
||||
@ -118,13 +123,16 @@ public:
|
||||
for (size_t i = 0; i < rawCaseName.size(); ++i)
|
||||
caseName_ += std::toupper(rawCaseName[i]);
|
||||
|
||||
if (myRank == 0)
|
||||
std::cout << "Reading the deck file '" << fileName << "'" << std::endl;
|
||||
|
||||
Opm::ParserPtr parser(new Opm::Parser());
|
||||
typedef std::pair<std::string, Opm::InputError::Action> ParseModePair;
|
||||
typedef std::vector<ParseModePair> ParseModePairs;
|
||||
ParseModePairs tmp;
|
||||
tmp.push_back(ParseModePair(Opm::ParseMode::PARSE_RANDOM_SLASH , Opm::InputError::IGNORE));
|
||||
Opm::ParseMode parseMode(tmp);
|
||||
std::cout << "Reading the deck file '" << fileName << "'" << std::endl;
|
||||
|
||||
deck_ = parser->parseFile(fileName , parseMode);
|
||||
eclState_.reset(new Opm::EclipseState(deck_, parseMode));
|
||||
|
||||
|
@ -126,12 +126,21 @@ public:
|
||||
void loadBalance()
|
||||
{
|
||||
#if HAVE_MPI
|
||||
#warning "Since Dune::CpGrid is buggy when load balancing, ebos currently disables parallelism"
|
||||
#endif
|
||||
#if 0
|
||||
// distribute the grid and switch to the distributed view
|
||||
grid_->loadBalance();
|
||||
grid_->switchToDistributedView();
|
||||
int mpiRank = 0;
|
||||
int mpiSize = 1;
|
||||
MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank);
|
||||
MPI_Comm_size(MPI_COMM_WORLD, &mpiSize);
|
||||
if (mpiRank == 0 && mpiSize > 1) {
|
||||
// TODO: remove the two statements below as soon as Dune::CpGrid works
|
||||
// correctly for the Norne deck!
|
||||
std::cerr << "Since Dune::CpGrid is buggy when load balancing, "
|
||||
<< "ebos currently disables parallelism when using Dune::CpGrid.\n";
|
||||
std::abort();
|
||||
|
||||
// distribute the grid and switch to the distributed view.
|
||||
grid_->loadBalance();
|
||||
grid_->switchToDistributedView();
|
||||
}
|
||||
#endif
|
||||
|
||||
cartesianIndexMapper_ = new CartesianIndexMapper(*grid_);
|
||||
|
Loading…
Reference in New Issue
Block a user