LAPACK 3.3.1
Linear Algebra PACKage

dsecndtst.f

Go to the documentation of this file.
00001       PROGRAM TEST5
00002 *
00003 *  -- LAPACK test routine (version 3.3.1) --
00004 *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
00005 *  -- April 2011                                                      --
00006 *
00007 *     .. Parameters ..
00008       INTEGER            NMAX, ITS
00009       PARAMETER          ( NMAX = 1000, ITS = 50000 )
00010 *     ..
00011 *     .. Local Scalars ..
00012       INTEGER            I, J
00013       DOUBLE PRECISION   ALPHA, AVG, T1, T2, TNOSEC, TOTAL
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 *    .. Figure TOTAL flops ..
00028       TOTAL = DBLE(NMAX) * DBLE(ITS) * 2.0
00029 *
00030 *     Initialize X and Y
00031 *
00032       DO 10 I = 1, NMAX
00033          X( I ) = DBLE( 1 ) / DBLE( I )
00034          Y( I ) = DBLE( NMAX-I ) / DBLE( NMAX )
00035    10 CONTINUE
00036       ALPHA = 0.315D0
00037 *
00038 *     Time TOTAL SAXPY operations
00039 *
00040       T1 = DSECND( )
00041       DO 30 J = 1, ITS
00042          DO 20 I = 1, NMAX
00043             Y( I ) = Y( I ) + ALPHA*X( I )
00044    20    CONTINUE
00045          ALPHA = -ALPHA
00046    30 CONTINUE
00047       T2 = DSECND( )
00048       TNOSEC = T2 - T1
00049       WRITE( 6, 9999 )TOTAL, TNOSEC
00050       IF( TNOSEC.GT.0.0 ) THEN
00051          WRITE( 6, 9998 )(TOTAL/1.0D6)/TNOSEC
00052       ELSE
00053          WRITE( 6, 9994 )
00054       END IF
00055 *
00056 *     Time TOTAL DAXPY operations with DSECND in the outer loop
00057 *
00058       T1 = DSECND( )
00059       DO 50 J = 1, ITS
00060          DO 40 I = 1, NMAX
00061             Y( I ) = Y( I ) + ALPHA*X( I )
00062    40    CONTINUE
00063          ALPHA = -ALPHA
00064          T2 = DSECND( )
00065    50 CONTINUE
00066 *
00067 *     Compute the time used in milliseconds used by an average call
00068 *     to DSECND.
00069 *
00070       WRITE( 6, 9997 )T2 - T1
00071       AVG = ( ( T2-T1 ) - TNOSEC ) * 1000.0D+00/DBLE( ITS )
00072       IF( AVG.GT.0.0)
00073      $   WRITE( 6, 9996 )AVG
00074 *
00075 *     Compute the equivalent number of floating point operations used
00076 *     by an average call to DSECND.
00077 *
00078       IF(( AVG.GT.0.0 ).AND.( TNOSEC.GT.0.0 ))
00079      $   WRITE( 6, 9995 )(AVG/1000) * TOTAL / TNOSEC
00080 *
00081  9999 FORMAT( ' Time for ', G10.3,' DAXPY ops = ', G10.3, ' seconds' )
00082  9998 FORMAT( ' DAXPY performance rate        = ', G10.3, ' mflops ' )
00083  9997 FORMAT( ' Including DSECND, time        = ', G10.3, ' seconds' )
00084  9996 FORMAT( ' Average time for DSECND       = ', G10.3,
00085      $      ' milliseconds' )
00086  9995 FORMAT( ' Equivalent floating point ops = ', G10.3, ' ops' )
00087  9994 FORMAT( ' *** Warning:  Time for operations was less or equal',
00088      $        ' than zero => timing in TESTING might be dubious' )
00089       CALL MYSUB(NMAX,X,Y)
00090       END
00091       SUBROUTINE MYSUB(N,X,Y)
00092       INTEGER N
00093       DOUBLE PRECISION X(N), Y(N)
00094       RETURN
00095       END
 All Files Functions