Question about memory used by PetsC Objects

Laurent Nguyen laurent.nguyen at idris.fr
Fri Apr 13 03:39:45 CDT 2007


Barry,

I thank you for your help. So I tried to apply the functions. It seems 
that PetscMemoryGetCurrentUsage() gives the total amount of memory 
allocated at the point of the program where it is placed. But, if a 
object is deallocated, PetscMemoryGetCurrentUsage() doesn't take it.

I would like to try PetscMemoryGetMaximumUsage() at the end of the 
program hoping it gives me the maximum memory used by my program but 
there are problems. When I put PetscMemoryGetMaximumUsage(), I've this 
error at the execution:

[0]PETSC ERROR: --------------------- Error Message 
------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: To use this function you must first call 
PetscMemorySetGetMaximumUsage()!

So I put PetscMemorySetGetMaximumUsage() before, but at linking, it 
didn't find PetscMemorySetGetMaximumUsage in the petsc libraries. I 
thought I made a bad install but when I tried on another machine, I've 
the same problem.

Best regards,

**************************************
NGUYEN Anh-Khai Laurent
Equipe Support Utilisateur

Email    :    laurent.nguyen at idris.fr
Tél      :    01.69.35.85.66
Adresse  :    IDRIS - Institut du Développement et des Ressources en
               Informatique Scientifique
               CNRS
               Batiment 506
               BP 167
               F - 91403 ORSAY Cedex
Site Web :    http://www.idris.fr
**************************************

Barry Smith a écrit :
>   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