1SECONDTST(1) LAPACK test routine (version 3.2) SECONDTST(1)
2
3
4
7 PROGRAM TEST4
8
9 INTEGER NMAX, ITS
10
11 PARAMETER ( NMAX = 100, ITS = 5000 )
12
13 INTEGER I, J
14
15 REAL ALPHA, AVG, T1, T2, TNOSEC
16
17 REAL X( NMAX ), Y( NMAX )
18
19 REAL SECOND
20
21 EXTERNAL SECOND
22
23 INTRINSIC REAL
24
25 DO 10 I = 1, NMAX
26
27 X( I ) = REAL( 1 ) / REAL( I )
28
29 Y( I ) = REAL( NMAX-I ) / REAL( NMAX )
30
31 10 CONTINUE
32
33 ALPHA = 0.315
34
35 T1 = SECOND( )
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 = SECOND( )
50
51 WRITE( 6, 9999 )T2 - T1
52
53 IF( T2-T1.GT.0.0 ) THEN
54
55 WRITE( 6, 9998 )1.0 / ( T2-T1 )
56
57 ELSE
58
59 WRITE( 6, 9994 )
60
61 END IF
62
63 TNOSEC = T2 - T1
64
65 T1 = SECOND( )
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 = SECOND( )
78
79 50 CONTINUE
80
81 WRITE( 6, 9997 )T2 - T1
82
83 AVG = ( ( T2-T1 ) - TNOSEC ) * 1000./REAL( ITS )
84
85 WRITE( 6, 9996 )AVG
86
87 IF( TNOSEC.GT.0.0 ) WRITE( 6, 9995 )1000.*AVG / TNOSEC
88
89 9999 FORMAT( ' Time for 1,000,000 SAXPY ops = ', G10.3, ' sec‐
90 onds' )
91
92 9998 FORMAT( ' SAXPY performance rate = ', G10.3, ' mflops ' )
93
94 9997 FORMAT( ' Including SECOND, time = ', G10.3, ' seconds' )
95
96 9996 FORMAT( ' Average time for SECOND = ', 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 REAL X(N), Y(N)
114
115 RETURN
116
117 END
118
120 LAPACK test routine (version 3.2)November 2008 SECONDTST(1)