1 |
ce107 |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/showflops/showflops_inloop.F,v 1.1 2007/06/01 16:41:12 heimbach Exp $ |
2 |
heimbach |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PACKAGES_CONFIG.h" |
5 |
|
|
#include "CPP_OPTIONS.h" |
6 |
|
|
|
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: SHOWFLOPS_INLOOP |
9 |
|
|
C !INTERFACE: |
10 |
|
|
SUBROUTINE SHOWFLOPS_INLOOP( iloop, myThid ) |
11 |
|
|
|
12 |
|
|
C !DESCRIPTION: \bv |
13 |
|
|
C *================================================================* |
14 |
|
|
C | SUBROUTINE showflops_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 |
|
|
#include "SHOWFLOPS.h" |
26 |
|
|
|
27 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
28 |
|
|
C == Routine arguments == |
29 |
|
|
C note: under the multi-threaded model myiter and |
30 |
|
|
C mytime are local variables passed around as routine |
31 |
|
|
C arguments. Although this is fiddly it saves the need to |
32 |
|
|
C impose additional synchronisation points when they are |
33 |
|
|
C updated. |
34 |
|
|
C myThid - thread number for this instance of the routine. |
35 |
|
|
integer iloop |
36 |
|
|
INTEGER myThid |
37 |
|
|
|
38 |
|
|
C !FUNCTIONS: |
39 |
|
|
C == Functions == |
40 |
|
|
#ifdef ALLOW_RUNCLOCK |
41 |
|
|
LOGICAL RUNCLOCK_CONTINUE |
42 |
|
|
LOGICAL RC_CONT |
43 |
|
|
#endif |
44 |
|
|
|
45 |
|
|
C !LOCAL VARIABLES: |
46 |
|
|
C == Local variables == |
47 |
|
|
|
48 |
|
|
CEOP |
49 |
|
|
|
50 |
|
|
#ifdef ALLOW_DEBUG |
51 |
|
|
IF (debugMode) CALL DEBUG_ENTER('SHOWFLOPS_INLOOP',myThid) |
52 |
|
|
#endif |
53 |
|
|
|
54 |
|
|
#ifdef ALLOW_RUNCLOCK |
55 |
|
|
IF (useRunClock) THEN |
56 |
|
|
RC_CONT=RUNCLOCK_CONTINUE( myThid ) |
57 |
|
|
IF (.NOT.RC_CONT) RETURN |
58 |
|
|
ENDIF |
59 |
|
|
#endif /* ALLOW_RUNCLOCK */ |
60 |
|
|
#ifdef TIME_PER_TIMESTEP |
61 |
|
|
CCE107 Time per timestep information |
62 |
|
|
_BEGIN_MASTER( myThid ) |
63 |
|
|
CALL TIMER_GET_TIME( utnew, stnew, wtnew ) |
64 |
|
|
WRITE(msgBuf,'(A34,3F10.6,I8)') |
65 |
|
|
$ 'User, system and wallclock time:', utnew - utold, |
66 |
|
|
$ stnew - stold, wtnew - wtold, iloop |
67 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
68 |
|
|
utold = utnew |
69 |
|
|
stold = stnew |
70 |
|
|
wtold = wtnew |
71 |
|
|
_END_MASTER( myThid ) |
72 |
|
|
#endif |
73 |
|
|
#ifdef USE_PAPI_FLOPS |
74 |
|
|
CCE107 PAPI summary performance |
75 |
|
|
_BEGIN_MASTER( myThid ) |
76 |
|
|
#ifdef USE_FLIPS |
77 |
|
|
call PAPIF_flips(real_time, proc_time, flpops, mflops, check) |
78 |
|
|
#else |
79 |
|
|
call PAPIF_flops(real_time, proc_time, flpops, mflops, check) |
80 |
|
|
#endif |
81 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A,F12.6,A34,I8)') |
82 |
heimbach |
1.1 |
$ mflops, ' ', mflops*proc_time/(real_time + 1E-36), |
83 |
|
|
$ 'Mflop/s during timestep ', iloop |
84 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
85 |
|
|
#ifdef PAPI_VERSION |
86 |
|
|
call PAPIF_ipc(real_time, proc_time, instr, ipc, check) |
87 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A,F12.6,A34,I8)') |
88 |
heimbach |
1.1 |
$ ipc, ' ', ipc*proc_time/(real_time + 1E-36), |
89 |
|
|
$ 'IPC during timestep ', iloop |
90 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
91 |
|
|
#endif |
92 |
|
|
_END_MASTER( myThid ) |
93 |
|
|
#else |
94 |
|
|
#ifdef USE_PCL_FLOPS |
95 |
|
|
CCE107 PCL summary performance |
96 |
|
|
_BEGIN_MASTER( myThid ) |
97 |
|
|
res = PCLstop(descr, i_result, fp_result, nevents) |
98 |
|
|
do ipcl = 1, nevents |
99 |
ce107 |
1.2 |
WRITE(msgBuf,'(F12.6,A2,A22,A17,I8)'), fp_result(ipcl), |
100 |
heimbach |
1.1 |
$ ' ', pcl_counter_name(pcl_counter_list(ipcl)), |
101 |
|
|
$ 'during timestep ', iloop |
102 |
|
|
CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
103 |
|
|
enddo |
104 |
|
|
res = PCLstart(descr, pcl_counter_list, nevents, flags) |
105 |
|
|
_END_MASTER( myThid ) |
106 |
|
|
#endif |
107 |
|
|
#endif |
108 |
|
|
|
109 |
|
|
#ifdef ALLOW_DEBUG |
110 |
|
|
IF (debugMode) CALL DEBUG_LEAVE('SHOWFLOPS_INLOOP',myThid) |
111 |
|
|
#endif |
112 |
|
|
|
113 |
|
|
END |
114 |
|
|
|