[Pw_forum] Memory usage by pw.x

Lorenzo Paulatto lorenzo.paulatto at impmc.upmc.fr
Thu Aug 30 16:34:03 CEST 2012


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). Eventual allocations in c
files and external libraries could still escape. I.e. the FFT library could
decide to allocate a temporary array of 1GB, you will not see this in the
final report.

I suggest putting the subroutine mem_whatever somewher in flib/ and without
a Module, otherwise you'll be forced to include also a USE in every file,
which can be annoying.

bests

-- 
Lorenzo Paulatto IdR @ IMPMC/CNRS & Université Paris 6
phone: +33 (0)1 44275 084 / skype: paulatz
www:   http://www-int.impmc.upmc.fr/~paulatto/
mail:  23-24/4é16 Boîte courrier 115, 4 place Jussieu 75252 Paris Cédex 05
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20120830/45925cc4/attachment.html>


More information about the users mailing list