<br><br><div class="gmail_quote">On 30 August 2012 15:54, Guido Fratesi <span dir="ltr"><<a href="mailto:fratesi@mater.unimib.it" target="_blank">fratesi@mater.unimib.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Yet in my test, the max memory printed by top is 2.3GB within the first</div>
step of the SCF cycle, but the standard call to memstat in electrons.f90<br>
returned 744.1 Mb and the one tracked as described above 1168.572 Mb<br>
(maximum reached earlier than that 744.1 Mb).<br><br></blockquote><div><br></div><div>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).</div>
<div><br></div><div>With a command like this:</div></div><div> sed -ri "s/(^ *)(allocate.*$)/\1\2\n\1 CALL mem_whatever()/i" $(find /where/is/espresso -name \*.f90)</div><div><br></div><div>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.</div>
<div>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.</div>
<div><br></div><div>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.</div><div><br></div><div>
bests</div><div><br></div>-- <br><div>Lorenzo Paulatto IdR @ IMPMC/CNRS & Université Paris 6</div><div>phone: +33 (0)1 44275 084 / skype: paulatz</div><div>www: <a href="http://www-int.impmc.upmc.fr/~paulatto/" target="_blank">http://www-int.impmc.upmc.fr/~paulatto/</a></div>
<div>mail: 23-24/4é16 Boîte courrier 115, 4 place Jussieu 75252 Paris Cédex 05</div><br>