dsecndtst (l) - Linux Manuals

NAME

SYNOPSIS

PROGRAM TEST5

    
INTEGER NMAX, ITS

    
PARAMETER ( NMAX = 100, ITS = 5000 )

    
INTEGER I, J

    
DOUBLE PRECISION ALPHA, AVG, T1, T2, TNOSEC

    
DOUBLE PRECISION X( NMAX ), Y( NMAX )

    
DOUBLE PRECISION DSECND

    
EXTERNAL DSECND

    
INTRINSIC DBLE

    
DO 10 I = 1, NMAX

    
X( I ) = DBLE( 1 ) / DBLE( I )

    
Y( I ) = DBLE( NMAX-I ) / DBLE( NMAX )

    
10 CONTINUE

    
ALPHA = 0.315D0

    
T1 = DSECND( )

    
DO 30 J = 1, ITS

    
DO 20 I = 1, NMAX

    
Y( I ) = Y( I ) + ALPHA*X( I )

    
20 CONTINUE

    
ALPHA = -ALPHA

    
30 CONTINUE

    
T2 = DSECND( )

    
WRITE( 6, 9999 )T2 - T1

    
IF( T2-T1.GT.0.0D0 ) THEN

    
WRITE( 6, 9998 )1.0D0 / ( T2-T1 )

    
ELSE

    
WRITE( 6, 9994 )

    
END IF

    
TNOSEC = T2 - T1

    
T1 = DSECND( )

    
DO 50 J = 1, ITS

    
DO 40 I = 1, NMAX

    
Y( I ) = Y( I ) + ALPHA*X( I )

    
40 CONTINUE

    
ALPHA = -ALPHA

    
T2 = DSECND( )

    
50 CONTINUE

    
WRITE( 6, 9997 )T2 - T1

    
AVG = ( ( T2-T1 )-TNOSEC )*1000.D0 / DBLE( ITS )

    
WRITE( 6, 9996 )AVG

    
IF( TNOSEC.GT.0.0D0 ) WRITE( 6, 9995 )1000.D0*AVG / TNOSEC

    
9999 FORMAT( aq Time for 1,000,000 DAXPY ops = aq, G10.3, aq secondsaq )

    
9998 FORMAT( aq DAXPY performance rate = aq, G10.3, aq mflops aq )

    
9997 FORMAT( aq Including DSECND, time = aq, G10.3, aq secondsaq )

    
9996 FORMAT( aq Average time for DSECND = aq, G10.3, aq millisecondsaq )

    
9995 FORMAT( aq Equivalent floating point ops = aq, G10.3, aq opsaq )

    
9994 FORMAT( aq *** Error: Time for operations was zeroaq )

    
CALL MYSUB(NMAX,X,Y)

    
END

    
SUBROUTINE MYSUB(N,X,Y)

    
INTEGER N

    
DOUBLE PRECISION X(N), Y(N)

    
RETURN

    
END

PURPOSE