Most definitely a bug. If it all possible let's keep the code self contained 
here and not require flags set in other parts of the code because that could 
easily led to confusion and bugs in the future.

   Why not just remove the first if test (below) and just have the two 
conditions diag != 0.0 and drag == 0.0 

     if ((diag != 0.0) && (mat->A->rmap->N == mat->A->cmap->N)) {
        ierr = MatZeroRows(mat->A, len, lrows, diag, NULL, NULL);CHKERRQ(ierr);

  and also drop the 

if (((Mat_SeqAIJ *) mat->A->data)->nonew) SETERRQ(PETSC_COMM_SELF, 
PETSC_ERR_SUP, "MatZeroRows() on rectangular matrices cannot be used with the 
Mat 
options\nMAT_NEW_NONZERO_LOCATIONS,MAT_NEW_NONZERO_LOCATION_ERR,MAT_NEW_NONZERO_ALLOCATION_ERR");

test since the appropriate error will still be generated internally.

   Simplier code is always better code.


   Barry



> On Jun 21, 2016, at 1:55 PM, Stefano Zampini <[email protected]> 
> wrote:
> 
> I think that the test
> 
> if ((diag != 0.0) && (mat->A->rmap->N == mat->A->cmap->N)) {
> 
> at line 836 in src/mat/impls/aij/mpi/mpiaij.c (master) is a bug, either for 
> rectangular matrices or even for square matrices with non-trivial layouts.
> 
> It can happen that some of the processes does not satisfy the test and some 
> others do; in this case, MatAssemblyBegin/End is not  collectively called.
> 
> I don’t see any trivial fix; my solution involves computing a flag during 
> MatSetSizes() based on some test on the ranges of the row and column layouts.
> I will go on and fix it in a branch unless someone has a simpler solution.
> 
> 
> 
> 
> 

Reply via email to