Question about memory used by PetsC Objects

Barry Smith bsmith at mcs.anl.gov
Thu Apr 12 21:40:48 CDT 2007


  Laurent,

   The memory usage printed with -log_summary is not correct.
Much of the memory used is not printed out.

   You can use PetscMemoryGetCurrentUsage() and PetscMemoryGetMaximumUsage()
in your code before and after creating a filling in PETSc objects
to see how much memory they are used. You can also use PetscMallocDump()
at any point to see exactly where in PETSc and how much all of PETSc's
memory was allocated.

   Barry


On Thu, 12 Apr 2007, Laurent Nguyen wrote:

> Hi,
> 
> I'm a Petsc user, but I'm beginning to use petsc in a supercomputation
> context. So, I'm trying parallel versions of my old mono-processed programs.
> But I've some difficulties to determine how much memory my program use. (I
> give a little example). In this example on one processor (with these command
> line arguments: -mat_type mpiaij -pc_type none -log_summary), I created one
> mpiaij matrix (size = 500*500) and two vectors (size = 500). I've this
> information from output:
> 
>   Matrix Object:
>     type=mpiaij, rows=250000, cols=250000
>     total: nonzeros=749996, allocated nonzeros=1750000
> 
> To me, there is an array of 1750000 double precision number of 8 bytes =
> 14000000 bytes (14Mo).
> 
> Same for vectors: 2*8*250000 = 4 Mo
> 
> But in the log summary, I've:
> 
> Memory usage is given in bytes:
> 
> Object Type          Creations   Destructions   Memory  Descendants' Mem.
> 
> --- Event Stage 0: Main Stage
> 
>               Viewer     1              1          0     0
>            Index Set     2              2        672     0
>                  Map    16             16       4992     0
>                  Vec    10             10    2006576     0
>          Vec Scatter     1              1          0     0
>               Matrix     3              3       1068     0
>        Krylov Solver     1              1      17208     0
>       Preconditioner     1              1          0     0
> =============================================================
> 
> I don't understand this output...If you have some documentation about how
> Petsc deals with memory or if you can explain, I would be very interested.
> 
> This is a problem because I'm working on IBM SP4, and I've limitations of
> memory (700mb for data and 700mb for stack). I think the objects created by
> Petsc is created in the stack memory, but as I cannot determine exactly the
> memory usage, I cannot verify.
> 
> Thank you for your advices,
> 
> Best regards
> 
> 




More information about the petsc-users mailing list