[Next] [Previous] [Top]

Example Timer Usage for T3D (Fortran


         c***********************************************************************
               program timeTHIS
         c***********************************************************************
         c Example showing calibration and usage of timing routine irtc() on T3D.
         c This timer returns elapsed clock ticks from real-time clock.
         c Based on code by T.Kohno (T.Williams)
         c~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               real TicksPerSec
               parameter (TicksPerSec = 1500015001.0)
               integer StartTime,EndTime,TCal
               integer i,dummy,pe,npes
               real xx,TotalSecs
               intrinsic MY_PE
         c***********************************************************************
         
         c To avoid division on T3D, store 1/TicksPerSec:
               SecsPerTick = 1.0/TicksPerSec
         
         c Call timer once to make sure it sets up its own internal tables, etc.
               dummy = irtc()
         
         c Call timer twice to compute overhead for typical call pair (calibrate
         c the timer); convert to seconds and store as floating-point numbers:
               StartTime = irtc()
               EndTime = irtc()
         c Store the calibration value (in seconds):
               TCal = EndTime - StartTime
               
         c Time a loop:
               StartTime = irtc()
               xx = 0.0
               do i=1,100000
                 xx = xx + i
               enddo
               EndTime = irtc()
               TotalSecs = (EndTime - StartTime - TCal)*SecsPerTick
         
         c Write the timing and calibration results:
               pe = MY_PE()
               npes = N$PES
               write(*,*) `pe `,pe,' looptime = `,TotalSecs,' secs. (Tcal = `,
              $  TCal,' tics)'
         c This prevents the loop from getting removed by optimization in cf77:
               if (pe .eq. 0) write(*,*) `zzz Ignore this line...',xx
         
               call exit(0)
               end

Timing MPP Codes - (Lab instruction 6/19/95)
[Next] [Previous] [Top]

Generated with CERN WebMaker