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