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