C $Id: the_model_main.F,v 1.2 2006/05/12 22:26:20 ce107 Exp $ SUBROUTINE THE_MODEL_MAIN C /==========================================================\ C | SUBROUTINE THE_MODEL_MAIN | C | o Master controlling routine for model using the MITgcm | C | UV parallel wrapper. | C |==========================================================| C | THE_MODEL_MAIN is invoked by the MITgcm UV parallel | C | wrapper with a single integer argument "myThid". This | C | variable identifies the thread number of an instance of | C | THE_MODEL_MAIN. Each instance of THE_MODEL_MAIN works | C | on a particular region of the models domain and | C | synchronises with other instances as necessary. The | C | routine has to "understand" the MITgcm parallel | C | environment and the numerical algorithm. Editing this | C | routine is best done with some knowledge of both aspects.| C | Notes | C | ===== | C | C*P* comments indicating place holders for which code is | C | presently being developed. | C \==========================================================/ C == Global variables === #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" #include "CG2D.h" #ifdef ALLOW_MPI #include "mpif.h" #include "MPI_INFO.h" #endif #if defined(USE_PAPI_FLOPS) || defined(USE_PAPI_FLIPS) #include "PAPI.h" #endif C == Routine arguments == C myThid - Thread number for this instance of the routine. INTEGER myThid C == Local variables == INTEGER I REAL*8 wTime1, wTime2 REAL*8 fCount, fTime, fRate, wSetSize C-- Set model initial conditions CALL INITIALISE( myThid ) C-- Begin time stepping loop #ifdef USE_MPI_TIME wTime1=MPI_Wtime() #else CALL CLOC(wTime1) #endif C initialize PAPI stuff #if defined(USE_PAPI_FLOPS) call PAPIF_flops(real_time, proc_time, flpops, mflops, check) #else #if defined(USE_PAPI_FLIPS) call PAPIF_flips(real_time, proc_time, flpops, mflops, check) #endif #endif DO I=1, nTimeSteps nIter = nIter0 + I CALL CG2D ENDDO #ifdef USE_MPI_TIME wTime2=MPI_Wtime() #else CALL CLOC(wTime2) #endif C CALL PLOT_FIELD_XYR8( cg2d_x , 'CG2D_X AFTER SOLVE') C CALL PLOT_FIELD_XYR8( cg2d_Ax, 'CG2D_AX AFTER SOLVE') C CALL PLOT_FIELD_XYR8( cg2d_b, 'CG2D_B AFTER SOLVE') C CALL PLOT_FIELD_XYR8( cg2d_r, 'CG2D_R AFTER SOLVE') #if defined(USE_PAPI_FLOPS) #if !defined(PAPI_PER_ITERATION) && !defined(PAPI_PER_TIMESTEP) call PAPIF_flops(real_time, proc_time, flpops, mflops, check) WRITE(6,'(F10.3,A7,F10.3,A36)') mflops, ' user ', $ mflops*proc_time/real_time, $ ' wallclock Mflop/s during execution' #endif #else #if defined(USE_PAPI_FLIPS) #if !defined(PAPI_PER_ITERATION) && !defined(PAPI_PER) call PAPIF_flips(real_time, proc_time, flpops, mflops, check) WRITE(6,'(F10.3,A7,F10.3,A36)') mflops, ' user ', $ mflops*proc_time/real_time, $ ' wallclock Mflip/s during execution' #endif #endif #endif WRITE(6,*) 'Wall clock time = ', wTime2-wTime1 fTime = wTime2-wTime1 fCount = DBLE(nTImeSteps)*DBLE(cg2dMaxIters)*34.D0*DBLE(sNx) $ *DBLE(sNy) fRate = fCount/fTime/1.D6 WRITE(6,*) 'PID ',myProcId+1,' OF ',numberOfProcs,' MFLOP/s = ', $ fRate wSetSize=DBLE((sNx+2*OLx)*(sNy+2*OLy)*8*11)/1024./1024. WRITE(6,*) 'PID ',myProcId+1,' OF ',numberOfProcs,' MB = ', $ wSetSize WRITE(6,'(4(1X,I4),3F10.4)') & numberOfProcs, myProcId, sNx, sNy, & fTime, fRate, wSetSize RETURN END