1 | MODULE YOMGSTATS |
---|
2 | |
---|
3 | USE PARKIND1 ,ONLY : JPIM ,JPRB |
---|
4 | |
---|
5 | IMPLICIT NONE |
---|
6 | |
---|
7 | SAVE |
---|
8 | |
---|
9 | ! ------------------------------------------------------------------ |
---|
10 | ! Module for timing statistics. Module is internal to the GSTATS package - |
---|
11 | ! routines GSTATS, SUSTATS and STATS_OUTPUT. The logical switches are |
---|
12 | ! re-initialized in SUMPINI |
---|
13 | |
---|
14 | ! LSTATS - TRUE for gathering timing statistics |
---|
15 | ! LSTATSCPU - TRUE for gathering CPU timing statistics |
---|
16 | ! LSYNCSTATS - TRUE for syncronization (call to barrier) at the |
---|
17 | ! start of timing event |
---|
18 | ! LDETAILED_STATS - TRUE for more detail in output |
---|
19 | ! LSTATS_OMP - TRUE for gathering timing statistics on OpenMP regions |
---|
20 | ! 1001-1999 |
---|
21 | ! LSTATS_COMMS - TRUE for gathering detailed timing of Message passing |
---|
22 | ! 501-1000 |
---|
23 | ! NTRACE_STATS - max number of entries in trace |
---|
24 | ! LTRACE_STATS - True for trace of all calls to gstats |
---|
25 | ! LGSTATS_LABEL - True after GSTATS-labels have been set |
---|
26 | ! JPMAXSTAT - max number of separate timers in gstats |
---|
27 | ! JPOBCOUNT_BASE - first counter for obs types |
---|
28 | ! NCALLS - number of times a timer has been switched on |
---|
29 | ! TIMESUM - total time spent with timer on |
---|
30 | ! TIMESQSUM - sum of the squares of times |
---|
31 | ! TIMEMAX - max time of all calls |
---|
32 | ! TIMESUMB - sum of times between previous timer was invoked and this |
---|
33 | ! timer was switched on ( to be used for finding out which parts |
---|
34 | ! of the code that is not being timed) |
---|
35 | ! TIMELCALL - time when event was switched on or resumed |
---|
36 | ! TTCPUSUM - total cpu time |
---|
37 | ! TVCPUSUM - total vector cpu time |
---|
38 | ! THISTIME - total accumulated time for this call to timing event (necessary |
---|
39 | ! to be able to suspend and resume timer and still have it counted |
---|
40 | ! as one timing event) |
---|
41 | ! THISTCPU - as THISTIME but for CPU time |
---|
42 | ! THISVCPU - as THISTIME but for vector CPU time |
---|
43 | ! TTCPULCALL - as TIMELCALL but for CPU time |
---|
44 | ! TVCPULCALL - as TIMELCALL but for vector CPU time |
---|
45 | ! TIME_LAST_CALL - last time GSTATS was called |
---|
46 | ! TIME_START - used for recording parallel startup time |
---|
47 | |
---|
48 | |
---|
49 | LOGICAL :: LSTATS = .TRUE. |
---|
50 | LOGICAL :: LSTATS_OMP = .FALSE. |
---|
51 | LOGICAL :: LSTATS_COMMS = .FALSE. |
---|
52 | LOGICAL :: LSTATS_MEM = .FALSE. |
---|
53 | LOGICAL :: LSTATS_ALLOC = .FALSE. |
---|
54 | LOGICAL :: LSTATSCPU = .TRUE. |
---|
55 | LOGICAL :: LSYNCSTATS = .FALSE. |
---|
56 | LOGICAL :: LDETAILED_STATS = .TRUE. |
---|
57 | LOGICAL :: LBARRIER_STATS = .FALSE. |
---|
58 | LOGICAL :: LTRACE_STATS = .FALSE. |
---|
59 | LOGICAL :: LGSTATS_LABEL = .FALSE. |
---|
60 | |
---|
61 | INTEGER(KIND=JPIM),PARAMETER :: JPMAXSTAT=2500 |
---|
62 | |
---|
63 | INTEGER(KIND=JPIM),PARAMETER :: JPOBCOUNT_BASE=201 |
---|
64 | INTEGER(KIND=JPIM) :: NTRACE_STATS=0 |
---|
65 | INTEGER(KIND=JPIM) :: NCALLS(0:JPMAXSTAT) |
---|
66 | INTEGER(KIND=JPIM) :: NCALLS_TOTAL=0 |
---|
67 | INTEGER(KIND=JPIM),ALLOCATABLE :: NCALL_TRACE(:) |
---|
68 | |
---|
69 | REAL(KIND=JPRB) :: TIMESUM(0:JPMAXSTAT) |
---|
70 | REAL(KIND=JPRB) :: TIMESQSUM(0:JPMAXSTAT) |
---|
71 | REAL(KIND=JPRB) :: TIMEMAX(0:JPMAXSTAT) |
---|
72 | REAL(KIND=JPRB) :: TIMESUMB(0:JPMAXSTAT) |
---|
73 | REAL(KIND=JPRB) :: TIMELCALL(0:JPMAXSTAT) |
---|
74 | REAL(KIND=JPRB) :: TTCPUSUM(0:JPMAXSTAT) |
---|
75 | REAL(KIND=JPRB) :: TVCPUSUM(0:JPMAXSTAT) |
---|
76 | REAL(KIND=JPRB) :: THISTIME(0:JPMAXSTAT) |
---|
77 | REAL(KIND=JPRB) :: THISTCPU(0:JPMAXSTAT) |
---|
78 | REAL(KIND=JPRB) :: THISVCPU(0:JPMAXSTAT) |
---|
79 | REAL(KIND=JPRB) :: TTCPULCALL(0:JPMAXSTAT) |
---|
80 | REAL(KIND=JPRB) :: TVCPULCALL(0:JPMAXSTAT) |
---|
81 | REAL(KIND=JPRB) :: TIME_LAST_CALL |
---|
82 | |
---|
83 | REAL(KIND=JPRB),ALLOCATABLE :: TIME_START(:) |
---|
84 | REAL(KIND=JPRB),ALLOCATABLE :: TIME_TRACE(:) |
---|
85 | INTEGER(KIND=JPIM),PARAMETER :: JPERR=0 |
---|
86 | INTEGER(KIND=JPIM),PARAMETER :: JPTAGSTAT=20555 |
---|
87 | |
---|
88 | CHARACTER*50 :: CCDESC(0:JPMAXSTAT) = "" |
---|
89 | CHARACTER*3 :: CCTYPE(0:JPMAXSTAT) = "" |
---|
90 | |
---|
91 | INTEGER(KIND=JPIM) :: NPROC_STATS = 1 |
---|
92 | INTEGER(KIND=JPIM) :: MYPROC_STATS = 1 |
---|
93 | INTEGER(KIND=JPIM),ALLOCATABLE :: NPRCIDS_STATS(:) |
---|
94 | |
---|
95 | INTEGER(KIND=JPIM) :: NTMEM(0:JPMAXSTAT,5) |
---|
96 | INTEGER(KIND=JPIM) :: NSTATS_MEM=0 |
---|
97 | |
---|
98 | INTEGER(KIND=JPIM) :: NPRNT_STATS=3 |
---|
99 | |
---|
100 | !$OMP THREADPRIVATE(ccdesc,cctype,lbarrier_stats,ldetailed_stats,lgstats_label,lstats,lstats_alloc) |
---|
101 | !$OMP THREADPRIVATE(lstats_comms,lstats_mem,lstats_omp,lstatscpu,lsyncstats,ltrace_stats,myproc_stats) |
---|
102 | !$OMP THREADPRIVATE(ncalls,ncalls_total,nprnt_stats,nproc_stats,nstats_mem,ntmem,ntrace_stats,thistcpu) |
---|
103 | !$OMP THREADPRIVATE(thistime,thisvcpu,time_last_call,timelcall,timemax,timesqsum,timesum,timesumb) |
---|
104 | !$OMP THREADPRIVATE(ttcpulcall,ttcpusum,tvcpulcall,tvcpusum) |
---|
105 | !$OMP THREADPRIVATE(ncall_trace,nprcids_stats,time_start,time_trace) |
---|
106 | END MODULE YOMGSTATS |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|