[petsc-users] preallocation and matrix storage

Matthew Knepley knepley at gmail.com
Tue Jan 17 14:23:41 CST 2012


On Tue, Jan 17, 2012 at 2:29 PM, Tabrez Ali <stali at geology.wisc.edu> wrote:

> Hello
>
> If we are not doing exact pre-allocation (I know this is despised by PETSc
> developers) then it seems that we need to specify an nz (per row) value of
> at least "max nonzeros in any row".
>
>
> For example with nz=18 I do get 0 mallocs
>
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5236 X 5236; storage space:
> 22728 unneeded,71520 used
> [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 0
> [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 18
>
>
> But with nz=16 I get 10 mallocs
>
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5236 X 5236; storage space:
> 12406 unneeded,71520 used
> [0] MatAssemblyEnd_SeqAIJ(): Number of mallocs during MatSetValues() is 10
> [0] MatAssemblyEnd_SeqAIJ(): Maximum nonzeros in any row is 18
>
> So the question is that why is the number of mallocs 10 (with nz=16) when
> the total storage space has been overestimated (because it  says "12406
> unneeded")?
>
> Or does "unneeded" mean something else?
>

We are doing things row-by-row here, so each row gets more space, but we do
not continually
move the rest of the matrix around.

   Matt


> Thanks in advance
>
> Tabrez
>



-- 
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/20120117/76f06a8b/attachment.htm>


More information about the petsc-users mailing list