<div class="gmail_quote">On Wed, Jun 6, 2012 at 5:22 AM, Alexander Grayver <span dir="ltr"><<a href="mailto:agrayver@gfz-potsdam.de" target="_blank">agrayver@gfz-potsdam.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">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).<br>
    I'm wondering if it makes sense to use MatAssemblyBegin(A,
    MAT_FLUSH_ASSEMBLY) in between? In docs it is said:<br>
    >> <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValues.html#MatSetValues" target="_blank">MatSetValues</a>()
    generally caches the values.<br>
    <br>
    How does the caching work actually? Is this additionally allocated
    memory (dynamic or not)?</div></blockquote></div><br><div>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.</div>
<div><br></div><div>You can also look at -log_summary to see if an inordinate amount of time is spent in assembly.</div>