LAPACK 3.3.1
Linear Algebra PACKage
|
00001 PROGRAM TEST4 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 REAL ALPHA, AVG, T1, T2, TNOSEC, TOTAL 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 * .. Figure TOTAL flops .. 00028 TOTAL = REAL(NMAX) * REAL(ITS) * 2.0 00029 * 00030 * Initialize X and Y 00031 * 00032 DO 10 I = 1, NMAX 00033 X( I ) = REAL( 1 ) / REAL( I ) 00034 Y( I ) = REAL( NMAX-I ) / REAL( NMAX ) 00035 10 CONTINUE 00036 ALPHA = 0.315 00037 * 00038 * Time TOTAL SAXPY operations 00039 * 00040 T1 = SECOND( ) 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 = SECOND( ) 00048 TNOSEC = T2 - T1 00049 WRITE( 6, 9999 )TOTAL, TNOSEC 00050 IF( TNOSEC.GT.0.0 ) THEN 00051 WRITE( 6, 9998 )(TOTAL/1.0E6)/TNOSEC 00052 ELSE 00053 WRITE( 6, 9994 ) 00054 END IF 00055 * 00056 * Time TOTAL SAXPY operations with SECOND in the outer loop 00057 * 00058 T1 = SECOND( ) 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 = SECOND( ) 00065 50 CONTINUE 00066 * 00067 * Compute the time used in milliseconds used by an average call 00068 * to SECOND. 00069 * 00070 WRITE( 6, 9997 )T2 - T1 00071 AVG = ( ( T2-T1 ) - TNOSEC ) * 1000.0E+00/REAL( 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 SECOND. 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,' SAXPY ops = ', G10.3, ' seconds' ) 00082 9998 FORMAT( ' SAXPY performance rate = ', G10.3, ' mflops ' ) 00083 9997 FORMAT( ' Including SECOND, time = ', G10.3, ' seconds' ) 00084 9996 FORMAT( ' Average time for SECOND = ', 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 REAL X(N), Y(N) 00094 RETURN 00095 END