LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
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*> \ingroup test_second
22*
23* ===================================================================== PROGRAM DSECNDTST
24*
25* -- LAPACK test routine --
26*
27* -- LAPACK computational routine --
28* -- LAPACK is a software package provided by Univ. of Tennessee, --
29* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
30*
31* =====================================================================
32*
33* .. Parameters ..
34 INTEGER nmax, its
35 parameter( nmax = 1000, its = 50000 )
36* ..
37* .. Local Scalars ..
38 INTEGER i, j
39 DOUBLE PRECISION alpha, avg, t1, t2, tnosec, total
40* ..
41* .. Local Arrays ..
42 DOUBLE PRECISION x( nmax ), y( nmax )
43* ..
44* .. External Functions ..
45 DOUBLE PRECISION dsecnd
46 EXTERNAL dsecnd
47* ..
48* .. External Subroutines ..
49 EXTERNAL mysub
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
subroutine mysub(n, x, y)
Definition dsecndtst.f:121
double precision function dsecnd()
DSECND Using ETIME