LAPACK 3.3.0

dsecndtst.f

Go to the documentation of this file.
00001       PROGRAM TEST5
00002 *
00003 *  -- LAPACK test routine (version 3.2) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *     November 2006
00006 *
00007 *     .. Parameters ..
00008       INTEGER            NMAX, ITS
00009       PARAMETER          ( NMAX = 100, ITS = 5000 )
00010 *     ..
00011 *     .. Local Scalars ..
00012       INTEGER            I, J
00013       DOUBLE PRECISION   ALPHA, AVG, T1, T2, TNOSEC
00014 *     ..
00015 *     .. Local Arrays ..
00016       DOUBLE PRECISION   X( NMAX ), Y( NMAX )
00017 *     ..
00018 *     .. External Functions ..
00019       DOUBLE PRECISION   DSECND
00020       EXTERNAL           DSECND
00021 *     ..
00022 *     .. Intrinsic Functions ..
00023       INTRINSIC          DBLE
00024 *     ..
00025 *     .. Executable Statements ..
00026 *
00027 *
00028 *     Initialize X and Y
00029 *
00030       DO 10 I = 1, NMAX
00031          X( I ) = DBLE( 1 ) / DBLE( I )
00032          Y( I ) = DBLE( NMAX-I ) / DBLE( NMAX )
00033    10 CONTINUE
00034       ALPHA = 0.315D0
00035 *
00036 *     Time 1,000,000 DAXPY operations
00037 *
00038       T1 = DSECND( )
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 = DSECND( )
00046       WRITE( 6, 9999 )T2 - T1
00047       IF( T2-T1.GT.0.0D0 ) THEN
00048          WRITE( 6, 9998 )1.0D0 / ( T2-T1 )
00049       ELSE
00050          WRITE( 6, 9994 )
00051       END IF
00052       TNOSEC = T2 - T1
00053 *
00054 *     Time 1,000,000 DAXPY operations with DSECND in the outer loop
00055 *
00056       T1 = DSECND( )
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 = DSECND( )
00063    50 CONTINUE
00064 *
00065 *     Compute the time in milliseconds used by an average call
00066 *     to DSECND.
00067 *
00068       WRITE( 6, 9997 )T2 - T1
00069       AVG = ( ( T2-T1 )-TNOSEC )*1000.D0 / DBLE( ITS )
00070       WRITE( 6, 9996 )AVG
00071 *
00072 *     Compute the equivalent number of floating point operations used
00073 *     by an average call to DSECND.
00074 *
00075       IF( TNOSEC.GT.0.0D0 )
00076      $   WRITE( 6, 9995 )1000.D0*AVG / TNOSEC
00077 *
00078  9999 FORMAT( ' Time for 1,000,000 DAXPY ops  = ', G10.3, ' seconds' )
00079  9998 FORMAT( ' DAXPY performance rate        = ', G10.3, ' mflops ' )
00080  9997 FORMAT( ' Including DSECND, time        = ', G10.3, ' seconds' )
00081  9996 FORMAT( ' Average time for DSECND       = ', G10.3,
00082      $      ' milliseconds' )
00083  9995 FORMAT( ' Equivalent floating point ops = ', G10.3, ' ops' )
00084  9994 FORMAT( ' *** Error:  Time for operations was zero' )
00085       CALL MYSUB(NMAX,X,Y)
00086       END
00087       SUBROUTINE MYSUB(N,X,Y)
00088       INTEGER N
00089       DOUBLE PRECISION X(N), Y(N)
00090       RETURN
00091       END
 All Files Functions