LAPACK  3.9.0
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 2017
18 *
19 *> \ingroup auxOTHERcomputational
20 *
21 * ===================================================================== PROGRAM SECONDTST
22 *
23 * -- LAPACK test routine (version 3.8.0) --
24 *
25 * -- LAPACK computational routine (version 3.8.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 2017
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 * .. External Subroutines ..
48  EXTERNAL mysub
49 * ..
50 * .. Intrinsic Functions ..
51  INTRINSIC real
52 * ..
53 * .. Executable Statements ..
54 *
55 * .. Figure TOTAL flops ..
56  total = real(nmax) * real(its) * 2.0
57 *
58 * Initialize X and Y
59 *
60  DO 10 i = 1, nmax
61  x( i ) = real( 1 ) / real( i )
62  y( i ) = real( nmax-i ) / real( nmax )
63  10 CONTINUE
64  alpha = 0.315
65 *
66 * Time TOTAL SAXPY operations
67 *
68  t1 = second( )
69  DO 30 j = 1, its
70  DO 20 i = 1, nmax
71  y( i ) = y( i ) + alpha*x( i )
72  20 CONTINUE
73  alpha = -alpha
74  30 CONTINUE
75  t2 = second( )
76  tnosec = t2 - t1
77  WRITE( 6, 9999 )total, tnosec
78  IF( tnosec.GT.0.0 ) THEN
79  WRITE( 6, 9998 )(total/1.0e6)/tnosec
80  ELSE
81  WRITE( 6, 9994 )
82  END IF
83 *
84 * Time TOTAL SAXPY operations with SECOND in the outer loop
85 *
86  t1 = second( )
87  DO 50 j = 1, its
88  DO 40 i = 1, nmax
89  y( i ) = y( i ) + alpha*x( i )
90  40 CONTINUE
91  alpha = -alpha
92  t2 = second( )
93  50 CONTINUE
94 *
95 * Compute the time used in milliseconds used by an average call
96 * to SECOND.
97 *
98  WRITE( 6, 9997 )t2 - t1
99  avg = ( ( t2-t1 ) - tnosec ) * 1000.0e+00/real( its )
100  IF( avg.GT.0.0)
101  $ WRITE( 6, 9996 )avg
102 *
103 * Compute the equivalent number of floating point operations used
104 * by an average call to SECOND.
105 *
106  IF(( avg.GT.0.0 ).AND.( tnosec.GT.0.0 ))
107  $ WRITE( 6, 9995 )(avg/1000) * total / tnosec
108 *
109  9999 FORMAT( ' Time for ', g10.3,' SAXPY ops = ', g10.3, ' seconds' )
110  9998 FORMAT( ' SAXPY performance rate = ', g10.3, ' mflops ' )
111  9997 FORMAT( ' Including SECOND, time = ', g10.3, ' seconds' )
112  9996 FORMAT( ' Average time for SECOND = ', g10.3,
113  $ ' milliseconds' )
114  9995 FORMAT( ' Equivalent floating point ops = ', g10.3, ' ops' )
115  9994 FORMAT( ' *** Warning: Time for operations was less or equal',
116  $ ' than zero => timing in TESTING might be dubious' )
117  CALL mysub(nmax,x,y)
118  END
119  SUBROUTINE mysub(N,X,Y)
120  INTEGER N
121  REAL X(N), Y(N)
122  RETURN
123  END
second
real function second()
SECOND Using ETIME
Definition: second_EXT_ETIME.f:37
mysub
subroutine mysub(N, X, Y)
Definition: dsecndtst.f:124