[petsc-users] MatSetValues and values cache

Jed Brown jedbrown at mcs.anl.gov
Wed Jun 6 06:06:52 CDT 2012


On Wed, Jun 6, 2012 at 5:22 AM, Alexander Grayver
<agrayver at gfz-potsdam.de>wrote:

> In my program I assemble huge matrix (~500 millions of double complex nnz)
> and all MatSetValues calls are done before MatAssemblyBegin(A,
> MAT_FINAL_ASSEMBLY).
> I'm wondering if it makes sense to use MatAssemblyBegin(A,
> MAT_FLUSH_ASSEMBLY) in between? In docs it is said:
> >> MatSetValues<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html#MatSetValues>()
> generally caches the values.
>
> How does the caching work actually? Is this additionally allocated memory
> (dynamic or not)?
>

Only entries that are generated on a different process than they need to be
stored will be cached. If you generate most entries on the correct process
(the owned rows for MPI*AIJ matrices), there is no need to flush.

You can also look at -log_summary to see if an inordinate amount of time is
spent in assembly.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120606/3e3cb55a/attachment.html>


More information about the petsc-users mailing list