/[MITgcm]/MITgcm_contrib/cg2d_bench/the_model_main.F
ViewVC logotype

Contents of /MITgcm_contrib/cg2d_bench/the_model_main.F

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


Revision 1.2 - (show annotations) (download)
Fri May 12 22:26:20 2006 UTC (17 years, 10 months ago) by ce107
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +49 -6 lines
Modified to support PAPI, single/double precision, use of MPI_Wtime() and
line lenght > 72 columns.

1 C $Id: $
2 SUBROUTINE THE_MODEL_MAIN
3 C /==========================================================\
4 C | SUBROUTINE THE_MODEL_MAIN |
5 C | o Master controlling routine for model using the MITgcm |
6 C | UV parallel wrapper. |
7 C |==========================================================|
8 C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel |
9 C | wrapper with a single integer argument "myThid". This |
10 C | variable identifies the thread number of an instance of |
11 C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works |
12 C | on a particular region of the models domain and |
13 C | synchronises with other instances as necessary. The |
14 C | routine has to "understand" the MITgcm parallel |
15 C | environment and the numerical algorithm. Editing this |
16 C | routine is best done with some knowledge of both aspects.|
17 C | Notes |
18 C | ===== |
19 C | C*P* comments indicating place holders for which code is |
20 C | presently being developed. |
21 C \==========================================================/
22
23 C == Global variables ===
24 #include "SIZE.h"
25 #include "EEPARAMS.h"
26 #include "PARAMS.h"
27 #include "CG2D.h"
28 #ifdef ALLOW_MPI
29 #include "mpif.h"
30 #include "MPI_INFO.h"
31 #endif
32 #if defined(USE_PAPI_FLOPS) || defined(USE_PAPI_FLIPS)
33 #include "PAPI.h"
34 #endif
35
36 C == Routine arguments ==
37 C myThid - Thread number for this instance of the routine.
38 INTEGER myThid
39
40 C == Local variables ==
41 INTEGER I
42 REAL*8 wTime1, wTime2
43 REAL*8 fCount, fTime, fRate, wSetSize
44
45 C-- Set model initial conditions
46 CALL INITIALISE( myThid )
47
48 C-- Begin time stepping loop
49 #ifdef USE_MPI_TIME
50 wTime1=MPI_Wtime()
51 #else
52 CALL CLOC(wTime1)
53 #endif
54
55 C initialize PAPI stuff
56 #if defined(USE_PAPI_FLOPS)
57 call PAPIF_flops(real_time, proc_time, flpops, mflops, check)
58 #else
59 #if defined(USE_PAPI_FLIPS)
60 call PAPIF_flips(real_time, proc_time, flpops, mflops, check)
61 #endif
62 #endif
63
64 DO I=1, nTimeSteps
65 nIter = nIter0 + I
66 CALL CG2D
67 ENDDO
68
69 #ifdef USE_MPI_TIME
70 wTime2=MPI_Wtime()
71 #else
72 CALL CLOC(wTime2)
73 #endif
74
75 C CALL PLOT_FIELD_XYR8( cg2d_x , 'CG2D_X AFTER SOLVE')
76 C CALL PLOT_FIELD_XYR8( cg2d_Ax, 'CG2D_AX AFTER SOLVE')
77 C CALL PLOT_FIELD_XYR8( cg2d_b, 'CG2D_B AFTER SOLVE')
78 C CALL PLOT_FIELD_XYR8( cg2d_r, 'CG2D_R AFTER SOLVE')
79
80 #if defined(USE_PAPI_FLOPS)
81 #if !defined(PAPI_PER_ITERATION) && !defined(PAPI_PER_TIMESTEP)
82 call PAPIF_flops(real_time, proc_time, flpops, mflops, check)
83 WRITE(6,'(F10.3,A7,F10.3,A36)') mflops, ' user ',
84 $ mflops*proc_time/real_time,
85 $ ' wallclock Mflop/s during execution'
86 #endif
87 #else
88 #if defined(USE_PAPI_FLIPS)
89 #if !defined(PAPI_PER_ITERATION) && !defined(PAPI_PER)
90 call PAPIF_flips(real_time, proc_time, flpops, mflops, check)
91 WRITE(6,'(F10.3,A7,F10.3,A36)') mflops, ' user ',
92 $ mflops*proc_time/real_time,
93 $ ' wallclock Mflip/s during execution'
94 #endif
95 #endif
96 #endif
97 WRITE(6,*) 'Wall clock time = ', wTime2-wTime1
98 fTime = wTime2-wTime1
99 fCount = DBLE(nTImeSteps)*DBLE(cg2dMaxIters)*34.D0*DBLE(sNx)
100 $ *DBLE(sNy)
101 fRate = fCount/fTime/1.D6
102 WRITE(6,*) 'PID ',myProcId+1,' OF ',numberOfProcs,' MFLOP/s = ',
103 $ fRate
104 wSetSize=DBLE((sNx+2*OLx)*(sNy+2*OLy)*8*11)/1024./1024.
105 WRITE(6,*) 'PID ',myProcId+1,' OF ',numberOfProcs,' MB = ',
106 $ wSetSize
107 WRITE(6,'(4(1X,I4),3F10.4)')
108 & numberOfProcs, myProcId, sNx, sNy,
109 & fTime, fRate, wSetSize
110
111 RETURN
112 END
113

  ViewVC Help
Powered by ViewVC 1.1.22