QDP++
qdp_scalarsite_sse_blas_double_wrapper.h
Go to the documentation of this file.
1#ifndef QDP_SCALARSITE_GENERIC_BLAS_DOUBLE_WRAPPER_H
2#define QDP_SCALARSITE_GENERIC_BLAS_DOUBLE_WRAPPER_H
3
4
5
7// Threading evaluates wrappers
8//
9// by Xu Guo, EPCC, 6 October, 2008
11
12//
13// vaxOpy4_double: for vaxpy4 and vaxmy4 (double precision
14//
15
16// structure for vaxOpy4 of having order
23
24// user func for vaxOpy4 of having order
25inline
27
28 REAL64* Out = a->Out;
29 REAL64* scalep = a->scalep;
30 REAL64* InScale = a->InScale;
31 void (*func)(REAL64*, REAL64*, REAL64*, int) = a->func;
32
33 int n_4vec = hi - lo;
34
35 int index = lo * 24;
36
37 InScale = &InScale[index];
38 Out = &Out[index];
39
40 func(Out, scalep, InScale, n_4vec);
41}
42
43
44// structure for vaxOpy4_double of NOT having order
46 unordered_sse_vaxOpy4_double_user_arg( const OLattice< DVec >& x_,
47 OLattice< DVec >& d_,
48 REAL64* scalep_,
49 int Ns_,
50 const int* tab_,
51 void (*func_)(REAL64*, REAL64*, REAL64*, int)) :
52 x(x_),d(d_),scalep(scalep_),Ns(Ns_),tab(tab_),func(func_) {}
53
54 const OLattice< DVec >& x;
55 OLattice< DVec >& d;
57 int Ns;
58 const int* tab;
59 void (*func)(REAL64*, REAL64*, REAL64*, int);
60};
61
62// user func for vaxOpy4_double of NOT having order
63inline
65
66 const OLattice< DVec >& x = a->x;
67 OLattice< DVec >& d = a->d;
68 REAL64* scalep = a->scalep;
69 int Ns = a->Ns;
70 const int* tab = a->tab;
71 void (*func)(REAL64*, REAL64*, REAL64*, int) = a->func;
72
73 for(int j=lo; j < hi; j++) {
74 int i=tab[j];
75 REAL64* xptr = (REAL64 *)&(x.elem(i).elem(0).elem(0).real());
76 REAL64* yptr = &(d.elem(i).elem(0).elem(0).real());
77 func(yptr, scalep, xptr, Ns);
78 }
79
80}
81
82
83
84//
85// vaxOpyz4_double: for vaxpyz4 and vaxmyz4 (double precision)
86//
87
88// structure for vaxOpyz4 of having order
96
97// user func for vaxOpyz4 of having order
98inline
100
101 REAL64* Out = a->Out;
102 REAL64* scalep = a->scalep;
103 REAL64* InScale = a->InScale;
104 REAL64* Opt = a->Opt;
105 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, int) = a->func;
106
107 int n_4vec = hi - lo;
108
109 int index = lo * 24;
110
111 InScale = &InScale[index];
112 Out = &Out[index];
113 Opt = &Opt[index];
114
115 func(Out, scalep, InScale, Opt, n_4vec);
116}
117
118
119// structure for vaxOpyz4_double of NOT having order
122 const OLattice< DVec >& x_,
123 const OLattice< DVec >& y_,
124 OLattice< DVec >& d_,
125 REAL64* scalep_,
126 int Ns_,
127 const int* tab_,
128 void (*func_)(REAL64*, REAL64*, REAL64*, REAL64*, int))
129 :x(x_),y(y_),d(d_),scalep(scalep_),Ns(Ns_),tab(tab_),func(func_) {}
130 const OLattice< DVec >& x;
131 const OLattice< DVec >& y;
132 OLattice< DVec >& d;
134 int Ns;
135 const int* tab;
136 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, int);
137};
138
139// user func for vaxOpyz4_double of NOT having order
140inline
142
143 const OLattice< DVec >& x = a->x;
144 const OLattice< DVec >& y = a->y;
145 OLattice< DVec >& d = a->d;
146 REAL64* scalep = a->scalep;
147 int Ns = a->Ns;
148 const int* tab = a->tab;
149 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, int) = a->func;
150
151 for(int j=lo; j < hi; j++) {
152 int i=tab[j];
153 REAL64* xptr = (REAL64 *)&(x.elem(i).elem(0).elem(0).real());
154 REAL64* yptr = (REAL64 *)&(y.elem(i).elem(0).elem(0).real());
155 REAL64* zptr = &(d.elem(i).elem(0).elem(0).real());
156
157 func(zptr, scalep, xptr, yptr, Ns);
158 }
159
160
161}
162
163
164
165//
166// vscal4_double: for vscal4 (double precision)
167//
168
169// structure for vscal4 of having order
175
176// user func for vscal4 of having order
177inline
179 REAL64* zptr = a->zptr;
180 REAL64* aptr = a->aptr;
181 REAL64* xptr = a->xptr;
182
183 int n_4vec = hi - lo;
184
185 int index = lo * 24;
186
187 zptr = &zptr[index];
188 xptr = &xptr[index];
189
190 vscal4(zptr,aptr,xptr,n_4vec);
191}
192
193
194// structure for vscal4_double of NOT having order
197 const OLattice< DVec >& x_,
198 OLattice< DVec >& d_,
199 REAL64* aptr_,
200 int Ns_,
201 const int* tab_)
202 : x(x_),d(d_),aptr(aptr_),Ns(Ns_),tab(tab_) {}
203 const OLattice< DVec >& x;
204 OLattice< DVec >& d;
206 int Ns;
207 const int* tab;
208};
209
210// user func for vscal4_double of NOT having order
211inline
213
214 const OLattice< DVec >& x = a->x;
215 OLattice< DVec >& d = a->d;
216 REAL64* aptr = a->aptr;
217 int Ns = a->Ns;
218 const int* tab = a->tab;
219
220 for(int j=lo; j < hi; j++) {
221 int i=tab[j];
222 REAL64 *xptr = (REAL64 *) &(x.elem(i).elem(0).elem(0).real());
223 REAL64 *zptr = &(d.elem(i).elem(0).elem(0).real());
224
225 vscal4(zptr, aptr, xptr, Ns);
226 }
227
228}
229
230
231
232//
233// vaxOpby4_double: for vaxpby4 and vaxmby4 (double precision)
234//
235
236// structure for vaxOpby4 of having order
244
245// user func for vaxOpby4 of having order
246inline
248
249 REAL64* yptr = a->yptr;
250 REAL64* aptr = a->aptr;
251 REAL64* xptr = a->xptr;
252 REAL64* bptr = a->bptr;
253 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, int) = a->func;
254
255 int n_4vec = hi - lo;
256
257 int index = lo * 24;
258
259 yptr = &yptr[index];
260 xptr = &xptr[index];
261
262 func(yptr, aptr, xptr, bptr, n_4vec);
263}
264
265
266
267//
268// vaxOpbyz4_double: for vaxpbyz4 and vaxmbyz4 (double precision)
269//
270
271// structure for vaxOpbyz4 of having order
280
281// user func for vaxOpbyz4 of having order
282inline
284
285 REAL64* zptr = a->zptr;
286 REAL64* aptr = a->aptr;
287 REAL64* xptr = a->xptr;
288 REAL64* bptr = a->bptr;
289 REAL64* yptr = a->yptr;
290 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, REAL64*, int) = a->func;
291
292 int n_4vec = hi - lo;
293
294 int index = lo * 24;
295
296 zptr = &zptr[index];
297 xptr = &xptr[index];
298 yptr = &yptr[index];
299
300 func(zptr,aptr,xptr,bptr,yptr,n_4vec);
301}
302
303
304// structure for vaxOpbyz4_double of NOT having order
306 unordered_sse_vaxOpbyz4_double_user_arg( const OLattice< DVec >& x_,
307 const OLattice< DVec >& y_,
308 OLattice< DVec >& d_,
309 REAL64* aptr_,
310 REAL64* bptr_,
311 int Ns_,
312 const int* tab_,
313 void (*func_)(REAL64*, REAL64*, REAL64*, REAL64*, REAL64*, int))
314 :x(x_),y(y_),d(d_),aptr(aptr_),bptr(bptr_),Ns(Ns_),tab(tab_),func(func_) {}
315
316
317 const OLattice< DVec >& x;
318 const OLattice< DVec >& y;
319 OLattice< DVec >& d;
322 int Ns;
323 const int* tab;
324 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, REAL64*, int);
325};
326
327// user func for vaxOpbyz4_double of NOT having order
328inline
330
331 const OLattice< DVec >& x = a->x;
332 const OLattice< DVec >& y = a->y;
333 OLattice< DVec >& d = a->d;
334 REAL64* aptr = a->aptr;
335 REAL64* bptr = a->bptr;
336 int Ns = a->Ns;
337 const int* tab = a->tab;
338 void (*func)(REAL64*, REAL64*, REAL64*, REAL64*, REAL64*, int) = a->func;
339
340 for(int j=lo; j < hi; j++) {
341 int i=tab[j];
342
343 REAL64 *xptr = (REAL64 *) &(x.elem(i).elem(0).elem(0).real());
344 REAL64 *yptr = (REAL64 *) &(y.elem(i).elem(0).elem(0).real());
345 REAL64* zptr = &(d.elem(i).elem(0).elem(0).real());
346
347 func(zptr, aptr, xptr, bptr, yptr, Ns);
348 }
349
350
351
352}
353
359
360
361inline void ordered_norm_double_func(int lo, int hi, int myId, ordered_norm_double_user_arg* a)
362 {
363
364 int nvec = hi - lo;
365 int index = lo*24;
366 REAL64* vptr = &(a->vptr[index]);
367 void (*func)(REAL64*, REAL64*, int) = a->func;
368 func( &(a->results[myId]), vptr, nvec);
369
370 }
371
372
379
380
382 {
383
384 int nvec = hi - lo;
385 int index = lo*24;
386 REAL64* xptr = &(a->xptr[index]);
387 REAL64* yptr = &(a->yptr[index]);
388
389 void (*func)(REAL64*, REAL64*, REAL64*, int) = a->func;
390 func( &(a->results[2*myId]), xptr, yptr, nvec);
391 }
392
393
394
395#endif
MakeReturn< UnaryNode< FnReal, typenameCreateLeaf< QDPExpr< T1, C1 > >::Leaf_t >, typenameUnaryReturn< C1, FnReal >::Type_t >::Expression_t real(const QDPExpr< T1, C1 > &l)
double REAL64
void ordered_norm_double_func(int lo, int hi, int myId, ordered_norm_double_user_arg *a)
void ordered_sse_vaxOpy4_double_evaluate_function(int lo, int hi, int myId, ordered_sse_vaxOpy4_double_user_arg *a)
void ordered_sse_vaxOpbyz4_double_evaluate_function(int lo, int hi, int myId, ordered_sse_vaxOpbyz4_double_user_arg *a)
void unordered_sse_vscal4_double_evaluate_function(int lo, int hi, int myId, unordered_sse_vscal4_double_user_arg *a)
void unordered_sse_vaxOpbyz4_double_evaluate_function(int lo, int hi, int myId, unordered_sse_vaxOpbyz4_double_user_arg *a)
void ordered_inner_product_double_func(int lo, int hi, int myId, ordered_inner_product_double_user_arg *a)
void unordered_sse_vaxOpyz4_double_evaluate_function(int lo, int hi, int myId, unordered_sse_vaxOpyz4_double_user_arg *a)
void ordered_sse_vscal4_double_evaluate_function(int lo, int hi, int myId, ordered_sse_vscal4_double_user_arg *a)
void ordered_sse_vaxOpyz4_double_evaluate_function(int lo, int hi, int myId, ordered_sse_vaxOpyz4_double_user_arg *a)
void unordered_sse_vaxOpy4_double_evaluate_function(int lo, int hi, int myId, unordered_sse_vaxOpy4_double_user_arg *a)
void ordered_sse_vaxOpby4_double_evaluate_function(int lo, int hi, int myId, ordered_sse_vaxOpby4_double_user_arg *a)
void(* func)(REAL64 *, REAL64 *, REAL64 *, int)
void(* func)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, int)
void(* func)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, REAL64 *, int)
void(* func)(REAL64 *, REAL64 *, REAL64 *, int)
void(* func)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, int)
unordered_sse_vaxOpbyz4_double_user_arg(const OLattice< DVec > &x_, const OLattice< DVec > &y_, OLattice< DVec > &d_, REAL64 *aptr_, REAL64 *bptr_, int Ns_, const int *tab_, void(*func_)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, REAL64 *, int))
void(* func)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, REAL64 *, int)
unordered_sse_vaxOpy4_double_user_arg(const OLattice< DVec > &x_, OLattice< DVec > &d_, REAL64 *scalep_, int Ns_, const int *tab_, void(*func_)(REAL64 *, REAL64 *, REAL64 *, int))
void(* func)(REAL64 *, REAL64 *, REAL64 *, int)
unordered_sse_vaxOpyz4_double_user_arg(const OLattice< DVec > &x_, const OLattice< DVec > &y_, OLattice< DVec > &d_, REAL64 *scalep_, int Ns_, const int *tab_, void(*func_)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, int))
void(* func)(REAL64 *, REAL64 *, REAL64 *, REAL64 *, int)
unordered_sse_vscal4_double_user_arg(const OLattice< DVec > &x_, OLattice< DVec > &d_, REAL64 *aptr_, int Ns_, const int *tab_)