LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
secondtst.f
Go to the documentation of this file.
1 *> \brief \b SECONDTST
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *
9 * Authors:
10 * ========
11 *
12 *> \author Univ. of Tennessee
13 *> \author Univ. of California Berkeley
14 *> \author Univ. of Colorado Denver
15 *> \author NAG Ltd.
16 *
17 *> \date November 2011
18 *
19 *> \ingroup auxOTHERcomputational
20 *
21 * ===================================================================== PROGRAM SECONDTST
22 *
23 * -- LAPACK test routine (version 3.4.0) --
24 *
25 * -- LAPACK computational routine (version 3.4.0) --
26 * -- LAPACK is a software package provided by Univ. of Tennessee, --
27 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
28 * November 2011
29 *
30 * =====================================================================
31 *
32 * .. Parameters ..
33  INTEGER NMAX, ITS
34  parameter ( nmax = 1000, its = 50000 )
35 * ..
36 * .. Local Scalars ..
37  INTEGER I, J
38  REAL ALPHA, AVG, T1, T2, TNOSEC, TOTAL
39 * ..
40 * .. Local Arrays ..
41  REAL X( nmax ), Y( nmax )
42 * ..
43 * .. External Functions ..
44  REAL SECOND
45  EXTERNAL second
46 * ..
47 * .. Intrinsic Functions ..
48  INTRINSIC real
49 * ..
50 * .. Executable Statements ..
51 *
52 * .. Figure TOTAL flops ..
53  total = REAL(NMAX) * REAL(ITS) * 2.0
54 *
55 * Initialize X and Y
56 *
57  DO 10 i = 1, nmax
58  x( i ) = REAL( 1 ) / REAL( i )
59  y( i ) = REAL( NMAX-I ) / REAL( nmax )
60  10 CONTINUE
61  alpha = 0.315
62 *
63 * Time TOTAL SAXPY operations
64 *
65  t1 = second( )
66  DO 30 j = 1, its
67  DO 20 i = 1, nmax
68  y( i ) = y( i ) + alpha*x( i )
69  20 CONTINUE
70  alpha = -alpha
71  30 CONTINUE
72  t2 = second( )
73  tnosec = t2 - t1
74  WRITE( 6, 9999 )total, tnosec
75  IF( tnosec.GT.0.0 ) THEN
76  WRITE( 6, 9998 )(total/1.0e6)/tnosec
77  ELSE
78  WRITE( 6, 9994 )
79  END IF
80 *
81 * Time TOTAL SAXPY operations with SECOND in the outer loop
82 *
83  t1 = second( )
84  DO 50 j = 1, its
85  DO 40 i = 1, nmax
86  y( i ) = y( i ) + alpha*x( i )
87  40 CONTINUE
88  alpha = -alpha
89  t2 = second( )
90  50 CONTINUE
91 *
92 * Compute the time used in milliseconds used by an average call
93 * to SECOND.
94 *
95  WRITE( 6, 9997 )t2 - t1
96  avg = ( ( t2-t1 ) - tnosec ) * 1000.0e+00/REAL( its )
97  IF( avg.GT.0.0)
98  \$ WRITE( 6, 9996 )avg
99 *
100 * Compute the equivalent number of floating point operations used
101 * by an average call to SECOND.
102 *
103  IF(( avg.GT.0.0 ).AND.( tnosec.GT.0.0 ))
104  \$ WRITE( 6, 9995 )(avg/1000) * total / tnosec
105 *
106  9999 FORMAT( ' Time for ', g10.3,' SAXPY ops = ', g10.3, ' seconds' )
107  9998 FORMAT( ' SAXPY performance rate = ', g10.3, ' mflops ' )
108  9997 FORMAT( ' Including SECOND, time = ', g10.3, ' seconds' )
109  9996 FORMAT( ' Average time for SECOND = ', g10.3,
110  \$ ' milliseconds' )
111  9995 FORMAT( ' Equivalent floating point ops = ', g10.3, ' ops' )
112  9994 FORMAT( ' *** Warning: Time for operations was less or equal',
113  \$ ' than zero => timing in TESTING might be dubious' )
114  CALL mysub(nmax,x,y)
115  END
116  SUBROUTINE mysub(N,X,Y)
117  INTEGER N
118  REAL X(n), Y(n)
119  RETURN
120  END
real function second()
SECOND Using ETIME
subroutine mysub(N, X, Y)
Definition: dsecndtst.f:121