1 |
jmc |
1.3 |
C $Header: /u/gcmpack/MITgcm/pkg/showflops/showflops_inloop.F,v 1.2 2007/07/31 22:33:43 ce107 Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
jmc |
1.3 |
#include "SHOWFLOPS_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: SHOWFLOPS_INLOOP |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE SHOWFLOPS_INLOOP( iloop, myThid ) |
10 |
|
|
|
11 |
|
|
C !DESCRIPTION: \bv |
12 |
|
|
C *================================================================* |
13 |
|
|
C | SUBROUTINE showflops_inloop |
14 |
|
|
C | o Do runtime timing |
15 |
|
|
C *================================================================* |
16 |
|
|
C \ev |
17 |
|
|
|
18 |
|
|
C !USES: |
19 |
|
|
IMPLICIT NONE |
20 |
|
|
C == Global variables == |
21 |
|
|
#include "SIZE.h" |
22 |
|
|
#include "EEPARAMS.h" |
23 |
|
|
#include "PARAMS.h" |
24 |
|
|
#include "SHOWFLOPS.h" |
25 |
|
|
|
26 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
27 |
|
|
C == Routine arguments == |
28 |
jmc |
1.3 |
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 |
heimbach |
1.1 |
C updated. |
33 |
|
|
C myThid - thread number for this instance of the routine. |
34 |
|
|
integer iloop |
35 |
jmc |
1.3 |
INTEGER myThid |
36 |
heimbach |
1.1 |
|
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 |
|
|
CEOP |
48 |
|
|
|
49 |
|
|
#ifdef ALLOW_DEBUG |
50 |
|
|
IF (debugMode) CALL DEBUG_ENTER('SHOWFLOPS_INLOOP',myThid) |
51 |
|
|
#endif |
52 |
|
|
|
53 |
|
|
#ifdef ALLOW_RUNCLOCK |
54 |
|
|
IF (useRunClock) THEN |
55 |
|
|
RC_CONT=RUNCLOCK_CONTINUE( myThid ) |
56 |
|
|
IF (.NOT.RC_CONT) RETURN |
57 |
|
|
ENDIF |
58 |
|
|
#endif /* ALLOW_RUNCLOCK */ |
59 |
|
|
#ifdef TIME_PER_TIMESTEP |
60 |
|
|
CCE107 Time per timestep information |
61 |
|
|
_BEGIN_MASTER( myThid ) |
62 |
|
|
CALL TIMER_GET_TIME( utnew, stnew, wtnew ) |
63 |
|
|
WRITE(msgBuf,'(A34,3F10.6,I8)') |
64 |
|
|
$ 'User, system and wallclock time:', utnew - utold, |
65 |
|
|
$ stnew - stold, wtnew - wtold, iloop |
66 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
67 |
|
|
utold = utnew |
68 |
|
|
stold = stnew |
69 |
|
|
wtold = wtnew |
70 |
|
|
_END_MASTER( myThid ) |
71 |
|
|
#endif |
72 |
|
|
#ifdef USE_PAPI_FLOPS |
73 |
|
|
CCE107 PAPI summary performance |
74 |
|
|
_BEGIN_MASTER( myThid ) |
75 |
|
|
#ifdef USE_FLIPS |
76 |
|
|
call PAPIF_flips(real_time, proc_time, flpops, mflops, check) |
77 |
|
|
#else |
78 |
|
|
call PAPIF_flops(real_time, proc_time, flpops, mflops, check) |
79 |
|
|
#endif |
80 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A,F12.6,A34,I8)') |
81 |
heimbach |
1.1 |
$ mflops, ' ', mflops*proc_time/(real_time + 1E-36), |
82 |
jmc |
1.3 |
$ 'Mflop/s during timestep ', iloop |
83 |
heimbach |
1.1 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
84 |
|
|
#ifdef PAPI_VERSION |
85 |
|
|
call PAPIF_ipc(real_time, proc_time, instr, ipc, check) |
86 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A,F12.6,A34,I8)') |
87 |
heimbach |
1.1 |
$ ipc, ' ', ipc*proc_time/(real_time + 1E-36), |
88 |
jmc |
1.3 |
$ 'IPC during timestep ', iloop |
89 |
heimbach |
1.1 |
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
90 |
|
|
#endif |
91 |
|
|
_END_MASTER( myThid ) |
92 |
|
|
#else |
93 |
|
|
#ifdef USE_PCL_FLOPS |
94 |
|
|
CCE107 PCL summary performance |
95 |
|
|
_BEGIN_MASTER( myThid ) |
96 |
|
|
res = PCLstop(descr, i_result, fp_result, nevents) |
97 |
|
|
do ipcl = 1, nevents |
98 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A2,A22,A17,I8)'), fp_result(ipcl), |
99 |
heimbach |
1.1 |
$ ' ', pcl_counter_name(pcl_counter_list(ipcl)), |
100 |
|
|
$ 'during timestep ', iloop |
101 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
102 |
|
|
enddo |
103 |
|
|
res = PCLstart(descr, pcl_counter_list, nevents, flags) |
104 |
|
|
_END_MASTER( myThid ) |
105 |
|
|
#endif |
106 |
|
|
#endif |
107 |
|
|
|
108 |
|
|
#ifdef ALLOW_DEBUG |
109 |
|
|
IF (debugMode) CALL DEBUG_LEAVE('SHOWFLOPS_INLOOP',myThid) |
110 |
|
|
#endif |
111 |
|
|
|
112 |
|
|
END |
113 |
|
|
|