1 $NetBSD: patch-aa,v 1.2 2007/09/28 13:21:33 drochner Exp $
3 --- linpack.c.orig 2013-01-11 15:21:29.000000000 +0000
5 @@ -48,7 +48,10 @@ You must specify one of -DROLL or -DUNRO
9 -static REAL time[9][9];
10 +static REAL timex[9][9];
12 +static void daxpy(int n, REAL da, REAL *dx, int incx, REAL *dy, int incy);
13 +static void dscal(int n, REAL da, REAL *dx,int incx);
17 @@ -71,11 +74,11 @@ main ()
18 matgen(a,lda,n,b,&norma);
20 dgefa(a,lda,n,ipvt,&info);
21 - time[0][0] = second() - t1;
22 + timex[0][0] = second() - t1;
24 dgesl(a,lda,n,ipvt,b,0);
25 - time[1][0] = second() - t1;
26 - total = time[0][0] + time[1][0];
27 + timex[1][0] = second() - t1;
28 + total = timex[0][0] + timex[1][0];
30 /* compute a residual to verify results. */
32 @@ -108,10 +111,10 @@ main ()
33 fprintf(stderr," dgefa dgesl total kflops unit");
34 fprintf(stderr," ratio\n");
37 - time[3][0] = ops/(1.0e3*total);
38 - time[4][0] = 2.0e3/time[3][0];
39 - time[5][0] = total/cray;
40 + timex[2][0] = total;
41 + timex[3][0] = ops/(1.0e3*total);
42 + timex[4][0] = 2.0e3/timex[3][0];
43 + timex[5][0] = total/cray;
45 fprintf(stderr," times for array with leading dimension of%5d\n",lda);
47 @@ -119,28 +122,28 @@ main ()
48 matgen(a,lda,n,b,&norma);
50 dgefa(a,lda,n,ipvt,&info);
51 - time[0][1] = second() - t1;
52 + timex[0][1] = second() - t1;
54 dgesl(a,lda,n,ipvt,b,0);
55 - time[1][1] = second() - t1;
56 - total = time[0][1] + time[1][1];
58 - time[3][1] = ops/(1.0e3*total);
59 - time[4][1] = 2.0e3/time[3][1];
60 - time[5][1] = total/cray;
61 + timex[1][1] = second() - t1;
62 + total = timex[0][1] + timex[1][1];
63 + timex[2][1] = total;
64 + timex[3][1] = ops/(1.0e3*total);
65 + timex[4][1] = 2.0e3/timex[3][1];
66 + timex[5][1] = total/cray;
68 matgen(a,lda,n,b,&norma);
70 dgefa(a,lda,n,ipvt,&info);
71 - time[0][2] = second() - t1;
72 + timex[0][2] = second() - t1;
74 dgesl(a,lda,n,ipvt,b,0);
75 - time[1][2] = second() - t1;
76 - total = time[0][2] + time[1][2];
78 - time[3][2] = ops/(1.0e3*total);
79 - time[4][2] = 2.0e3/time[3][2];
80 - time[5][2] = total/cray;
81 + timex[1][2] = second() - t1;
82 + total = timex[0][2] + timex[1][2];
83 + timex[2][2] = total;
84 + timex[3][2] = ops/(1.0e3*total);
85 + timex[4][2] = 2.0e3/timex[3][2];
86 + timex[5][2] = total/cray;
90 @@ -153,19 +156,19 @@ main ()
91 dgefa(a,lda,n,ipvt,&info);
94 - time[0][3] = (second() - t1 - tm2)/ntimes;
95 + timex[0][3] = (second() - t1 - tm2)/ntimes;
98 for (i = 0; i < ntimes; i++) {
99 dgesl(a,lda,n,ipvt,b,0);
102 - time[1][3] = (second() - t1)/ntimes;
103 - total = time[0][3] + time[1][3];
104 - time[2][3] = total;
105 - time[3][3] = ops/(1.0e3*total);
106 - time[4][3] = 2.0e3/time[3][3];
107 - time[5][3] = total/cray;
108 + timex[1][3] = (second() - t1)/ntimes;
109 + total = timex[0][3] + timex[1][3];
110 + timex[2][3] = total;
111 + timex[3][3] = ops/(1.0e3*total);
112 + timex[4][3] = 2.0e3/timex[3][3];
113 + timex[5][3] = total/cray;
117 @@ -174,41 +177,41 @@ main ()
118 matgen(aa,ldaa,n,b,&norma);
120 dgefa(aa,ldaa,n,ipvt,&info);
121 - time[0][4] = second() - t1;
122 + timex[0][4] = second() - t1;
124 dgesl(aa,ldaa,n,ipvt,b,0);
125 - time[1][4] = second() - t1;
126 - total = time[0][4] + time[1][4];
127 - time[2][4] = total;
128 - time[3][4] = ops/(1.0e3*total);
129 - time[4][4] = 2.0e3/time[3][4];
130 - time[5][4] = total/cray;
131 + timex[1][4] = second() - t1;
132 + total = timex[0][4] + timex[1][4];
133 + timex[2][4] = total;
134 + timex[3][4] = ops/(1.0e3*total);
135 + timex[4][4] = 2.0e3/timex[3][4];
136 + timex[5][4] = total/cray;
138 matgen(aa,ldaa,n,b,&norma);
140 dgefa(aa,ldaa,n,ipvt,&info);
141 - time[0][5] = second() - t1;
142 + timex[0][5] = second() - t1;
144 dgesl(aa,ldaa,n,ipvt,b,0);
145 - time[1][5] = second() - t1;
146 - total = time[0][5] + time[1][5];
147 - time[2][5] = total;
148 - time[3][5] = ops/(1.0e3*total);
149 - time[4][5] = 2.0e3/time[3][5];
150 - time[5][5] = total/cray;
151 + timex[1][5] = second() - t1;
152 + total = timex[0][5] + timex[1][5];
153 + timex[2][5] = total;
154 + timex[3][5] = ops/(1.0e3*total);
155 + timex[4][5] = 2.0e3/timex[3][5];
156 + timex[5][5] = total/cray;
158 matgen(aa,ldaa,n,b,&norma);
160 dgefa(aa,ldaa,n,ipvt,&info);
161 - time[0][6] = second() - t1;
162 + timex[0][6] = second() - t1;
164 dgesl(aa,ldaa,n,ipvt,b,0);
165 - time[1][6] = second() - t1;
166 - total = time[0][6] + time[1][6];
167 - time[2][6] = total;
168 - time[3][6] = ops/(1.0e3*total);
169 - time[4][6] = 2.0e3/time[3][6];
170 - time[5][6] = total/cray;
171 + timex[1][6] = second() - t1;
172 + total = timex[0][6] + timex[1][6];
173 + timex[2][6] = total;
174 + timex[3][6] = ops/(1.0e3*total);
175 + timex[4][6] = 2.0e3/timex[3][6];
176 + timex[5][6] = total/cray;
180 @@ -219,22 +222,22 @@ main ()
181 tm2 = tm2 + second() - tm;
182 dgefa(aa,ldaa,n,ipvt,&info);
184 - time[0][7] = (second() - t1 - tm2)/ntimes;
185 + timex[0][7] = (second() - t1 - tm2)/ntimes;
187 for (i = 0; i < ntimes; i++) {
188 dgesl(aa,ldaa,n,ipvt,b,0);
190 - time[1][7] = (second() - t1)/ntimes;
191 - total = time[0][7] + time[1][7];
192 - time[2][7] = total;
193 - time[3][7] = ops/(1.0e3*total);
194 - time[4][7] = 2.0e3/time[3][7];
195 - time[5][7] = total/cray;
196 + timex[1][7] = (second() - t1)/ntimes;
197 + total = timex[0][7] + timex[1][7];
198 + timex[2][7] = total;
199 + timex[3][7] = ops/(1.0e3*total);
200 + timex[4][7] = 2.0e3/timex[3][7];
201 + timex[5][7] = total/cray;
203 /* the following code sequence implements the semantics of
204 - the Fortran intrinsics "nint(min(time[3][3],time[3][7]))" */
205 + the Fortran intrinsics "nint(min(timex[3][3],timex[3][7]))" */
207 - kf = (time[3][3] < time[3][7]) ? time[3][3] : time[3][7];
208 + kf = (timex[3][3] < timex[3][7]) ? timex[3][3] : timex[3][7];
209 kf = (kf > ZERO) ? (kf + .5) : (kf - .5);
210 if (fabs((double)kf) < ONE)
212 @@ -256,9 +259,9 @@ main ()
216 -fprintf(stderr,"%11.2f%11.2f%11.2f%11.0f%11.2f%11.2f\n", (double)time[0][row],
217 - (double)time[1][row], (double)time[2][row], (double)time[3][row],
218 - (double)time[4][row], (double)time[5][row]);
219 +fprintf(stderr,"%11.2f%11.2f%11.2f%11.0f%11.2f%11.2f\n", (double)timex[0][row],
220 + (double)timex[1][row], (double)timex[2][row], (double)timex[3][row],
221 + (double)timex[4][row], (double)timex[5][row]);
224 /*----------------------*/
225 @@ -528,13 +531,11 @@ function, references to a[i][j] are writ
227 /*----------------------*/
229 -daxpy(n,da,dx,incx,dy,incy)
230 +static void daxpy(int n, REAL da, REAL *dx, int incx, REAL *dy, int incy)
232 constant times a vector plus a vector.
233 jack dongarra, linpack, 3/11/78.
240 @@ -642,13 +643,11 @@ int incx,incy,n;
243 /*----------------------*/
245 +static void dscal(int n, REAL da, REAL *dx,int incx)
247 /* scales a vector by a constant.
248 jack dongarra, linpack, 3/11/78.
255 @@ -885,16 +884,14 @@ function, references to m[i][j] are writ
258 /*----------------------*/
261 #include <sys/time.h>
262 #include <sys/resource.h>
271 getrusage(RUSAGE_SELF,&ru) ;
273 t = (REAL) (ru.ru_utime.tv_sec+ru.ru_stime.tv_sec) +