Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / benchmarks / linpack-bench / patches / patch-aa
blob485450e0f370b252dc42878661f90988651043b8
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
4 +++ linpack.c
5 @@ -48,7 +48,10 @@ You must specify one of -DROLL or -DUNRO
6  #include <stdio.h>
7  #include <math.h>
8  
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);
15  main ()
16  {
17 @@ -71,11 +74,11 @@ main ()
18          matgen(a,lda,n,b,&norma);
19          t1 = second();
20          dgefa(a,lda,n,ipvt,&info);
21 -        time[0][0] = second() - t1;
22 +        timex[0][0] = second() - t1;
23          t1 = second();
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");
36 -        time[2][0] = total;
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);
46         print_time(0);
47 @@ -119,28 +122,28 @@ main ()
48          matgen(a,lda,n,b,&norma);
49          t1 = second();
50          dgefa(a,lda,n,ipvt,&info);
51 -        time[0][1] = second() - t1;
52 +        timex[0][1] = second() - t1;
53          t1 = second();
54          dgesl(a,lda,n,ipvt,b,0);
55 -        time[1][1] = second() - t1;
56 -        total = time[0][1] + time[1][1];
57 -        time[2][1] = total;
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);
69          t1 = second();
70          dgefa(a,lda,n,ipvt,&info);
71 -        time[0][2] = second() - t1;
72 +        timex[0][2] = second() - t1;
73          t1 = second();
74          dgesl(a,lda,n,ipvt,b,0);
75 -        time[1][2] = second() - t1;
76 -        total = time[0][2] + time[1][2];
77 -        time[2][2] = total;
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;
88          ntimes = NTIMES;
89          tm2 = 0.0;
90 @@ -153,19 +156,19 @@ main ()
91                 dgefa(a,lda,n,ipvt,&info);
92         }
94 -        time[0][3] = (second() - t1 - tm2)/ntimes;
95 +        timex[0][3] = (second() - t1 - tm2)/ntimes;
96          t1 = second();
98         for (i = 0; i < ntimes; i++) {
99                 dgesl(a,lda,n,ipvt,b,0);
100         }
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;
115         print_time(1);
116         print_time(2);
117 @@ -174,41 +177,41 @@ main ()
118          matgen(aa,ldaa,n,b,&norma);
119          t1 = second();
120          dgefa(aa,ldaa,n,ipvt,&info);
121 -        time[0][4] = second() - t1;
122 +        timex[0][4] = second() - t1;
123          t1 = second();
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);
139          t1 = second();
140          dgefa(aa,ldaa,n,ipvt,&info);
141 -        time[0][5] = second() - t1;
142 +        timex[0][5] = second() - t1;
143          t1 = second();
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);
159         t1 = second();
160         dgefa(aa,ldaa,n,ipvt,&info);
161 -       time[0][6] = second() - t1;
162 +       timex[0][6] = second() - t1;
163         t1 = second();
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;
178         ntimes = NTIMES;
179         tm2 = 0;
180 @@ -219,22 +222,22 @@ main ()
181                 tm2 = tm2 + second() - tm;
182                 dgefa(aa,ldaa,n,ipvt,&info);
183         }
184 -       time[0][7] = (second() - t1 - tm2)/ntimes;
185 +       timex[0][7] = (second() - t1 - tm2)/ntimes;
186         t1 = second();
187         for (i = 0; i < ntimes; i++) {
188                 dgesl(aa,ldaa,n,ipvt,b,0);
189         }
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) 
211                 kflops = 0;
212 @@ -256,9 +259,9 @@ main ()
213  print_time (row)
214  int row;
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]);
223        
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)
231  /*
232       constant times a vector plus a vector.
233       jack dongarra, linpack, 3/11/78.
234  */
235 -REAL dx[],dy[],da;
236 -int incx,incy,n;
238         int i,ix,iy,m,mp1;
240 @@ -642,13 +643,11 @@ int incx,incy,n;
243  /*----------------------*/ 
244 -dscal(n,da,dx,incx)
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.
249  */
250 -REAL da,dx[];
251 -int n, incx;
253         int i,m,mp1,nincx;
255 @@ -885,16 +884,14 @@ function, references to m[i][j] are writ
256  } 
258  /*----------------------*/ 
259 -REAL second()
261  #include <sys/time.h>
262  #include <sys/resource.h>
264 +REAL second()
266  struct rusage ru;
267  REAL t ;
269 -void getrusage();
271  getrusage(RUSAGE_SELF,&ru) ;
272   
273  t = (REAL) (ru.ru_utime.tv_sec+ru.ru_stime.tv_sec) +