/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/code_ad_moc/timptim_inloop.F
ViewVC logotype

Annotation of /MITgcm_contrib/heimbach/OpenAD/code_ad_moc/timptim_inloop.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Mon Sep 15 22:16:01 2008 UTC (18 years, 1 month ago) by utke
Branch: MAIN
keep this version around

1 utke 1.1 C $Header: /u/gcmpack/MITgcm_contrib/heimbach/OpenAD/code_regress/timptim_inloop.F,v 1.1 2007/11/20 15:20:58 utke Exp $
2     C $Name: $
3    
4     #include "PACKAGES_CONFIG.h"
5     #include "CPP_OPTIONS.h"
6    
7     CBOP
8     C !ROUTINE: TIMPTIM_INLOOP
9     C !INTERFACE:
10     SUBROUTINE TIMPTIM_INLOOP( iloop, myThid )
11    
12     C !DESCRIPTION: \bv
13     C *================================================================*
14     C | SUBROUTINE timptim_inloop
15     C | o Do runtime timing
16     C *================================================================*
17     C \ev
18    
19     C !USES:
20     IMPLICIT NONE
21     C == Global variables ==
22     #include "SIZE.h"
23     #include "EEPARAMS.h"
24     #include "PARAMS.h"
25    
26     C !INPUT/OUTPUT PARAMETERS:
27     C == Routine arguments ==
28     C note: under the multi-threaded model myiter and
29     C mytime are local variables passed around as routine
30     C arguments. Although this is fiddly it saves the need to
31     C impose additional synchronisation points when they are
32     C updated.
33     C myThid - thread number for this instance of the routine.
34     integer iloop
35     INTEGER myThid
36    
37     C !FUNCTIONS:
38     C == Functions ==
39     #ifdef ALLOW_RUNCLOCK
40     LOGICAL RUNCLOCK_CONTINUE
41     LOGICAL RC_CONT
42     #endif
43    
44     C !LOCAL VARIABLES:
45     C == Local variables ==
46    
47     #if defined(TIME_PER_TIMESTEP) || defined(USE_PAPI_FLOPS) || defined(USE_PCL_FLOPS)
48     CHARACTER*(MAX_LEN_MBUF) msgBuf
49     #ifdef TIME_PER_TIMESTEP
50     CCE107 common block for per timestep timing
51     C !TIMING VARIABLES
52     C == Timing variables ==
53     REAL*8 utnew, utold, stnew, stold, wtnew, wtold
54     DATA utnew, utold, stnew, stold, wtnew, wtold /6*0.0D0/
55     #endif
56     #ifdef USE_PAPI_FLOPS
57     CCE107 common block for PAPI summary performance
58     #include <fpapi.h>
59     INTEGER*8 flpops, instr
60     DATA flpops, instr /2*0/
61     INTEGER check
62     REAL*4 real_time, proc_time, mflops, ipc
63     DATA real_time, proc_time, mflops, ipc /4*0.0E0/
64     #else
65     #ifdef USE_PCL_FLOPS
66     CCE107 common block for PCL summary performance
67     #include <pclh.f>
68     INTEGER pcl_counter_list(5), flags, nevents, res, ipcl
69     INTEGER*8 i_result(5), descr
70     REAL*8 fp_result(5)
71     COMMON /pclvars/ i_result, descr, fp_result, pcl_counter_list,
72     $ flags, nevents
73     INTEGER nmaxevents
74     PARAMETER (nmaxevents = 61)
75     CHARACTER*22 pcl_counter_name(0:nmaxevents-1)
76     COMMON /pclnames/ pcl_counter_name
77     #endif
78     #endif
79     #endif
80    
81     CEOP
82    
83     #ifdef ALLOW_DEBUG
84     IF (debugMode) CALL DEBUG_ENTER('TIMPTIM_INLOOP',myThid)
85     #endif
86    
87     #ifdef ALLOW_RUNCLOCK
88     IF (useRunClock) THEN
89     RC_CONT=RUNCLOCK_CONTINUE( myThid )
90     IF (.NOT.RC_CONT) RETURN
91     ENDIF
92     #endif /* ALLOW_RUNCLOCK */
93     #ifdef TIME_PER_TIMESTEP
94     CCE107 Time per timestep information
95     _BEGIN_MASTER( myThid )
96     CALL TIMER_GET_TIME( utnew, stnew, wtnew )
97     WRITE(msgBuf,'(A34,3F10.6,I8)')
98     $ 'User, system and wallclock time:', utnew - utold,
99     $ stnew - stold, wtnew - wtold, iloop
100     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
101     utold = utnew
102     stold = stnew
103     wtold = wtnew
104     _END_MASTER( myThid )
105     #endif
106     #ifdef USE_PAPI_FLOPS
107     CCE107 PAPI summary performance
108     _BEGIN_MASTER( myThid )
109     #ifdef USE_FLIPS
110     call PAPIF_flips(real_time, proc_time, flpops, mflops, check)
111     #else
112     call PAPIF_flops(real_time, proc_time, flpops, mflops, check)
113     #endif
114     WRITE(msgBuf,'(F10.6,A,F10.6,A34,I8)')
115     $ mflops, ' ', mflops*proc_time/(real_time + 1E-36),
116     $ 'Mflop/s during timestep ', iloop
117     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
118     #ifdef PAPI_VERSION
119     call PAPIF_ipc(real_time, proc_time, instr, ipc, check)
120     WRITE(msgBuf,'(F10.6,A,F10.6,A34,I8)')
121     $ ipc, ' ', ipc*proc_time/(real_time + 1E-36),
122     $ 'IPC during timestep ', iloop
123     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
124     #endif
125     _END_MASTER( myThid )
126     #else
127     #ifdef USE_PCL_FLOPS
128     CCE107 PCL summary performance
129     _BEGIN_MASTER( myThid )
130     res = PCLstop(descr, i_result, fp_result, nevents)
131     do ipcl = 1, nevents
132     WRITE(msgBuf,'(F10.6,A2,A22,A17,I8)'), fp_result(ipcl),
133     $ ' ', pcl_counter_name(pcl_counter_list(ipcl)),
134     $ 'during timestep ', iloop
135     CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1)
136     enddo
137     res = PCLstart(descr, pcl_counter_list, nevents, flags)
138     _END_MASTER( myThid )
139     #endif
140     #endif
141    
142     #ifdef ALLOW_DEBUG
143     IF (debugMode) CALL DEBUG_LEAVE('TIMPTIM_INLOOP',myThid)
144     #endif
145    
146     END
147    

  ViewVC Help
Powered by ViewVC 1.1.22