QDP++
qdp_scalarsite_generic_blas_wrapper.h
Go to the documentation of this file.
1#ifndef QDP_SCALARSITE_GENERIC_BLAS_WRAPPER_H
2#define QDP_SCALARSITE_GENERIC_BLAS_WRAPPER_H
3
5// Threading evaluates wrappers
6//
7// by Xu Guo, EPCC, 12 August, 2008
9
10//
11// for vaxpy3
12//
13
14// structure for vaxpy3 of having order
21
22// user func for vaxpy3 of having order
23inline
25
26 REAL* Out = a->Out;
27 REAL* scalep = a->scalep;
28 REAL* InScale = a->InScale;
29 REAL* Add = a->Add;
30
31 int n_4vec = hi - lo;
32
33 int index = lo * 24;
34 InScale = &InScale[index];
35 Add = &Add[index];
36 Out = &Out[index];
37
38 vaxpy3(Out, scalep, InScale, Add, n_4vec);
39}
40
41// structure for vaxpy3 (with yptr only) of NOT having order
43 unordered_vaxpy3_y_user_arg( const OLattice< TVec >& x_,
44 OLattice< TVec >& d_,
45 REAL* scalep_,
46 const int* tab_,
47 int xy_order_) : x(x_), d(d_), scalep(scalep_), tab(tab_), xy_order(xy_order_) {}
48
49 const OLattice< TVec >& x;
50 OLattice< TVec >& d;
52 const int* tab;
54};
55
56// user func for vaxpy3 (with yptr only) of NOT having order
57inline
59
60 const OLattice< TVec >& x = a->x;
61 OLattice< TVec >& d = a->d;
62 REAL* scalep = a->scalep;
63 const int* tab = a->tab;
64 int xy_order = a->xy_order;
65
66 if (xy_order){
67 for(int j=lo; j < hi; j++) {
68 int i=tab[j];
69 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
70 REAL* yptr = &(d.elem(i).elem(0).elem(0).real());
71 vaxpy3(yptr, scalep, xptr, yptr, 1);
72 }
73 }
74 else {
75 for(int j=lo; j < hi; j++) {
76 int i=tab[j];
77 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
78 REAL* yptr = &(d.elem(i).elem(0).elem(0).real());
79 vaxpy3(yptr, scalep, yptr, xptr, 1);
80 }
81 }
82
83
84}
85
86// structure for vaxpy3 (with zptr) of NOT having order
88 unordered_vaxpy3_z_user_arg( const OLattice< TVec >& x_,
89 const OLattice< TVec >& y_,
90 OLattice< TVec >& d_,
91 REAL* scalep_,
92 const int* tab_) : x(x_), y(y_), d(d_), scalep(scalep_), tab(tab_) {}
93
94 const OLattice< TVec >& x;
95 const OLattice< TVec >& y;
96 OLattice< TVec >& d;
98 const int* tab;
99};
100
101// user func for vaxpy3 (with zptr only) of NOT having order
102inline
104
105 const OLattice< TVec >& x = a->x;
106 const OLattice< TVec >& y = a->y;
107 OLattice< TVec >& d = a->d;
108 REAL* scalep = a->scalep;
109 const int* tab = a->tab;
110
111 for(int j=lo; j < hi; j++) {
112 int i=tab[j];
113 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
114 REAL* yptr = (REAL *)&(y.elem(i).elem(0).elem(0).real());
115 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
116 vaxpy3(zptr, scalep, xptr, yptr, 1);
117 }
118
119}
120
121
122//
123// for vaxmy3
124//
125
126// structure for vaxmy3 of having order
133
134// user func for vaxmy3 of having order
135inline
137
138 REAL* Out = a->Out;
139 REAL* scalep = a->scalep;
140 REAL* InScale = a->InScale;
141 REAL* Sub = a->Sub;
142
143 int n_3vec = hi - lo;
144 int index = lo * 24;
145 InScale = &InScale[index];
146 Sub = &Sub[index];
147 Out = &Out[index];
148
149 vaxmy3(Out, scalep, InScale, Sub, n_3vec);
150
151}
152
153// structure for vaxmy3 (with yptr only) of NOT having order
155 unordered_vaxmy3_y_user_arg( const OLattice< TVec >& x_,
156 OLattice< TVec >& d_,
157 REAL* scalep_,
158 const int* tab_) : x(x_), d(d_), scalep(scalep_), tab(tab_) {}
159
160 const OLattice< TVec >& x;
161 OLattice< TVec >& d;
163 const int* tab;
164};
165
166// user func for vampy3 (with yptr only) of NOT having order
167inline
169
170 const OLattice< TVec >& x = a->x;
171 OLattice< TVec >& d = a->d;
172 REAL* scalep = a->scalep;
173 const int* tab = a->tab;
174
175 for(int j=lo; j < hi; j++) {
176 int i=tab[j];
177 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
178 REAL* yptr = &(d.elem(i).elem(0).elem(0).real());
179 vaxmy3(yptr, scalep, yptr, xptr, 1);
180 }
181}
182
183// structure for vaxmy3 (with zptr) of NOT having order
186 const OLattice< TVec >& x_,
187 const OLattice< TVec >& y_,
188 OLattice< TVec >& d_,
189 REAL* scalep_,
190 const int* tab_) : x(x_), y(y_), d(d_), scalep(scalep_), tab(tab_) {}
191
192 const OLattice< TVec >& x;
193 const OLattice< TVec >& y;
194 OLattice< TVec >& d;
196 const int* tab;
197};
198
199// user func for vaxmy3 (with zptr only) of NOT having order
200inline
202
203 const OLattice< TVec >& x = a->x;
204 const OLattice< TVec >& y = a->y;
205 OLattice< TVec >& d = a->d;
206 REAL* scalep = a->scalep;
207 const int* tab = a->tab;
208
209 for(int j=lo; j < hi; j++) {
210 int i=tab[j];
211 REAL* xptr = (REAL *)&(x.elem(i).elem(0).elem(0).real());
212 REAL* yptr = (REAL *)&(y.elem(i).elem(0).elem(0).real());
213 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
214 vaxmy3(zptr, scalep, xptr, yptr, 1);
215 }
216
217}
218
219
220//
221// vscal
222//
223
224// structure for vscal of having order
230
231// user func for vscal of having order
232inline
233void ordered_vscal_evaluate_function (int lo, int hi, int myId, ordered_vscal_user_arg* a){
234
235 REAL* Out = a->Out;
236 REAL* scalep = a->scalep;
237 REAL* In = a->In;
238
239 int n_3vec = hi - lo;
240 int index = lo * 24;
241 Out = &Out[index];
242 In = &In[index];
243 vscal(Out, scalep, In, n_3vec);
244}
245
246// structure for vscal of NOT having order
249
250 const OLattice< TVec >& x_,
251 OLattice< TVec >& d_,
252 REAL* scalep_,
253 const int* tab_
254 ) : x(x_), d(d_), scalep(scalep_), tab(tab_) {}
255 const OLattice< TVec >& x;
256 OLattice< TVec >& d;
258 const int* tab;
259};
260
261// user func for vscal of NOT having order
262inline
264
265 const OLattice< TVec >& x = a->x;
266 OLattice< TVec >& d = a->d;
267 REAL* scalep = a->scalep;
268 const int* tab = a->tab;
269
270 for(int j=lo; j < hi; j++) {
271 int i=tab[j];
272 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
273 REAL *zptr = &(d.elem(i).elem(0).elem(0).real());
274 vscal(zptr, scalep, xptr, 1);
275 }
276
277}
278
279
280
281//
282// vaxpby3
283//
284
285// structure for vaxpby3 of having order
293
294// user func for vaxpby3 of having order
295inline
297
298 REAL* Out = a->Out;
299 REAL* ap = a->ap;
300 REAL* xp = a->xp;
301 REAL* bp = a->bp;
302 REAL* yp = a->yp;
303
304 int n_3vec = hi - lo;
305 int index = lo * 24;
306 Out = &Out[index];
307 xp = &xp[index];
308 yp = &yp[index];
309 vaxpby3(Out, ap, xp, bp, yp, n_3vec);
310}
311
312// structure for vaxpby3 of NOT having order
314unordered_vaxpby3_user_arg( const OLattice< TVec >& x_,
315 const OLattice< TVec >& y_,
316 OLattice< TVec >& d_,
317 REAL* aptr_,
318 REAL* bptr_,
319 const int* tab_): x(x_), y(y_), d(d_), aptr(aptr_), bptr(bptr_), tab(tab_) {}
320 const OLattice< TVec >& x;
321 const OLattice< TVec >& y;
322 OLattice< TVec >& d;
325 const int* tab;
326};
327
328// user func for vaxpby3 of NOT having order
329inline
331
332 const OLattice< TVec >& x = a->x;
333 const OLattice< TVec >& y = a->y;
334 OLattice< TVec >& d = a->d;
335 REAL* aptr = a->aptr;
336 REAL* bptr = a->bptr;
337 const int* tab = a->tab;
338
339 for(int j=lo; j < hi; j++) {
340 int i=tab[j];
341 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
342 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
343 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
344
345 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
346 vaxpby3(zptr, aptr, xptr, bptr, yptr, 1);
347
348 }
349
350}
351
352
353
354//
355// vaxmby3
356//
357
358// structure for vaxmby3 of having order
366
367// user func for vaxpby3 of having order
368inline
370
371 REAL* Out = a->Out;
372 REAL* ap = a->ap;
373 REAL* xp = a->xp;
374 REAL* bp = a->bp;
375 REAL* yp = a->yp;
376
377 int n_3vec = hi - lo;
378 int index = lo * 24;
379 Out = &Out[index];
380 xp = &xp[index];
381 yp = &yp[index];
382 vaxmby3(Out, ap, xp, bp, yp, n_3vec);
383}
384
385// structure for vaxmby3 of NOT having order
387 unordered_vaxmby3_user_arg( const OLattice< TVec >& x_,
388 const OLattice< TVec >& y_,
389 OLattice< TVec >& d_,
390 REAL* aptr_,
391 REAL* bptr_,
392 const int* tab_): x(x_), y(y_), d(d_), aptr(aptr_), bptr(bptr_), tab(tab_) {}
393
394 const OLattice< TVec >& x;
395 const OLattice< TVec >& y;
396 OLattice< TVec >& d;
399 const int* tab;
400};
401
402// user func for vaxmby3 of NOT having order
403inline
405
406 const OLattice< TVec >& x = a->x;
407 const OLattice< TVec >& y = a->y;
408 OLattice< TVec >& d = a->d;
409 REAL* aptr = a->aptr;
410 REAL* bptr = a->bptr;
411 const int* tab = a->tab;
412
413 for(int j=lo; j < hi; j++) {
414 int i=tab[j];
415 REAL *xptr = (REAL *) &(x.elem(i).elem(0).elem(0).real());
416 REAL *yptr = (REAL *) &(y.elem(i).elem(0).elem(0).real());
417 REAL* zptr = &(d.elem(i).elem(0).elem(0).real());
418
419 // Get the no of 3vecs. s.start() and s.end() are inclusive so add +1
420 vaxmby3(zptr, aptr, xptr, bptr, yptr,1);
421
422 }
423
424}
425
426
427
428
429
430
431
432#endif
MakeReturn< UnaryNode< FnReal, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnReal >::Type_t >::Expression_t real(const QDPExpr< T1, C1 > &l)
REAL32 REAL
void ordered_vaxmy3_evaluate_function(int lo, int hi, int myId, ordered_vaxmy3_user_arg *a)
void ordered_vaxmby3_evaluate_function(int lo, int hi, int myId, ordered_vaxmby3_user_arg *a)
void unordered_vaxmy3_y_evaluate_function(int lo, int hi, int myId, unordered_vaxmy3_y_user_arg *a)
void unordered_vscal_evaluate_function(int lo, int hi, int myId, unordered_vscal_user_arg *a)
void unordered_vaxpy3_z_evaluate_function(int lo, int hi, int myId, unordered_vaxpy3_z_user_arg *a)
void unordered_vaxpby3_evaluate_function(int lo, int hi, int myId, unordered_vaxpby3_user_arg *a)
void ordered_vaxpy3_evaluate_function(int lo, int hi, int myId, ordered_vaxpy3_user_arg *a)
void ordered_vaxpby3_evaluate_function(int lo, int hi, int myId, ordered_vaxpby3_user_arg *a)
void unordered_vaxmy3_z_evaluate_function(int lo, int hi, int myId, unordered_vaxmy3_z_user_arg *a)
void unordered_vaxmby3_evaluate_function(int lo, int hi, int myId, unordered_vaxmby3_user_arg *a)
void ordered_vscal_evaluate_function(int lo, int hi, int myId, ordered_vscal_user_arg *a)
void unordered_vaxpy3_y_evaluate_function(int lo, int hi, int myId, unordered_vaxpy3_y_user_arg *a)
unordered_vaxmby3_user_arg(const OLattice< TVec > &x_, const OLattice< TVec > &y_, OLattice< TVec > &d_, REAL *aptr_, REAL *bptr_, const int *tab_)
unordered_vaxmy3_y_user_arg(const OLattice< TVec > &x_, OLattice< TVec > &d_, REAL *scalep_, const int *tab_)
unordered_vaxmy3_z_user_arg(const OLattice< TVec > &x_, const OLattice< TVec > &y_, OLattice< TVec > &d_, REAL *scalep_, const int *tab_)
unordered_vaxpby3_user_arg(const OLattice< TVec > &x_, const OLattice< TVec > &y_, OLattice< TVec > &d_, REAL *aptr_, REAL *bptr_, const int *tab_)
unordered_vaxpy3_y_user_arg(const OLattice< TVec > &x_, OLattice< TVec > &d_, REAL *scalep_, const int *tab_, int xy_order_)
unordered_vaxpy3_z_user_arg(const OLattice< TVec > &x_, const OLattice< TVec > &y_, OLattice< TVec > &d_, REAL *scalep_, const int *tab_)
unordered_vscal_user_arg(const OLattice< TVec > &x_, OLattice< TVec > &d_, REAL *scalep_, const int *tab_)