Prevent problems to due oversight in parallel AMG.

Currently we run into issues with the parallel AMG if
redistribution happened on the coarsest level. That is
not detected by AMG and it will construct smoothers on
all processors present before the redistribution. Some of
them will get OwnerOverlapCommunication objects that have
an invalid MPI communicator in them (MPI_COMM_NULL) and an
MPI_ERROR will be raised as we communicate in the constructor.

With this patch we detect this situaton and set the pointer to
OwnerOverlapCommunication to null to prevent communication. A
sanity check that the matrix has zero rows has been added.
This commit is contained in:
Markus Blatt 2018-02-06 13:19:59 +01:00
parent 28e566ba02
commit 6bcfce1733

View File

@ -420,6 +420,22 @@ public:
protected:
void init( const Matrix& A, const int iluIteration )
{
// (For older DUNE versions the communicator might be
// invalid if redistribution in AMG happened on the coarset level.
// Therefore we check for nonzero size
if ( comm_ && comm_->communicator().size()<=0 )
{
if ( A.N() > 0 )
{
OPM_THROW(std::logic_error, "Expected a matrix with zero rows for an invalid communicator.");
}
else
{
// simply set the communicator to null
comm_ = nullptr;
}
}
int ilu_setup_successful = 1;
std::string message;
const int rank = ( comm_ ) ? comm_->communicator().rank() : 0;