[petsc-dev] Bug in MatShift_MPIAIJ ?

Patrick Lacasse patrick.m.lacasse at gmail.com
Wed Aug 12 09:40:06 CDT 2015


I have a dead lock in MatAssemblyEnd_MPIAIJ.
It uses nonew as collective :
if (!((Mat_SeqAIJ*)aij->B->data)->nonew) {
    ierr = MPI_Allreduce( ...

this is a good optimization for me, however this value is set by
MatSetOptions(,MAT_NEW_NONZERO_ALLOCATION_ERR,)
and this enum is negative
MAT_NEW_NONZERO_ALLOCATION_ERR = -2
thus it is not asserted as collective by MatSetOption.

Some of my procs have nonew==0 and one has nonew==-2.
I'm not sure why adding new nonzero should be an error only for some procs?
I suggest that this error flag should be set collectively, so changing the
value of the enum to positive (patch 0001).

My reel problem was caused by MatShift_MPIAIJ and the way it determine if
the matrix need to be preallocated :
if (!aij->nz && !bij->nz)
the results can be true for some procs (with no local lines)
and false for other procs.
I suggest to use Y->preallocated instead (patch 0002).

thanks,

Patrick Lacasse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150812/a47e39fa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-MAT_NEW_NONZERO_-DE-LOCATION_ERR-are-collective.patch
Type: text/x-patch
Size: 1477 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150812/a47e39fa/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Dead-lock-bug-in-MatShift_MPIAIJ.patch
Type: text/x-patch
Size: 1010 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150812/a47e39fa/attachment-0001.bin>


More information about the petsc-dev mailing list