Question about memory used by PetsC Objects

Laurent Nguyen laurent.nguyen at
Thu Apr 12 09:49:25 CDT 2007


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 

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

NGUYEN Anh-Khai Laurent
Equipe Support Utilisateur

Email    :    laurent.nguyen at
Tél      :
Adresse  :    IDRIS - Institut du Développement et des Ressources en
               Informatique Scientifique
               Batiment 506
               BP 167
               F - 91403 ORSAY Cedex
Site Web :
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: poisson.F90
URL: <>

More information about the petsc-users mailing list