[petsc-users] Réf. : Re: Avoiding malloc overhead for unstructured finite element meshes

Jed Brown jedbrown at mcs.anl.gov
Thu Jun 28 12:33:56 CDT 2012


On Thu, Jun 28, 2012 at 9:29 AM, Thomas DE-SOZA <thomas.de-soza at edf.fr>wrote:

> Since 9900 coefficients were uneeded, we had first thought that enough
> room was preallocated.
> From what you're telling us, I understand that we may have given an
> overall size which is large enough to contain the diagonal block but whose
> nnz line by line is not correct hence the mallocs. Is that correct ?
>

Unlikely, extra space is dynamically allocated in bigger chunks so there is
usually some left over when mallocs are needed in MatSetValues. You should
be careful to get nnz correct, but that is not the only problem here.


>
> Or does it mean that in the preallocation we have to take care of the
> values that come from the stash of another processor even if they are added
> to preexisting entries on the process ?
>

You only have to allocate the entries once, but there are entries that were
not preallocated at all.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120628/0a4b9be4/attachment.html>


More information about the petsc-users mailing list