C $Header: /home/ubuntu/mnt/e9_copy/MITgcm_contrib/heimbach/OpenAD/code_regress/Attic/timptim_inloop.F,v 1.2 2008/10/08 20:51:53 utke dead $ C $Name: $ #include "PACKAGES_CONFIG.h" #include "CPP_OPTIONS.h" CBOP C !ROUTINE: TIMPTIM_INLOOP C !INTERFACE: SUBROUTINE TIMPTIM_INLOOP( iloop, myThid ) C !DESCRIPTION: \bv C *================================================================* C | SUBROUTINE timptim_inloop C | o Do runtime timing C *================================================================* C \ev C !USES: IMPLICIT NONE C == Global variables == #include "SIZE.h" #include "EEPARAMS.h" #include "PARAMS.h" C !INPUT/OUTPUT PARAMETERS: C == Routine arguments == C note: under the multi-threaded model myiter and C mytime are local variables passed around as routine C arguments. Although this is fiddly it saves the need to C impose additional synchronisation points when they are C updated. C myThid - thread number for this instance of the routine. integer iloop INTEGER myThid C !FUNCTIONS: C == Functions == #ifdef ALLOW_RUNCLOCK LOGICAL RUNCLOCK_CONTINUE LOGICAL RC_CONT #endif C !LOCAL VARIABLES: C == Local variables == #if defined(TIME_PER_TIMESTEP) || defined(USE_PAPI_FLOPS) || defined(USE_PCL_FLOPS) CHARACTER*(MAX_LEN_MBUF) msgBuf #ifdef TIME_PER_TIMESTEP CCE107 common block for per timestep timing C !TIMING VARIABLES C == Timing variables == REAL*8 utnew, utold, stnew, stold, wtnew, wtold DATA utnew, utold, stnew, stold, wtnew, wtold /6*0.0D0/ #endif #ifdef USE_PAPI_FLOPS CCE107 common block for PAPI summary performance #include INTEGER*8 flpops, instr DATA flpops, instr /2*0/ INTEGER check REAL*4 real_time, proc_time, mflops, ipc DATA real_time, proc_time, mflops, ipc /4*0.0E0/ #else #ifdef USE_PCL_FLOPS CCE107 common block for PCL summary performance #include INTEGER pcl_counter_list(5), flags, nevents, res, ipcl INTEGER*8 i_result(5), descr REAL*8 fp_result(5) COMMON /pclvars/ i_result, descr, fp_result, pcl_counter_list, $ flags, nevents INTEGER nmaxevents PARAMETER (nmaxevents = 61) CHARACTER*22 pcl_counter_name(0:nmaxevents-1) COMMON /pclnames/ pcl_counter_name #endif #endif #endif CEOP #ifdef ALLOW_DEBUG IF (debugMode) CALL DEBUG_ENTER('TIMPTIM_INLOOP',myThid) #endif #ifdef ALLOW_RUNCLOCK IF (useRunClock) THEN RC_CONT=RUNCLOCK_CONTINUE( myThid ) IF (.NOT.RC_CONT) RETURN ENDIF #endif /* ALLOW_RUNCLOCK */ #ifdef TIME_PER_TIMESTEP CCE107 Time per timestep information _BEGIN_MASTER( myThid ) CALL TIMER_GET_TIME( utnew, stnew, wtnew ) WRITE(msgBuf,'(A34,3F10.6,I8)') $ 'User, system and wallclock time:', utnew - utold, $ stnew - stold, wtnew - wtold, iloop CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) utold = utnew stold = stnew wtold = wtnew _END_MASTER( myThid ) #endif #ifdef USE_PAPI_FLOPS CCE107 PAPI summary performance _BEGIN_MASTER( myThid ) #ifdef USE_FLIPS call PAPIF_flips(real_time, proc_time, flpops, mflops, check) #else call PAPIF_flops(real_time, proc_time, flpops, mflops, check) #endif WRITE(msgBuf,'(F10.6,A,F10.6,A34,I8)') $ mflops, ' ', mflops*proc_time/(real_time + 1E-36), $ 'Mflop/s during timestep ', iloop CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) #ifdef PAPI_VERSION call PAPIF_ipc(real_time, proc_time, instr, ipc, check) WRITE(msgBuf,'(F10.6,A,F10.6,A34,I8)') $ ipc, ' ', ipc*proc_time/(real_time + 1E-36), $ 'IPC during timestep ', iloop CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) #endif _END_MASTER( myThid ) #else #ifdef USE_PCL_FLOPS CCE107 PCL summary performance _BEGIN_MASTER( myThid ) res = PCLstop(descr, i_result, fp_result, nevents) do ipcl = 1, nevents WRITE(msgBuf,'(F10.6,A2,A22,A17,I8)'), fp_result(ipcl), $ ' ', pcl_counter_name(pcl_counter_list(ipcl)), $ 'during timestep ', iloop CALL PRINT_MESSAGE(msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) enddo res = PCLstart(descr, pcl_counter_list, nevents, flags) _END_MASTER( myThid ) #endif #endif #ifdef ALLOW_DEBUG IF (debugMode) CALL DEBUG_LEAVE('TIMPTIM_INLOOP',myThid) #endif END