memory usage of a SeqAIJ matrix

Matthew Knepley knepley at gmail.com
Tue Sep 15 14:06:18 CDT 2009


You can use the output of -ksp_view, which gives the matrix information.

   Matt

On Tue, Sep 15, 2009 at 2:01 PM, Bernardo Rocha <bernardosk at gmail.com>wrote:

> Hi everyone,
>
> I need to know the number of nonzero element of the matrix in an
> application using PETSc. How can I do it? What is the best way to do it?
>
> As far as I'm concerned with PETSc, running on a single processor, I'm
> using the command line argument "-info" and then I get this information in
> some line of the output that looks like this
>
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5100 X 5100; storage space: 92706
> unneeded,44994 used
>
> then I simply get the number of used entries.
>
> But when I have a large simulation, where the matrix does not fit into the
> memory of one processor, I must use several processors. My question is how
> to get the number of nonzero entries of the "global" matrix? I wrote a
> simple python script to parse the output and sum the number of entries used
> on each processor, but I found out that my calculations are wrong, I'm
> having twice more nonzero elements (I tested against a tiny simulation on a
> single processor). It seems that on the output I'm parsing I have two kinds
> of informations about the entries used:
>
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5100 X 5100; storage space: 92706
> unneeded,44994 used
>
> [0] MatAssemblyEnd_SeqAIJ(): Matrix size: 5100 X 5100; storage space: 0
> unneeded,44994 used
>
> That is, one that the "unneeded" field has some value and another that this
> field is zero. Then I decided to discard the information where the field
> "unneeded" is zero and finally the results matched perfectly with a single
> processor case.
>
> So, i would like to know (1) why do I have these lines with "0 unneeded"
> and (2) if there is a more elegant way to measure this.
>
> That's all!
> Best regards,
> Bernardo M. R.
>



-- 
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/20090915/efa60f54/attachment.htm>


More information about the petsc-users mailing list