[petsc-users] MatSetValues on same column multiple times

Matthew Knepley knepley at gmail.com
Tue Sep 25 16:50:38 CDT 2012


On Tue, Sep 25, 2012 at 5:44 PM, John Mousel <john.mousel at gmail.com> wrote:

>
> If I'm adding to a particular column in multiple passes, do I need to
> preallocate enough memory for each pass, or just 1 for each column in the
> row?
> Right now I'm drastically over-allocating, and I'm trying to reduce this.
> If I give the true number of columns in the row, I keep getting new entry
> errors.
>
> New nonzero at (8045,60) caused a malloc!
>

You have to be more specific. It sounds like what you are doing is

<preallocate>
<put in some nonzeros>
<assemble>
<try to put in more nonzeros>

This will not work since assembly squeezes out extra space. Why are you
assembling in between?
If you need to clear buffers, you can just to MAT_ASSEMBLY_FLUSH.

   Matt


> I have it spit into phases where I set zeros in the non-zero pattern, then
> I come back and fill in entries in a bulk pass, and then do a second pass
> to clean up entries in special rows.
> Could someone clarify how this works.
>
> John
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120925/5de907c9/attachment.html>


More information about the petsc-users mailing list