[petsc-dev] preallocation checks

Jed Brown jedbrown at mcs.anl.gov
Sat Jan 28 12:45:45 CST 2012


On Sat, Jan 28, 2012 at 11:50, Stefano Zampini <stefano.zampini at gmail.com>wrote:

> I was able to reproduce the error using
> src/ksp/ksp/examples/tutorials/ex2.c using the patch attached.
> Please see the error log obtained by executing with -n 10 -m 10 by command
> line.
> If you uncomment MatGetOwnershipRange, the code will work fine
>

Okay, sorry. You can't get away with not calling anything that is "maybe
collective" before inserting values. Just call MatSetUpPreallocation()
before inserting values.

The problem is this: deadlock is possible if we make setting preallocation
automatic on the first call to MatSetValues() because if some procs don't
own any rows, they might not set any values. That scenario is most likely
to occur on coarse levels when running at large scale where it is hard to
debug and might burn up allocation while deadlocked. So you have to be
explicit about when preallocation occurs so that MatSetValues() is never
collective.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120128/b89c0961/attachment.html>


More information about the petsc-dev mailing list