LAPACK 3.3.0

secondtst.f

Go to the documentation of this file.
00001       PROGRAM TEST4
00002 *
00003 *  -- LAPACK test routine (version 3.2.2) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *     June 2010
00006 *
00007 *     .. Parameters ..
00008       INTEGER            NMAX, ITS
00009       PARAMETER          ( NMAX = 1000, ITS = 5000 )
00010 *     ..
00011 *     .. Local Scalars ..
00012       INTEGER            I, J
00013       REAL               ALPHA, AVG, T1, T2, TNOSEC
00014 *     ..
00015 *     .. Local Arrays ..
00016       REAL               X( NMAX ), Y( NMAX )
00017 *     ..
00018 *     .. External Functions ..
00019       REAL               SECOND
00020       EXTERNAL           SECOND
00021 *     ..
00022 *     .. Intrinsic Functions ..
00023       INTRINSIC          REAL
00024 *     ..
00025 *     .. Executable Statements ..
00026 *
00027 *
00028 *     Initialize X and Y
00029 *
00030       DO 10 I = 1, NMAX
00031          X( I ) = REAL( 1 ) / REAL( I )
00032          Y( I ) = REAL( NMAX-I ) / REAL( NMAX )
00033    10 CONTINUE
00034       ALPHA = 0.315
00035 *
00036 *     Time 10,000,000 SAXPY operations
00037 *
00038       T1 = SECOND( )
00039       DO 30 J = 1, ITS
00040          DO 20 I = 1, NMAX
00041             Y( I ) = Y( I ) + ALPHA*X( I )
00042    20    CONTINUE
00043          ALPHA = -ALPHA
00044    30 CONTINUE
00045       T2 = SECOND( )
00046       WRITE( 6, 9999 )T2 - T1
00047       IF( T2-T1.GT.0.0 ) THEN
00048          WRITE( 6, 9998 )10.0 / ( T2-T1 )
00049       ELSE
00050          WRITE( 6, 9994 )
00051       END IF
00052       TNOSEC = T2 - T1
00053 *
00054 *     Time 1,000,000 SAXPY operations with SECOND in the outer loop
00055 *
00056       T1 = SECOND( )
00057       DO 50 J = 1, ITS
00058          DO 40 I = 1, NMAX
00059             Y( I ) = Y( I ) + ALPHA*X( I )
00060    40    CONTINUE
00061          ALPHA = -ALPHA
00062          T2 = SECOND( )
00063    50 CONTINUE
00064 *
00065 *     Compute the time used in milliseconds used by an average call
00066 *     to SECOND.
00067 *
00068       WRITE( 6, 9997 )T2 - T1
00069       AVG = ( ( T2-T1 ) - TNOSEC ) * 1000.0E+00/REAL( ITS )
00070       IF( AVG.GT.0.0)
00071      $   WRITE( 6, 9996 )AVG
00072 *
00073 *     Compute the equivalent number of floating point operations used
00074 *     by an average call to SECOND.
00075 *
00076       IF(( AVG.GT.0.0 ).AND.( TNOSEC.GT.0.0 ))
00077      $   WRITE( 6, 9995 )1000.*AVG / TNOSEC
00078 *
00079  9999 FORMAT( ' Time for 10,000,000 SAXPY ops  = ', G10.3, ' seconds' )
00080  9998 FORMAT( ' SAXPY performance rate         = ', G10.3, ' mflops ' )
00081  9997 FORMAT( ' Including SECOND, time         = ', G10.3, ' seconds' )
00082  9996 FORMAT( ' Average time for SECOND        = ', G10.3,
00083      $      ' milliseconds' )
00084  9995 FORMAT( ' Equivalent floating point ops  = ', G10.3, ' ops' )
00085  9994 FORMAT( ' *** Warning:  Time for operations was less or equal',
00086      $        ' than zero => timing in TESTING might be dubious' )
00087       END
00088 
 All Files Functions