[Pw_forum] Memory usage by pw.x

Simon Binnie sbinnie at sissa.it
Thu Aug 30 16:50:54 CEST 2012


On Thu, 30 Aug 2012 16:34:03 +0200, Lorenzo Paulatto  
<lorenzo.paulatto at impmc.upmc.fr> wrote:

> On 30 August 2012 15:54, Guido Fratesi <fratesi at mater.unimib.it> wrote:
>
>> Yet in my test, the max memory printed by top is 2.3GB within the first
>> step of the SCF cycle, but the standard call to memstat in electrons.f90
>> returned 744.1 Mb and the one tracked as described above 1168.572 Mb
>> (maximum reached earlier than that 744.1 Mb).
>>
>>
> Measuring the amount of memory in the "clock" subroutines is far from
> optimal, as they are usually called before temporary variables are
> allocated (start)clock) and after they are deallocated (stop_clock).
>
> With a command like this:
>  sed -ri "s/(^ *)(allocate.*$)/\1\2\n\1  CALL mem_whatever()/i" $(find
> /where/is/espresso -name \*.f90)
>
> You can add a call to mem_whatever after *every* allocate in the entire
> code. This will also modify all your f90 files, so I suggest making a
> backup first.
> This should result in a quite accurate report of memory consumption (at  
> the
> cost of a certain performance hit, I guess).

You could use valgrind with the 'massif' tool. This should be able to tell  
you in which routine the memory usage peaks and thus where is best to put  
your memory check. Running qe under valgrind can be a very slow process  
though...

Simon

-- 
Simon Binnie | Post Doc, Condensed Matter Sector
Scuola Internazionale di Studi Avanzati (SISSA)
Via Bonomea 256 | 34100 Trieste | sbinnie at sissa.it



More information about the users mailing list