Introduces parallel exception handling for ILU0 preconditioner.

When running Norne with the interleaved solver sometimes exceptions
(diagonal matrix block is not invertible) occur for some rows in the
ILU decomposition. In a parallel run this means that some, but not all
processes will see the exceptions. This leads to a classic deadlock.

With this commit we catch the exception during the setup of the preconditioner,
determine with the other processes whether there were any exceptions, and
in this case all the processes will throw an exception.

Currently this limited to Dune::MatrixBlockError, but we could extend this.
This commit is contained in:
Markus Blatt 2015-09-08 09:46:35 +02:00
parent 89ae28d3c5
commit ccac548420

View File

@ -132,13 +132,28 @@ namespace Opm
AdditionalObjectDeleter<SeqPreconditioner> >
constructPrecond(Operator& opA, const Comm& comm) const
{
const double relax = 1.0;
SeqPreconditioner* seq_precond= new SeqPreconditioner(opA.getmat(),
relax);
typedef AdditionalObjectDeleter<SeqPreconditioner> Deleter;
std::unique_ptr<ParPreconditioner, Deleter>
precond(new ParPreconditioner(*seq_precond, comm),
Deleter(*seq_precond));
typedef std::unique_ptr<ParPreconditioner, Deleter> Pointer;
Pointer precond;
int ilu_setup_successful = 1;
std::string message;
const double relax = 1.0;
try{
SeqPreconditioner* seq_precond= new SeqPreconditioner(opA.getmat(),
relax);
precond = Pointer(new ParPreconditioner(*seq_precond, comm),
Deleter(*seq_precond));
}catch(Dune::MatrixBlockError error)
{
message = error.what();
std::cerr<<message<<std::endl;
ilu_setup_successful = 0;
}
// Check wether there was a problem on some process
if(comm.communicator().min(ilu_setup_successful) == 0)
{
throw Dune::MatrixBlockError();
}
return precond;
}
#endif