Commit d0c0e47e authored by Matthias Redies's avatar Matthias Redies

move timing summary to out-file

parent 3ee87fdc
......@@ -16,7 +16,7 @@ MODULE m_juDFT_time
IMPLICIT NONE
! List of different timers
PRIVATE
INTEGER, PARAMETER :: max_subtimer = 5 ! blocks of subtimers are allocated in this size
INTEGER, PARAMETER :: max_subtimer = 5 ! blocks of subtimers are allocated in this size
REAL :: min_time = 0.02 ! minimal time to display in output (part of total)
LOGICAL :: l_debug !write out each start& stop of timer
REAL :: debugtimestart = -1.0
......@@ -348,8 +348,7 @@ CONTAINS
USE m_judft_usage
IMPLICIT NONE
LOGICAL, INTENT(IN), OPTIONAL::stdout
INTEGER :: fn, irank = 0
LOGICAL :: l_out
INTEGER :: irank = 0
CHARACTER(len=:), allocatable :: json_str
#ifdef CPP_MPI
INCLUDE "mpif.h"
......@@ -358,45 +357,28 @@ CONTAINS
CALL MPI_COMM_RANK(MPI_COMM_WORLD, irank, err)
#endif
IF (.NOT. ASSOCIATED(globaltimer)) RETURN !write nothing if no timing recorded
l_out = .FALSE.
IF (PRESENT(stdout)) l_out = stdout
IF (l_out) THEN
fn = 6
ELSE
IF (irank > 0) RETURN
fn = 2
OPEN (2, FILE='juDFT_times', STATUS="replace")
ENDIF
globaltimer%time = cputime() - globaltimer%starttime
globaltimer%starttime = cputime()
WRITE (fn, "('Total execution time: ',i0,'sec')") INT(globaltimer%time)
CALL add_usage_data("Runtime", globaltimer%time)
CALL priv_writetimes_longest(globaltimer, fid=fn)
WRITE (fn, "('Total execution time: ',i0,'sec, minimal timing printed:',i0,'sec')") &
INT(globaltimer%time), INT(min_time*globaltimer%time)
#ifdef CPP_MPI
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, isize, err)
WRITE (fn, *) "Program used ", isize, " PE"
#endif
CALL priv_writetimes(globaltimer, 1, fn)
WRITE (fn, *)
WRITE (fn, *) "-------------------------------------------------"
WRITE (fn, *)
WRITE (fn, *) "Total timings:"
min_time = 0.0
CALL priv_writetimes(globaltimer, 1, fn)
FLUSH(fn)
IF (.NOT. l_out) CLOSE (2)
json_str = ""
call priv_genjson(globaltimer, 1, json_str)
open(32, file="juDFT_times.json")
write (32,"(A)") json_str
close(32)
IF (irank == 0) THEN
globaltimer%time = cputime() - globaltimer%starttime
globaltimer%starttime = cputime()
WRITE (6, "('\n\nTotal execution time: ',i0,'sec')") INT(globaltimer%time)
CALL add_usage_data("Runtime", globaltimer%time)
CALL priv_writetimes_longest(globaltimer, fid=6)
WRITE (6, "('Total execution time: ',i0,'sec, minimal timing printed:',i0,'sec')") &
INT(globaltimer%time), INT(min_time*globaltimer%time)
#ifdef CPP_MPI
CALL MPI_COMM_SIZE(MPI_COMM_WORLD, isize, err)
WRITE (6, *) "Program used ", isize, " PE"
#endif
CALL priv_writetimes(globaltimer, 1, 6)
json_str = ""
call priv_genjson(globaltimer, 1, json_str)
open(32, file="juDFT_times.json")
write (32,"(A)") json_str
close(32)
ENDIF
END SUBROUTINE writetimes
! writes all times to out.xml file
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment