1DSECNDTST(1) LAPACK test routine (version 3.2) DSECNDTST(1)
2
3
4
7 PROGRAM TEST5
8
9 INTEGER NMAX, ITS
10
11 PARAMETER ( NMAX = 100, ITS = 5000 )
12
13 INTEGER I, J
14
15 DOUBLE PRECISION ALPHA, AVG, T1, T2, TNOSEC
16
17 DOUBLE PRECISION X( NMAX ), Y( NMAX )
18
19 DOUBLE PRECISION DSECND
20
21 EXTERNAL DSECND
22
23 INTRINSIC DBLE
24
25 DO 10 I = 1, NMAX
26
27 X( I ) = DBLE( 1 ) / DBLE( I )
28
29 Y( I ) = DBLE( NMAX-I ) / DBLE( NMAX )
30
31 10 CONTINUE
32
33 ALPHA = 0.315D0
34
35 T1 = DSECND( )
36
37 DO 30 J = 1, ITS
38
39 DO 20 I = 1, NMAX
40
41 Y( I ) = Y( I ) + ALPHA*X( I )
42
43 20 CONTINUE
44
45 ALPHA = -ALPHA
46
47 30 CONTINUE
48
49 T2 = DSECND( )
50
51 WRITE( 6, 9999 )T2 - T1
52
53 IF( T2-T1.GT.0.0D0 ) THEN
54
55 WRITE( 6, 9998 )1.0D0 / ( T2-T1 )
56
57 ELSE
58
59 WRITE( 6, 9994 )
60
61 END IF
62
63 TNOSEC = T2 - T1
64
65 T1 = DSECND( )
66
67 DO 50 J = 1, ITS
68
69 DO 40 I = 1, NMAX
70
71 Y( I ) = Y( I ) + ALPHA*X( I )
72
73 40 CONTINUE
74
75 ALPHA = -ALPHA
76
77 T2 = DSECND( )
78
79 50 CONTINUE
80
81 WRITE( 6, 9997 )T2 - T1
82
83 AVG = ( ( T2-T1 )-TNOSEC )*1000.D0 / DBLE( ITS )
84
85 WRITE( 6, 9996 )AVG
86
87 IF( TNOSEC.GT.0.0D0 ) WRITE( 6, 9995 )1000.D0*AVG / TNOSEC
88
89 9999 FORMAT( ' Time for 1,000,000 DAXPY ops = ', G10.3, ' sec‐
90 onds' )
91
92 9998 FORMAT( ' DAXPY performance rate = ', G10.3, ' mflops ' )
93
94 9997 FORMAT( ' Including DSECND, time = ', G10.3, ' seconds' )
95
96 9996 FORMAT( ' Average time for DSECND = ', G10.3, ' millisec‐
97 onds' )
98
99 9995 FORMAT( ' Equivalent floating point ops = ', G10.3, '
100 ops' )
101
102 9994 FORMAT( ' *** Error: Time for operations was zero' )
103
104 CALL MYSUB(NMAX,X,Y)
105
106 END
107
108 SUBROUTINE
109 MYSUB(N,X,Y)
110
111 INTEGER N
112
113 DOUBLE PRECISION X(N), Y(N)
114
115 RETURN
116
117 END
118
120 LAPACK test routine (version 3.2)November 2008 DSECNDTST(1)