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