[petsc-users] Question on non-zero pattern

Jed Brown jedbrown at mcs.anl.gov
Thu Mar 14 14:59:34 CDT 2013


On Thu, Mar 14, 2013 at 2:56 PM, Sanjay Govindjee <s_g at berkeley.edu> wrote:

> When I pre-allocated, I preallocated sufficient on and off and off
> processor memory for
> all possible non-zero patterns.  So I assume that there will not be any
> mallocs necessary.
> Or am I mis-understanding how the preallocation works?
>

You need to _insert_ values there, otherwise they will be compressed out in
the first assembly. It's not really the allocation that's expensive, it's
the contiguous storage, which is important for performance elsewhere. If
you insert explicit zeros the first time you assemble, then you won't need
to set MAT_NEW_NONZERO_LOCATIONS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130314/af43ced8/attachment.html>


More information about the petsc-users mailing list