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://www.democritos.it/pipermail/pw_forum/attachments/20120830/45925cc4/attachment.htm
