[Pw_forum] Memory usage by pw.x

Guido Fratesi fratesi at mater.unimib.it
Thu Aug 30 15:54:35 CEST 2012


> What about tracking the maximum and the minimum recorded within an
> entire SCF loop by sampling the memory occupancy where a clock (start or
> stop) is triggered?

I tried this possibility, defining the routines below in clocks.f90 and 
the variable max_ram_kb (stored for laziness in "mytime"). Then, I call 
set_max_tracked_ram at every start/stop of a clock. I would expect this 
to work, since for example h_psi is called within the diagonalization 
cycles where workspaces and (I expect) most arrays have been already 
allocated.
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).

I report here the subroutines I used, they are trivial but...

   SUBROUTINE set_max_tracked_ram ()
     USE mytime,               ONLY : max_ram_kb
     IMPLICIT NONE
     INTEGER :: kilobytes
     CALL memstat ( kilobytes )
     IF ( kilobytes > max_ram_kb+50 ) THEN
       max_ram_kb = kilobytes
       CALL write_max_tracked_ram ()
     END IF
   END SUBROUTINE set_max_tracked_ram
   !
   SUBROUTINE write_max_tracked_ram ()
     USE io_global,            ONLY : stdout
     USE mytime,               ONLY : max_ram_kb
     IMPLICIT NONE
     WRITE( stdout, 9001 ) max_ram_kb/1000.0
     9001 FORMAT(/' XXX per-process dynamical memory: ',f7.1,' Mb' )
   END SUBROUTINE write_max_tracked_ram

Guido

-- 
Guido Fratesi

Dipartimento di Scienza dei Materiali
Universita` degli Studi di Milano-Bicocca
via Cozzi 53, 20125 Milano, Italy




More information about the users mailing list