[petsc-users] Memory usage of KSP (or any PETSc object)

Mohamad M. Nasr-Azadani mmnasr at gmail.com
Tue Sep 27 23:29:30 CDT 2011


Thanks Barry for your quick response.

I am a bit puzzled by how this function works.
I was trying it on this simple example:

PetscMemoryGetMaximumUsage(&mem1);

    PetscMalloc(1*sizeof(double), &aa);


    PetscMemoryGetMaximumUsage(&mem2);


The difference I get for (mem2-mem1) is zero.
Why is that?

Best,
Mohamad






On Tue, Sep 27, 2011 at 8:45 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>  You must first call PetscMemorySetGetMaximumUsage() at the beginning of
> your program.
>
>  This will work, but you need to keep in mind that just creating the object
> generally doesn't take much space, rather it takes more and more space as
> you add things to it. For example
>
>   getmaxusage()
>   MatCreate()
>
>       ... MatSetValues()
>
>   MatAssemblyBegin()
>   MatAssemblyEnd()
>   getmaxusage()
>
>   will tell you how much space the filled matrix takes.
>
>    Barry
>
> On Sep 27, 2011, at 10:39 PM, Mohamad M. Nasr-Azadani wrote:
>
> > Hi,
> >
> > I was trying to find the exact (or more or less exact) memory consumption
> of any PETSc object.
> > I was wondering how accurate is this method:
> >
> > PetscMemoryGetMaximumUsage(&mem1);
> > .
> >
> > (creation of any PETSc object).
> > .
> >
> >
> >
> > PetscMemoryGetMaximumUsage(&mem2);
> >
> > Memory = mem2 - mem1;
> >
> >
> > Thanks in advance,
> > Mohamad
> >
> >
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110927/b5ea33de/attachment.htm>


More information about the petsc-users mailing list