[petsc-dev] Bug in MatShift_MPIAIJ ?

Satish Balay balay at mcs.anl.gov
Thu Oct 8 14:30:57 CDT 2015


The commented code is sequential code - and shouldn't make a
difference.

Perhaps your application has other issues.

Can you verify if your code is valgrind clean?
http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind

Also might want to add a barrier - before MatShift() to see if that
makes a difference [similar to the way commenting out the 2 lines make
a difference]

Satish

On Thu, 8 Oct 2015, Eric Chamberland wrote:

> I think the same problem is in MatShift_MPIBAIJ.
> 
> I mean if I have a processor with no (local) lines at all in a matrix (which
> is my bugging case here), it should not call Mat*SetPreallocation at that
> point...
> 
> That sounds ok to you?
> 
> thanks,
> 
> Eric
> 
> On 08/10/15 02:45 PM, Eric Chamberland wrote:
> > Ok,
> > 
> > if I comment the following lines (added in 3.6.2), it works:
> > 
> > PetscErrorCode MatShift_MPIAIJ(Mat Y,PetscScalar a)
> > {
> >    PetscErrorCode ierr;
> >    Mat_MPIAIJ     *maij = (Mat_MPIAIJ*)Y->data;
> >    Mat_SeqAIJ     *aij = (Mat_SeqAIJ*)maij->A->data;
> > 
> >    PetscFunctionBegin;
> >    if (!Y->preallocated) {
> >      ierr = MatMPIAIJSetPreallocation(Y,1,NULL,0,NULL);CHKERRQ(ierr);
> >    } /*else if (!aij->nz) {
> >      ierr = MatSeqAIJSetPreallocation(maij->A,1,NULL);CHKERRQ(ierr);
> >    }*/
> >    ierr = MatShift_Basic(Y,a);CHKERRQ(ierr);
> >    PetscFunctionReturn(0);
> > }
> > 
> > Eric
> > 
> > On 08/10/15 09:45 AM, Eric Chamberland wrote:
> > > Hi!
> > > 
> > > hint: For petsc 3.6.1, if I apply the patches that Patrick gave (in the
> > > head of this thread), it all works correctly,
> > > 
> > > Eric
> > > 
> > > On 07/10/15 10:11 PM, Eric Chamberland wrote:
> > > > Hi Jed,
> > > > > If I recall correctly, that patch is only checking for incorrect use
> > > > > by
> > > > > ensuring that the flags are set collectively.  If your code is correct
> > > > > then it doesn't affect you and if your code is incorrect, it will
> > > > > error
> > > > > now where as it would behave incorrectly before.  The implementation
> > > > > was
> > > > > done by changing some enum values, which is why it breaks the ABI.
> > > > > 
> > > > > As Satish says, you can apply the patch and see if your code errors.
> > > > > 
> > > > > If your example is simple, you can send it along so we can debug and
> > > > > add
> > > > > it to the test suite.
> > > > 
> > > > ok, after applying the patch, the code still error at the same place.
> > > > 
> > > > The fact is that doing the very same MatShift with petsc 3.5.3 was
> > > > working correctly...  in fact it is now hanging into one of our test
> > > > from our test suite...
> > > > 
> > > > I will have to dig further into this...
> > > > 
> > > > to be continued...
> > > > 
> > > > Eric
> > > 
> > > 
> > > Hi!
> 
> 




More information about the petsc-dev mailing list