PeTar
N-body code for collisional gravitational systems
phantomquad_for_p3t_k.hpp
Go to the documentation of this file.
1 #include <cassert>
2 #include "v2r8.h"
3 
5 public:
6  enum{
7  NIMAX = 2048,
8  NJMAX = 262144,
9  };
10 
11 private:
12  double xibuf [NIMAX/2] [4][2]; // x, y, z, r_search
13  double accpbuf[NIMAX/2] [5][2]; // ax, ay, az, pot, nngb
14  double epjbuf [NJMAX] [4]; // x, y, z, m
15  double spjbuf [NJMAX] [10]; // x, y, z, m, xx, yy, xy, yz, zx, tr
16  double rsearchj[NJMAX]; // r_search_j
17 
18  double eps2;
19  double r_crit2;
20  double r_out;
21  double r_in;
22  double denominator;
23 
24  v2r8 v_r_out;
25  v2r8 v_r_out_sq;
26  v2r8 v_r_in;
27  v2r8 v_r_in_sq;
28  v2r8 v_denominator;
29  v2r8 v_r_crit2;
30 
31  v2r8 v_zero;
32  v2r8 v_one;
33 
34  v2r8 v_n20;
35  v2r8 v_p70;
36  v2r8 v_n84;
37  v2r8 v_p35;
38 
39  static double get_a_NaN(){
40  union{ long l; double d; } m;
41  m.l = -1;
42  return m.d;
43  }
44 
45 public:
46 // default NaN
47  PhantomGrapeQuad() : eps2(get_a_NaN()) {
48  v_zero = _fjsp_set_v2r8(0.0, 0.0);
49  v_one = _fjsp_set_v2r8(1.0, 1.0);
50  v_n20 = _fjsp_set_v2r8(-20.0, -20.0);
51  v_p70 = _fjsp_set_v2r8(70.0, 70.0);
52  v_n84 = _fjsp_set_v2r8(-84.0, -84.0);
53  v_p35 = _fjsp_set_v2r8(35.0, 35.0);
54  }
55 
56  void set_eps2(const double _eps2){
57  this->eps2 = _eps2;
58  }
59 
60  void set_r_crit2(const double _r_crit2){
61  this->r_crit2 = _r_crit2;
62  v_r_crit2 = _fjsp_set_v2r8(r_crit2, r_crit2);
63  }
64 
65  void set_cutoff(const double _r_out, const double _r_in){
66  this->r_out = _r_out;
67  this->r_in = _r_in;
68  this->denominator = 1.0 / (r_out - r_in);
69  v_r_out = _fjsp_set_v2r8(r_out, r_out);
70  v_r_out_sq = _fjsp_set_v2r8(r_out*r_out, r_out*r_out);
71  v_r_in = _fjsp_set_v2r8(r_in, r_in);
72  v_r_in_sq = _fjsp_set_v2r8(r_in*r_in, r_in*r_in);
73  v_denominator = _fjsp_set_v2r8(denominator, denominator);
74  }
75 
76  void set_epj_one(const int addr, const double x, const double y, const double z, const double m, const double r_search) {
77  epjbuf[addr][0] = x;
78  epjbuf[addr][1] = y;
79  epjbuf[addr][2] = z;
80  epjbuf[addr][3] = m;
81  rsearchj[addr] = r_search;
82  }
83  // please specialize the following
84  template <typename EPJ_t>
85  void set_epj(const int nj, const EPJ_t epj[]);
86 
88  const int addr,
89  const double x, const double y, const double z, const double m,
90  const double qxx, const double qyy, const double qzz,
91  const double qxy, const double qyz, const double qzx)
92  {
93  const double tr = qxx + qyy + qzz;
94  spjbuf[addr][0] = x;
95  spjbuf[addr][1] = y;
96  spjbuf[addr][2] = z;
97  spjbuf[addr][3] = m;
98  spjbuf[addr][4] = 3.0 * qxx - tr;
99  spjbuf[addr][5] = 3.0 * qyy - tr;
100  spjbuf[addr][6] = 3.0 * qxy;
101  spjbuf[addr][7] = 3.0 * qyz;
102  spjbuf[addr][8] = 3.0 * qzx;
103  spjbuf[addr][9] = -(eps2 * tr);
104  }
105  // please specialize the following
106  template <typename SPJ_t>
107  void set_spj(const int nj, const SPJ_t spj[]);
108 
109  void set_xi_one(const int addr, const double x, const double y, const double z, const double r_search){
110  const int ah = addr / 2;
111  const int al = addr % 2;
112  xibuf[ah][0][al] = x;
113  xibuf[ah][1][al] = y;
114  xibuf[ah][2][al] = z;
115  xibuf[ah][3][al] = r_search;
116  }
117  // please specialize the following
118  template <typename EPI_t>
119  void set_xi(const int ni, const EPI_t spj[]);
120 
121  template <typename real_t>
122  void get_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot){
123  const int ah = addr / 2;
124  const int al = addr % 2;
125  ax = accpbuf[ah][0][al];
126  ay = accpbuf[ah][1][al];
127  az = accpbuf[ah][2][al];
128  pot = accpbuf[ah][3][al];
129  }
130  template <typename real_t>
131  void get_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot, real_t &nngb){
132  const int ah = addr / 2;
133  const int al = addr % 2;
134  ax = accpbuf[ah][0][al];
135  ay = accpbuf[ah][1][al];
136  az = accpbuf[ah][2][al];
137  pot = accpbuf[ah][3][al];
138  nngb = accpbuf[ah][4][al];
139  }
140 
141 
142  template <typename real_t>
143  void accum_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot){
144  const int ah = addr / 2;
145  const int al = addr % 2;
146  ax += accpbuf[ah][0][al];
147  ay += accpbuf[ah][1][al];
148  az += accpbuf[ah][2][al];
149  pot += accpbuf[ah][3][al];
150  }
151 
152  template <typename real_t>
153  void accum_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot, real_t &nngb){
154  const int ah = addr / 2;
155  const int al = addr % 2;
156  ax += accpbuf[ah][0][al];
157  ay += accpbuf[ah][1][al];
158  az += accpbuf[ah][2][al];
159  pot += accpbuf[ah][3][al];
160  nngb += accpbuf[ah][4][al];
161  }
162 
163  void run_epj(const int ni, const int nj){
164  if(ni > NIMAX || nj > NJMAX){
165  std::cout<<"ni= "<<ni<<" NIMAX= "<<NIMAX<<" nj= "<<nj<<" NJMAX= "<<NJMAX<<std::endl;
166  }
167  assert(ni <= NIMAX);
168  assert(nj <= NJMAX);
169 
170  // kernel_epj_nounroll(ni, nj);
171  // kernel_epj_unroll2(ni, nj);
172  kernel_epj_unroll4(ni, nj);
173  }
174 
175  /* void run_epj_for_p3t(const int ni, const int nj){
176  if(ni > NIMAX || nj > NJMAX){
177  std::cout<<"ni= "<<ni<<" NIMAX= "<<NIMAX<<" nj= "<<nj<<" NJMAX= "<<NJMAX<<std::endl;
178  }
179  assert(ni <= NIMAX);
180  assert(nj <= NJMAX);
181  // kernel_epj_nounroll(ni, nj);
182  // kernel_epj_unroll2(ni, nj);
183  //kernel_epj_unroll4_for_p3t(ni, nj);
184  kernel_epj_unroll4_with_cutoff(ni, nj);
185  }
186  */
187  void run_epj_for_p3t_with_linear_cutoff(const int ni, const int nj){
188  if(ni > NIMAX || nj > NJMAX){
189  std::cout<<"ni= "<<ni<<" NIMAX= "<<NIMAX<<" nj= "<<nj<<" NJMAX= "<<NJMAX<<std::endl;
190  }
191  assert(ni <= NIMAX);
192  assert(nj <= NJMAX);
193  kernel_epj_unroll4_for_p3t_with_linear_cutoff(ni, nj);
194  }
195 
196  void run_spj(const int ni, const int nj){
197  if(ni > NIMAX || nj > NJMAX){
198  std::cout<<"ni= "<<ni<<" NIMAX= "<<NIMAX<<" nj= "<<nj<<" NJMAX= "<<NJMAX<<std::endl;
199  }
200  assert(ni <= NIMAX);
201  assert(nj <= NJMAX);
202 
203  kernel_spj_unroll4(ni, nj);
204  }
205 private:
206  __attribute__ ((always_inline))
207  void inline_kernel_epj(
208  const v2r8 eps2,
209  const v2r8 jp_xy,
210  const v2r8 jp_zm,
211  const v2r8 xi,
212  const v2r8 yi,
213  const v2r8 zi,
214  v2r8 &ax,
215  v2r8 &ay,
216  v2r8 &az,
217  v2r8 &pot)
218  {
219  const v2r8_bcl xj(jp_xy);
220  const v2r8_bch yj(jp_xy);
221  const v2r8_bcl zj(jp_zm);
222  const v2r8_bch mj(jp_zm);
223 
224  const v2r8 dx = xj - xi;
225  const v2r8 dy = yj - yi;
226  const v2r8 dz = zj - zi;
227 
228  const v2r8 r2 = ((eps2 + dx*dx) + dy*dy) + dz*dz;
229  const v2r8 ri1 = r2.rsqrta_x3();
230  //const v2r8 ri1 = r2.rsqrta_x7();
231  const v2r8 ri2 = ri1 * ri1;
232  const v2r8 mri1 = mj * ri1;
233  const v2r8 mri3 = mri1 * ri2;
234 
235  pot = mj.nmsub(ri1, pot);
236  ax += mri3 * dx;
237  ay += mri3 * dy;
238  az += mri3 * dz;
239  }
240 
241  __attribute__ ((always_inline))
242  void inline_kernel_epj_for_p3t(const v2r8 eps2,
243  const v2r8 r_crit2,
244  const v2r8 jp_xy,
245  const v2r8 jp_zm,
246  const v2r8 xi,
247  const v2r8 yi,
248  const v2r8 zi,
249  v2r8 &ax,
250  v2r8 &ay,
251  v2r8 &az,
252  v2r8 &pot,
253  v2r8 &nngb){
254  const v2r8_bcl xj(jp_xy);
255  const v2r8_bch yj(jp_xy);
256  const v2r8_bcl zj(jp_zm);
257  const v2r8_bch mj(jp_zm);
258 
259  const v2r8 dx = xj - xi;
260  const v2r8 dy = yj - yi;
261  const v2r8 dz = zj - zi;
262 
263  const v2r8 r2 = ((eps2 + dx*dx) + dy*dy) + dz*dz;
264  const v2r8_mask mask = r_crit2 < r2;
265  const v2r8 ri1 = r2.rsqrta_x3() & mask;
266  //const v2r8 ri1 = r2.rsqrta_x7() & mask;
267  const v2r8 ri2 = ri1 * ri1;
268  const v2r8 mri1 = mj * ri1;
269  const v2r8 mri3 = mri1 * ri2;
270 
271  pot = mj.nmsub(ri1, pot);
272  ax += mri3 * dx;
273  ay += mri3 * dy;
274  az += mri3 * dz;
275  nngb += _fjsp_andnot1_v2r8( mask.val, v2r8(1.0) );
276  }
277 
278 
279  __attribute__ ((always_inline))
280  void inline_kernel_epj_for_p3t_with_linear_cutoff(const v2r8 eps2,
281  v2r8 &rsj,
282  const v2r8 jp_xy,
283  const v2r8 jp_zm,
284  const v2r8 xi,
285  const v2r8 yi,
286  const v2r8 zi,
287  v2r8 &rsi,
288  v2r8 &ax,
289  v2r8 &ay,
290  v2r8 &az,
291  v2r8 &pot,
292  v2r8 &nngb){
293  const v2r8_bcl xj(jp_xy);
294  const v2r8_bch yj(jp_xy);
295  const v2r8_bcl zj(jp_zm);
296  const v2r8_bch mj(jp_zm);
297 
298  const v2r8 dx = xj - xi;
299  const v2r8 dy = yj - yi;
300  const v2r8 dz = zj - zi;
301 
302  v2r8 r2_real = ((eps2 + dx*dx) + dy*dy) + dz*dz;
303  const v2r8 r2 = _fjsp_max_v2r8(r2_real, v_r_crit2);
304  const v2r8 ri1 = r2.rsqrta_x3();
305  //const v2r8 ri1 = r2.rsqrta_x7();
306  const v2r8 ri2 = ri1 * ri1;
307  const v2r8 mri1 = mj * ri1;
308  const v2r8 mri3 = mri1 * ri2;
309 
310  pot = mj.nmsub(ri1, pot);
311  ax += mri3 * dx;
312  ay += mri3 * dy;
313  az += mri3 * dz;
314 
315  v2r8 r_crit = _fjsp_max_v2r8(rsi, rsj);
316  const v2r8 r_crit2= r_crit*r_crit;
317  const v2r8_mask mask = r_crit2 < r2;
318  nngb += _fjsp_andnot1_v2r8( mask.val, v2r8(1.0) );
319  }
320 
321 
322 
323  __attribute__ ((always_inline))
324  void inline_kernel_epj_with_cutoff(const v2r8 eps2,
325  const v2r8 r_crit2,
326  const v2r8 jp_xy,
327  const v2r8 jp_zm,
328  const v2r8 xi,
329  const v2r8 yi,
330  const v2r8 zi,
331  v2r8 &ax,
332  v2r8 &ay,
333  v2r8 &az,
334  v2r8 &pot,
335  v2r8 &nngb){
336  const v2r8_bcl xj(jp_xy);
337  const v2r8_bch yj(jp_xy);
338  const v2r8_bcl zj(jp_zm);
339  const v2r8_bch mj(jp_zm);
340 
341  const v2r8 dx = xj - xi;
342  const v2r8 dy = yj - yi;
343  const v2r8 dz = zj - zi;
344 
345 
346  v2r8 r2 = ((eps2 + dx*dx) + dy*dy) + dz*dz;
347  //const v2r8_mask mask = r_crit2 < r2;
348  //v2r8_mask mask = v_r_in_sq < r2;
349  r2 = _fjsp_max_v2r8(r2, v_r_in_sq);
350 #ifdef RSQRT_NR_EPJ_X7
351  const v2r8 ri1 = r2.rsqrta_x7();
352  //const v2r8 ri1 = r2.rsqrta_x7() & mask;
353 #else
354  const v2r8 ri1 = r2.rsqrta_x3();
355  //const v2r8 ri1 = r2.rsqrta_x3() & mask;
356 #endif
357 
358 
359 #if 1
360  const v2r8 r1 = r2 * ri1;
361  const v2r8 x = _fjsp_min_v2r8( _fjsp_max_v2r8( ((r1-v_r_in)*v_denominator), v_zero), v_one);
362  const v2r8 x2 = x * x;
363  const v2r8 x4 = x2 * x2;
364  const v2r8 k = (((v_n20*x + v_p70)*x + v_n84)*x + v_p35)*x4 ;
365 #endif
366  const v2r8 mkri1 = mj * k * ri1;
367  const v2r8 ri2 = ri1 * ri1;
368  const v2r8 mkri3 = mkri1 * ri2;
369 
370  //const v2r8 ri2 = ri1 * ri1;
371  //const v2r8 mri1 = mj * ri1;
372  //const v2r8 mri3 = mri1 * ri2;
373  //pot = mj.nmsub(ri1, pot);
374 
375  pot -= mkri1;
376  ax += mkri3 * dx;
377  ay += mkri3 * dy;
378  az += mkri3 * dz;
379  v2r8_mask mask = r2 < r_crit2;
380  nngb += _fjsp_and_v2r8( mask.val, v_one );
381  //nngb += _fjsp_andnot1_v2r8( mask.val, v_one );
382  }
383 
384 
385 
386 //#if 0
387 // __attribute__ ((noinline))
388 // void kernel_epj_nounroll(const int ni, const int nj){
389 // for(int i=0; i<ni; i+=2){
390 // const v2r8 xi = v2r8::load(xibuf[i/2][0]);
391 // const v2r8 yi = v2r8::load(xibuf[i/2][1]);
392 // const v2r8 zi = v2r8::load(xibuf[i/2][2]);
393 // const v2r8 veps2 = v2r8(eps2);
394 //
395 // v2r8 ax(0.0);
396 // v2r8 ay(0.0);
397 // v2r8 az(0.0);
398 // v2r8 po(0.0);
399 //
400 // for(int j=0; j<nj; j++){
401 // const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
402 // const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
403 // inline_kernel_epj(veps2, jp_xy, jp_zm, xi, yi, zi, ax, ay, az, po);
404 // }
405 //
406 // ax.store(accpbuf[i/2][0]);
407 // ay.store(accpbuf[i/2][1]);
408 // az.store(accpbuf[i/2][2]);
409 // po.store(accpbuf[i/2][3]);
410 // }
411 // }
412 //#endif
413 //#if 0
414 // __attribute__ ((noinline))
415 // void kernel_epj_unroll2(const int ni, const int nj){
416 // for(int i=0; i<ni; i+=4){
417 // const v2r8 veps2 = v2r8(eps2);
418 //
419 // const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
420 // const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
421 // const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
422 // const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
423 // const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
424 // const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
425 //
426 // v2r8 ax0(0.0);
427 // v2r8 ay0(0.0);
428 // v2r8 az0(0.0);
429 // v2r8 po0(0.0);
430 // v2r8 ax1(0.0);
431 // v2r8 ay1(0.0);
432 // v2r8 az1(0.0);
433 // v2r8 po1(0.0);
434 //
435 // for(int j=0; j<nj; j++){
436 // const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
437 // const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
438 // inline_kernel_epj(veps2, jp_xy, jp_zm, xi0, yi0, zi0, ax0, ay0, az0, po0);
439 // inline_kernel_epj(veps2, jp_xy, jp_zm, xi1, yi1, zi1, ax1, ay1, az1, po1);
440 // }
441 //
442 // ax0.store(accpbuf[0 + i/2][0]);
443 // ay0.store(accpbuf[0 + i/2][1]);
444 // az0.store(accpbuf[0 + i/2][2]);
445 // po0.store(accpbuf[0 + i/2][3]);
446 // ax1.store(accpbuf[1 + i/2][0]);
447 // ay1.store(accpbuf[1 + i/2][1]);
448 // az1.store(accpbuf[1 + i/2][2]);
449 // po1.store(accpbuf[1 + i/2][3]);
450 // }
451 // }
452 //#endif
453  __attribute__ ((noinline))
454  void kernel_epj_unroll4(const int ni, const int nj){
455  for(int i=0; i<ni; i+=8){
456  const v2r8 veps2 = v2r8(eps2);
457 
458  const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
459  const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
460  const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
461  const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
462  const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
463  const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
464  const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
465  const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
466  const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
467  const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
468  const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
469  const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
470 
471  v2r8 ax0(0.0);
472  v2r8 ay0(0.0);
473  v2r8 az0(0.0);
474  v2r8 po0(0.0);
475  v2r8 ax1(0.0);
476  v2r8 ay1(0.0);
477  v2r8 az1(0.0);
478  v2r8 po1(0.0);
479  v2r8 ax2(0.0);
480  v2r8 ay2(0.0);
481  v2r8 az2(0.0);
482  v2r8 po2(0.0);
483  v2r8 ax3(0.0);
484  v2r8 ay3(0.0);
485  v2r8 az3(0.0);
486  v2r8 po3(0.0);
487 
488  for(int j=0; j<nj; j++){
489  const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
490  const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
491  inline_kernel_epj(veps2, jp_xy, jp_zm, xi0, yi0, zi0, ax0, ay0, az0, po0);
492  inline_kernel_epj(veps2, jp_xy, jp_zm, xi1, yi1, zi1, ax1, ay1, az1, po1);
493  inline_kernel_epj(veps2, jp_xy, jp_zm, xi2, yi2, zi2, ax2, ay2, az2, po2);
494  inline_kernel_epj(veps2, jp_xy, jp_zm, xi3, yi3, zi3, ax3, ay3, az3, po3);
495  }
496 
497  ax0.store(accpbuf[0 + i/2][0]);
498  ay0.store(accpbuf[0 + i/2][1]);
499  az0.store(accpbuf[0 + i/2][2]);
500  po0.store(accpbuf[0 + i/2][3]);
501  ax1.store(accpbuf[1 + i/2][0]);
502  ay1.store(accpbuf[1 + i/2][1]);
503  az1.store(accpbuf[1 + i/2][2]);
504  po1.store(accpbuf[1 + i/2][3]);
505  ax2.store(accpbuf[2 + i/2][0]);
506  ay2.store(accpbuf[2 + i/2][1]);
507  az2.store(accpbuf[2 + i/2][2]);
508  po2.store(accpbuf[2 + i/2][3]);
509  ax3.store(accpbuf[3 + i/2][0]);
510  ay3.store(accpbuf[3 + i/2][1]);
511  az3.store(accpbuf[3 + i/2][2]);
512  po3.store(accpbuf[3 + i/2][3]);
513  }
514  }
515 
516  /* __attribute__ ((noinline))
517  void kernel_epj_unroll4_for_p3t(const int ni, const int nj){
518  for(int i=0; i<ni; i+=8){
519  const v2r8 veps2 = v2r8(eps2);
520  //const v2r8 vrcrit2 = v2r8(r_crit2);
521 
522  const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
523  const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
524  const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
525  const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
526  const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
527  const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
528  const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
529  const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
530  const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
531  const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
532  const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
533  const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
534 
535  v2r8 ax0(0.0);
536  v2r8 ay0(0.0);
537  v2r8 az0(0.0);
538  v2r8 po0(0.0);
539  v2r8 nngb0(0.0);
540  v2r8 ax1(0.0);
541  v2r8 ay1(0.0);
542  v2r8 az1(0.0);
543  v2r8 po1(0.0);
544  v2r8 nngb1(0.0);
545  v2r8 ax2(0.0);
546  v2r8 ay2(0.0);
547  v2r8 az2(0.0);
548  v2r8 po2(0.0);
549  v2r8 nngb2(0.0);
550  v2r8 ax3(0.0);
551  v2r8 ay3(0.0);
552  v2r8 az3(0.0);
553  v2r8 po3(0.0);
554  v2r8 nngb3(0.0);
555 
556  for(int j=0; j<nj; j++){
557  const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
558  const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
559  inline_kernel_epj_for_p3t(veps2, vrcrit2, jp_xy, jp_zm, xi0, yi0, zi0, ax0, ay0, az0, po0, nngb0);
560  inline_kernel_epj_for_p3t(veps2, vrcrit2, jp_xy, jp_zm, xi1, yi1, zi1, ax1, ay1, az1, po1, nngb1);
561  inline_kernel_epj_for_p3t(veps2, vrcrit2, jp_xy, jp_zm, xi2, yi2, zi2, ax2, ay2, az2, po2, nngb2);
562  inline_kernel_epj_for_p3t(veps2, vrcrit2, jp_xy, jp_zm, xi3, yi3, zi3, ax3, ay3, az3, po3, nngb3);
563  }
564 
565  ax0.store(accpbuf[0 + i/2][0]);
566  ay0.store(accpbuf[0 + i/2][1]);
567  az0.store(accpbuf[0 + i/2][2]);
568  po0.store(accpbuf[0 + i/2][3]);
569  nngb0.store(accpbuf[0 + i/2][4]);
570  ax1.store(accpbuf[1 + i/2][0]);
571  ay1.store(accpbuf[1 + i/2][1]);
572  az1.store(accpbuf[1 + i/2][2]);
573  po1.store(accpbuf[1 + i/2][3]);
574  nngb1.store(accpbuf[1 + i/2][4]);
575  ax2.store(accpbuf[2 + i/2][0]);
576  ay2.store(accpbuf[2 + i/2][1]);
577  az2.store(accpbuf[2 + i/2][2]);
578  po2.store(accpbuf[2 + i/2][3]);
579  nngb2.store(accpbuf[2 + i/2][4]);
580  ax3.store(accpbuf[3 + i/2][0]);
581  ay3.store(accpbuf[3 + i/2][1]);
582  az3.store(accpbuf[3 + i/2][2]);
583  po3.store(accpbuf[3 + i/2][3]);
584  nngb3.store(accpbuf[3 + i/2][4]);
585  }
586  }
587  */
588  __attribute__ ((noinline))
589  void kernel_epj_unroll4_for_p3t_with_linear_cutoff(const int ni, const int nj){
590  for(int i=0; i<ni; i+=8){
591  const v2r8 veps2 = v2r8(eps2);
592 
593  const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
594  const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
595  const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
596  v2r8 rs0 = v2r8::load(xibuf[0 + i/2][3]);
597  const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
598  const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
599  const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
600  v2r8 rs1 = v2r8::load(xibuf[1 + i/2][3]);
601  const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
602  const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
603  const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
604  v2r8 rs2 = v2r8::load(xibuf[2 + i/2][3]);
605  const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
606  const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
607  const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
608  v2r8 rs3 = v2r8::load(xibuf[3 + i/2][3]);
609 
610  v2r8 ax0(0.0);
611  v2r8 ay0(0.0);
612  v2r8 az0(0.0);
613  v2r8 po0(0.0);
614  v2r8 nngb0(0.0);
615  v2r8 ax1(0.0);
616  v2r8 ay1(0.0);
617  v2r8 az1(0.0);
618  v2r8 po1(0.0);
619  v2r8 nngb1(0.0);
620  v2r8 ax2(0.0);
621  v2r8 ay2(0.0);
622  v2r8 az2(0.0);
623  v2r8 po2(0.0);
624  v2r8 nngb2(0.0);
625  v2r8 ax3(0.0);
626  v2r8 ay3(0.0);
627  v2r8 az3(0.0);
628  v2r8 po3(0.0);
629  v2r8 nngb3(0.0);
630 
631  for(int j=0; j<nj; j++){
632  const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
633  const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
634  v2r8 rsjp = __builtin_fj_set_v2r8(rsearchj[j], rsearchj[j]);
635  inline_kernel_epj_for_p3t_with_linear_cutoff(veps2, rsjp, jp_xy, jp_zm, xi0, yi0, zi0, rs0, ax0, ay0, az0, po0, nngb0);
636  inline_kernel_epj_for_p3t_with_linear_cutoff(veps2, rsjp, jp_xy, jp_zm, xi1, yi1, zi1, rs1, ax1, ay1, az1, po1, nngb1);
637  inline_kernel_epj_for_p3t_with_linear_cutoff(veps2, rsjp, jp_xy, jp_zm, xi2, yi2, zi2, rs2, ax2, ay2, az2, po2, nngb2);
638  inline_kernel_epj_for_p3t_with_linear_cutoff(veps2, rsjp, jp_xy, jp_zm, xi3, yi3, zi3, rs3, ax3, ay3, az3, po3, nngb3);
639  }
640 
641  ax0.store(accpbuf[0 + i/2][0]);
642  ay0.store(accpbuf[0 + i/2][1]);
643  az0.store(accpbuf[0 + i/2][2]);
644  po0.store(accpbuf[0 + i/2][3]);
645  nngb0.store(accpbuf[0 + i/2][4]);
646  ax1.store(accpbuf[1 + i/2][0]);
647  ay1.store(accpbuf[1 + i/2][1]);
648  az1.store(accpbuf[1 + i/2][2]);
649  po1.store(accpbuf[1 + i/2][3]);
650  nngb1.store(accpbuf[1 + i/2][4]);
651  ax2.store(accpbuf[2 + i/2][0]);
652  ay2.store(accpbuf[2 + i/2][1]);
653  az2.store(accpbuf[2 + i/2][2]);
654  po2.store(accpbuf[2 + i/2][3]);
655  nngb2.store(accpbuf[2 + i/2][4]);
656  ax3.store(accpbuf[3 + i/2][0]);
657  ay3.store(accpbuf[3 + i/2][1]);
658  az3.store(accpbuf[3 + i/2][2]);
659  po3.store(accpbuf[3 + i/2][3]);
660  nngb3.store(accpbuf[3 + i/2][4]);
661  }
662  }
663 
664 
665  /* __attribute__ ((noinline))
666  void kernel_epj_unroll4_with_cutoff(const int ni, const int nj){
667  for(int i=0; i<ni; i+=8){
668  const v2r8 veps2 = v2r8(eps2);
669  const v2r8 vrcrit2 = v2r8(r_crit2);
670 
671  const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
672  const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
673  const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
674  const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
675  const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
676  const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
677  const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
678  const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
679  const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
680  const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
681  const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
682  const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
683 
684  v2r8 ax0(0.0);
685  v2r8 ay0(0.0);
686  v2r8 az0(0.0);
687  v2r8 po0(0.0);
688  v2r8 nngb0(0.0);
689  v2r8 ax1(0.0);
690  v2r8 ay1(0.0);
691  v2r8 az1(0.0);
692  v2r8 po1(0.0);
693  v2r8 nngb1(0.0);
694  v2r8 ax2(0.0);
695  v2r8 ay2(0.0);
696  v2r8 az2(0.0);
697  v2r8 po2(0.0);
698  v2r8 nngb2(0.0);
699  v2r8 ax3(0.0);
700  v2r8 ay3(0.0);
701  v2r8 az3(0.0);
702  v2r8 po3(0.0);
703  v2r8 nngb3(0.0);
704 
705  for(int j=0; j<nj; j++){
706  const v2r8 jp_xy = v2r8::load(epjbuf[j] + 0);
707  const v2r8 jp_zm = v2r8::load(epjbuf[j] + 2);
708  inline_kernel_epj_with_cutoff(veps2, vrcrit2, jp_xy, jp_zm, xi0, yi0, zi0, ax0, ay0, az0, po0, nngb0);
709  inline_kernel_epj_with_cutoff(veps2, vrcrit2, jp_xy, jp_zm, xi1, yi1, zi1, ax1, ay1, az1, po1, nngb1);
710  inline_kernel_epj_with_cutoff(veps2, vrcrit2, jp_xy, jp_zm, xi2, yi2, zi2, ax2, ay2, az2, po2, nngb2);
711  inline_kernel_epj_with_cutoff(veps2, vrcrit2, jp_xy, jp_zm, xi3, yi3, zi3, ax3, ay3, az3, po3, nngb3);
712  }
713 
714  ax0.store(accpbuf[0 + i/2][0]);
715  ay0.store(accpbuf[0 + i/2][1]);
716  az0.store(accpbuf[0 + i/2][2]);
717  po0.store(accpbuf[0 + i/2][3]);
718  nngb0.store(accpbuf[0 + i/2][4]);
719  ax1.store(accpbuf[1 + i/2][0]);
720  ay1.store(accpbuf[1 + i/2][1]);
721  az1.store(accpbuf[1 + i/2][2]);
722  po1.store(accpbuf[1 + i/2][3]);
723  nngb1.store(accpbuf[1 + i/2][4]);
724  ax2.store(accpbuf[2 + i/2][0]);
725  ay2.store(accpbuf[2 + i/2][1]);
726  az2.store(accpbuf[2 + i/2][2]);
727  po2.store(accpbuf[2 + i/2][3]);
728  nngb2.store(accpbuf[2 + i/2][4]);
729  ax3.store(accpbuf[3 + i/2][0]);
730  ay3.store(accpbuf[3 + i/2][1]);
731  az3.store(accpbuf[3 + i/2][2]);
732  po3.store(accpbuf[3 + i/2][3]);
733  nngb3.store(accpbuf[3 + i/2][4]);
734  }
735  }
736  */
737 
738  __attribute__ ((always_inline))
739  void inline_kernel_spj(
740  const v2r8 eps2,
741  const v2r8 jp_xy,
742  const v2r8 jp_zm,
743  const v2r8 jp_xx_yy,
744  const v2r8 jp_xy_yz,
745  const v2r8 jp_zx_tr,
746  const v2r8 xi,
747  const v2r8 yi,
748  const v2r8 zi,
749  v2r8 &ax,
750  v2r8 &ay,
751  v2r8 &az,
752  v2r8 &pot)
753  {
754  const v2r8_bcl xj(jp_xy);
755  const v2r8_bch yj(jp_xy);
756  const v2r8_bcl zj(jp_zm);
757 
758  const v2r8 dx = xj - xi;
759  const v2r8 dy = yj - yi;
760  const v2r8 dz = zj - zi;
761 
762  const v2r8 r2 = ((eps2 + dx*dx) + dy*dy) + dz*dz;
763  const v2r8 ri1 = r2.rsqrta_x3();
764  const v2r8 ri2 = ri1 * ri1;
765  const v2r8 ri3 = ri1 * ri2;
766  const v2r8 ri4 = ri2 * ri2;
767  const v2r8 ri5 = ri2 * ri3;
768 
769  const v2r8_bcl q_xx(jp_xx_yy);
770  const v2r8_bch q_yy(jp_xx_yy);
771  const v2r8 q_zz = jp_xx_yy.hadd(); // -q_zz = q_xx + q_yy
772  const v2r8_bcl q_xy(jp_xy_yz);
773  const v2r8_bch q_yz(jp_xy_yz);
774  const v2r8_bcl q_zx(jp_zx_tr);
775  const v2r8 q_tr = v2r8::unpckh(jp_zx_tr, jp_zx_tr); // -eps2 * tr(q)
776  const v2r8 mj = v2r8::unpckh(jp_zm, jp_zm);
777 
778  v2r8 qr_x = q_xx * dx;
779  qr_x = q_xy.madd(dy, qr_x);
780  qr_x = q_zx.madd(dz, qr_x);
781 
782  v2r8 qr_y = q_xy * dx;
783  qr_y = q_yy.madd(dy, qr_y);
784  qr_y = q_yz.madd(dz, qr_y);
785 
786  v2r8 qr_z = q_zx * dx;
787  qr_z = q_yz.madd(dy, qr_z);
788  qr_z = qr_z - q_zz * dz;
789 
790  ax = v2r8::nmsub(ri5, qr_x, ax);
791  ay = v2r8::nmsub(ri5, qr_y, ay);
792  az = v2r8::nmsub(ri5, qr_z, az);
793 
794  const v2r8 rqr = ((q_tr + qr_x*dx) + qr_y*dy) + qr_z*dz;
795  const v2r8 rqr_ri4 = rqr * ri4;
796 
797  const v2r8 cc(0.5, 2.5);
798  const v2r8 madd05 = v2r8_bcl(cc).madd(rqr_ri4, mj);
799  const v2r8 madd25 = v2r8_bch(cc).madd(rqr_ri4, mj) * ri3;
800 
801  pot -= madd05 * ri1;
802 
803  ax = v2r8::madd(madd25, dx, ax);
804  ay = v2r8::madd(madd25, dy, ay);
805  az = v2r8::madd(madd25, dz, az);
806  }
807 //#if 0
808 // __attribute__ ((noinline))
809 // void kernel_spj_nounroll(const int ni, const int nj){
810 // for(int i=0; i<ni; i+=2){
811 // const v2r8 xi = v2r8::load(xibuf[i/2][0]);
812 // const v2r8 yi = v2r8::load(xibuf[i/2][1]);
813 // const v2r8 zi = v2r8::load(xibuf[i/2][2]);
814 // const v2r8 veps2 = v2r8(eps2);
815 //
816 // v2r8 ax(0.0);
817 // v2r8 ay(0.0);
818 // v2r8 az(0.0);
819 // v2r8 po(0.0);
820 //
821 // for(int j=0; j<nj; j++){
822 // const v2r8 jp_xy = v2r8::load(spjbuf[j] + 0);
823 // const v2r8 jp_zm = v2r8::load(spjbuf[j] + 2);
824 // const v2r8 jp_xx_yy = v2r8::load(spjbuf[j] + 4);
825 // const v2r8 jp_xy_yz = v2r8::load(spjbuf[j] + 6);
826 // const v2r8 jp_zx_tr = v2r8::load(spjbuf[j] + 8);
827 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi, yi, zi, ax, ay, az, po);
828 // }
829 //
830 // ax.store(accpbuf[i/2][0]);
831 // ay.store(accpbuf[i/2][1]);
832 // az.store(accpbuf[i/2][2]);
833 // po.store(accpbuf[i/2][3]);
834 // }
835 // }
836 //#endif
837 //#if 0
838 // __attribute__ ((noinline))
839 // void kernel_spj_unroll2(const int ni, const int nj){
840 // for(int i=0; i<ni; i+=4){
841 // const v2r8 veps2 = v2r8(eps2);
842 //
843 // const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
844 // const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
845 // const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
846 // const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
847 // const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
848 // const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
849 //
850 // v2r8 ax0(0.0);
851 // v2r8 ay0(0.0);
852 // v2r8 az0(0.0);
853 // v2r8 po0(0.0);
854 // v2r8 ax1(0.0);
855 // v2r8 ay1(0.0);
856 // v2r8 az1(0.0);
857 // v2r8 po1(0.0);
858 //
859 // for(int j=0; j<nj; j++){
860 // const v2r8 jp_xy = v2r8::load(spjbuf[j] + 0);
861 // const v2r8 jp_zm = v2r8::load(spjbuf[j] + 2);
862 // const v2r8 jp_xx_yy = v2r8::load(spjbuf[j] + 4);
863 // const v2r8 jp_xy_yz = v2r8::load(spjbuf[j] + 6);
864 // const v2r8 jp_zx_tr = v2r8::load(spjbuf[j] + 8);
865 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi0, yi0, zi0, ax0, ay0, az0, po0);
866 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi1, yi1, zi1, ax1, ay1, az1, po1);
867 // }
868 //
869 // ax0.store(accpbuf[0 + i/2][0]);
870 // ay0.store(accpbuf[0 + i/2][1]);
871 // az0.store(accpbuf[0 + i/2][2]);
872 // po0.store(accpbuf[0 + i/2][3]);
873 // ax1.store(accpbuf[1 + i/2][0]);
874 // ay1.store(accpbuf[1 + i/2][1]);
875 // az1.store(accpbuf[1 + i/2][2]);
876 // po1.store(accpbuf[1 + i/2][3]);
877 // }
878 // }
879 //#endif
880  __attribute__ ((noinline))
881  void kernel_spj_unroll4(const int ni, const int nj){
882  for(int i=0; i<ni; i+=8){
883  const v2r8 veps2 = v2r8(eps2);
884 
885  const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
886  const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
887  const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
888  const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
889  const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
890  const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
891  const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
892  const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
893  const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
894  const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
895  const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
896  const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
897 
898  v2r8 ax0(0.0);
899  v2r8 ay0(0.0);
900  v2r8 az0(0.0);
901  v2r8 po0(0.0);
902  v2r8 ax1(0.0);
903  v2r8 ay1(0.0);
904  v2r8 az1(0.0);
905  v2r8 po1(0.0);
906  v2r8 ax2(0.0);
907  v2r8 ay2(0.0);
908  v2r8 az2(0.0);
909  v2r8 po2(0.0);
910  v2r8 ax3(0.0);
911  v2r8 ay3(0.0);
912  v2r8 az3(0.0);
913  v2r8 po3(0.0);
914 
915  for(int j=0; j<nj; j++){
916  const v2r8 jp_xy = v2r8::load(spjbuf[j] + 0);
917  const v2r8 jp_zm = v2r8::load(spjbuf[j] + 2);
918  const v2r8 jp_xx_yy = v2r8::load(spjbuf[j] + 4);
919  const v2r8 jp_xy_yz = v2r8::load(spjbuf[j] + 6);
920  const v2r8 jp_zx_tr = v2r8::load(spjbuf[j] + 8);
921  inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi0, yi0, zi0, ax0, ay0, az0, po0);
922  inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi1, yi1, zi1, ax1, ay1, az1, po1);
923  inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi2, yi2, zi2, ax2, ay2, az2, po2);
924  inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi3, yi3, zi3, ax3, ay3, az3, po3);
925  }
926 
927  ax0.store(accpbuf[0 + i/2][0]);
928  ay0.store(accpbuf[0 + i/2][1]);
929  az0.store(accpbuf[0 + i/2][2]);
930  po0.store(accpbuf[0 + i/2][3]);
931  ax1.store(accpbuf[1 + i/2][0]);
932  ay1.store(accpbuf[1 + i/2][1]);
933  az1.store(accpbuf[1 + i/2][2]);
934  po1.store(accpbuf[1 + i/2][3]);
935  ax2.store(accpbuf[2 + i/2][0]);
936  ay2.store(accpbuf[2 + i/2][1]);
937  az2.store(accpbuf[2 + i/2][2]);
938  po2.store(accpbuf[2 + i/2][3]);
939  ax3.store(accpbuf[3 + i/2][0]);
940  ay3.store(accpbuf[3 + i/2][1]);
941  az3.store(accpbuf[3 + i/2][2]);
942  po3.store(accpbuf[3 + i/2][3]);
943  }
944  }
945 //#if 0
946 // __attribute__ ((noinline))
947 // void kernel_spj_unroll8(const int ni, const int nj){
948 // for(int i=0; i<ni; i+=16){
949 // const v2r8 veps2 = v2r8(eps2);
950 //
951 // const v2r8 xi0 = v2r8::load(xibuf[0 + i/2][0]);
952 // const v2r8 yi0 = v2r8::load(xibuf[0 + i/2][1]);
953 // const v2r8 zi0 = v2r8::load(xibuf[0 + i/2][2]);
954 // const v2r8 xi1 = v2r8::load(xibuf[1 + i/2][0]);
955 // const v2r8 yi1 = v2r8::load(xibuf[1 + i/2][1]);
956 // const v2r8 zi1 = v2r8::load(xibuf[1 + i/2][2]);
957 // const v2r8 xi2 = v2r8::load(xibuf[2 + i/2][0]);
958 // const v2r8 yi2 = v2r8::load(xibuf[2 + i/2][1]);
959 // const v2r8 zi2 = v2r8::load(xibuf[2 + i/2][2]);
960 // const v2r8 xi3 = v2r8::load(xibuf[3 + i/2][0]);
961 // const v2r8 yi3 = v2r8::load(xibuf[3 + i/2][1]);
962 // const v2r8 zi3 = v2r8::load(xibuf[3 + i/2][2]);
963 // const v2r8 xi4 = v2r8::load(xibuf[4 + i/2][0]);
964 // const v2r8 yi4 = v2r8::load(xibuf[4 + i/2][1]);
965 // const v2r8 zi4 = v2r8::load(xibuf[4 + i/2][2]);
966 // const v2r8 xi5 = v2r8::load(xibuf[5 + i/2][0]);
967 // const v2r8 yi5 = v2r8::load(xibuf[5 + i/2][1]);
968 // const v2r8 zi5 = v2r8::load(xibuf[5 + i/2][2]);
969 // const v2r8 xi6 = v2r8::load(xibuf[6 + i/2][0]);
970 // const v2r8 yi6 = v2r8::load(xibuf[6 + i/2][1]);
971 // const v2r8 zi6 = v2r8::load(xibuf[6 + i/2][2]);
972 // const v2r8 xi7 = v2r8::load(xibuf[7 + i/2][0]);
973 // const v2r8 yi7 = v2r8::load(xibuf[7 + i/2][1]);
974 // const v2r8 zi7 = v2r8::load(xibuf[7 + i/2][2]);
975 //
976 // v2r8 ax0(0.0);
977 // v2r8 ay0(0.0);
978 // v2r8 az0(0.0);
979 // v2r8 po0(0.0);
980 // v2r8 ax1(0.0);
981 // v2r8 ay1(0.0);
982 // v2r8 az1(0.0);
983 // v2r8 po1(0.0);
984 // v2r8 ax2(0.0);
985 // v2r8 ay2(0.0);
986 // v2r8 az2(0.0);
987 // v2r8 po2(0.0);
988 // v2r8 ax3(0.0);
989 // v2r8 ay3(0.0);
990 // v2r8 az3(0.0);
991 // v2r8 po3(0.0);
992 // v2r8 ax4(0.0);
993 // v2r8 ay4(0.0);
994 // v2r8 az4(0.0);
995 // v2r8 po4(0.0);
996 // v2r8 ax5(0.0);
997 // v2r8 ay5(0.0);
998 // v2r8 az5(0.0);
999 // v2r8 po5(0.0);
1000 // v2r8 ax6(0.0);
1001 // v2r8 ay6(0.0);
1002 // v2r8 az6(0.0);
1003 // v2r8 po6(0.0);
1004 // v2r8 ax7(0.0);
1005 // v2r8 ay7(0.0);
1006 // v2r8 az7(0.0);
1007 // v2r8 po7(0.0);
1008 //
1009 // for(int j=0; j<nj; j++){
1010 // const v2r8 jp_xy = v2r8::load(spjbuf[j] + 0);
1011 // const v2r8 jp_zm = v2r8::load(spjbuf[j] + 2);
1012 // const v2r8 jp_xx_yy = v2r8::load(spjbuf[j] + 4);
1013 // const v2r8 jp_xy_yz = v2r8::load(spjbuf[j] + 6);
1014 // const v2r8 jp_zx_tr = v2r8::load(spjbuf[j] + 8);
1015 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi0, yi0, zi0, ax0, ay0, az0, po0);
1016 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi1, yi1, zi1, ax1, ay1, az1, po1);
1017 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi2, yi2, zi2, ax2, ay2, az2, po2);
1018 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi3, yi3, zi3, ax3, ay3, az3, po3);
1019 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi4, yi4, zi4, ax4, ay4, az4, po4);
1020 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi5, yi5, zi5, ax5, ay5, az5, po5);
1021 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi6, yi6, zi6, ax6, ay6, az6, po6);
1022 // inline_kernel_spj(veps2, jp_xy, jp_zm, jp_xx_yy, jp_xy_yz, jp_zx_tr, xi7, yi7, zi7, ax7, ay7, az7, po7);
1023 // }
1024 //
1025 // ax0.store(accpbuf[0 + i/2][0]);
1026 // ay0.store(accpbuf[0 + i/2][1]);
1027 // az0.store(accpbuf[0 + i/2][2]);
1028 // po0.store(accpbuf[0 + i/2][3]);
1029 // ax1.store(accpbuf[1 + i/2][0]);
1030 // ay1.store(accpbuf[1 + i/2][1]);
1031 // az1.store(accpbuf[1 + i/2][2]);
1032 // po1.store(accpbuf[1 + i/2][3]);
1033 // ax2.store(accpbuf[2 + i/2][0]);
1034 // ay2.store(accpbuf[2 + i/2][1]);
1035 // az2.store(accpbuf[2 + i/2][2]);
1036 // po2.store(accpbuf[2 + i/2][3]);
1037 // ax3.store(accpbuf[3 + i/2][0]);
1038 // ay3.store(accpbuf[3 + i/2][1]);
1039 // az3.store(accpbuf[3 + i/2][2]);
1040 // po3.store(accpbuf[3 + i/2][3]);
1041 // ax4.store(accpbuf[4 + i/2][0]);
1042 // ay4.store(accpbuf[4 + i/2][1]);
1043 // az4.store(accpbuf[4 + i/2][2]);
1044 // po4.store(accpbuf[4 + i/2][3]);
1045 // ax5.store(accpbuf[5 + i/2][0]);
1046 // ay5.store(accpbuf[5 + i/2][1]);
1047 // az5.store(accpbuf[5 + i/2][2]);
1048 // po5.store(accpbuf[5 + i/2][3]);
1049 // ax6.store(accpbuf[6 + i/2][0]);
1050 // ay6.store(accpbuf[6 + i/2][1]);
1051 // az6.store(accpbuf[6 + i/2][2]);
1052 // po6.store(accpbuf[6 + i/2][3]);
1053 // ax7.store(accpbuf[7 + i/2][0]);
1054 // ay7.store(accpbuf[7 + i/2][1]);
1055 // az7.store(accpbuf[7 + i/2][2]);
1056 // po7.store(accpbuf[7 + i/2][3]);
1057 // }
1058 // }
1059 //#endif
1060 } __attribute__ ((aligned(128)));
PhantomGrapeQuad::run_epj
void run_epj(const int ni, const int nj)
Definition: phantomquad_for_p3t_k.hpp:163
PhantomGrapeQuad::set_r_crit2
void set_r_crit2(const double _r_crit2)
Definition: phantomquad_for_p3t_k.hpp:60
PhantomGrapeQuad::set_cutoff
void set_cutoff(const double _r_out, const double _r_in)
Definition: phantomquad_for_p3t_k.hpp:65
PhantomGrapeQuad::NJMAX
@ NJMAX
Definition: phantomquad_for_p3t_k.hpp:8
PhantomGrapeQuad::run_spj
void run_spj(const int ni, const int nj)
Definition: phantomquad_for_p3t_k.hpp:196
PhantomGrapeQuad::accum_accp_one
void accum_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot, real_t &nngb)
Definition: phantomquad_for_p3t_k.hpp:153
PhantomGrapeQuad::set_epj_one
void set_epj_one(const int addr, const double x, const double y, const double z, const double m, const double r_search)
Definition: phantomquad_for_p3t_k.hpp:76
PhantomGrapeQuad::set_epj
void set_epj(const int nj, const EPJ_t epj[])
PhantomGrapeQuad::set_xi
void set_xi(const int ni, const EPI_t spj[])
PhantomGrapeQuad::set_xi_one
void set_xi_one(const int addr, const double x, const double y, const double z, const double r_search)
Definition: phantomquad_for_p3t_k.hpp:109
PhantomGrapeQuad::set_eps2
void set_eps2(const double _eps2)
Definition: phantomquad_for_p3t_k.hpp:56
PhantomGrapeQuad::run_epj_for_p3t_with_linear_cutoff
void run_epj_for_p3t_with_linear_cutoff(const int ni, const int nj)
Definition: phantomquad_for_p3t_k.hpp:187
PhantomGrapeQuad::set_spj
void set_spj(const int nj, const SPJ_t spj[])
PhantomGrapeQuad::get_accp_one
void get_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot, real_t &nngb)
Definition: phantomquad_for_p3t_k.hpp:131
__attribute__
class PhantomGrapeQuad __attribute__((aligned(128)))
PhantomGrapeQuad::accum_accp_one
void accum_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot)
Definition: phantomquad_for_p3t_k.hpp:143
PhantomGrapeQuad::set_spj_one
void set_spj_one(const int addr, const double x, const double y, const double z, const double m, const double qxx, const double qyy, const double qzz, const double qxy, const double qyz, const double qzx)
Definition: phantomquad_for_p3t_k.hpp:87
PhantomGrapeQuad::__attribute__
enum PhantomGrapeQuad::@0 __attribute__
PhantomGrapeQuad::NIMAX
@ NIMAX
Definition: phantomquad_for_p3t_k.hpp:7
PhantomGrapeQuad::get_accp_one
void get_accp_one(const int addr, real_t &ax, real_t &ay, real_t &az, real_t &pot)
Definition: phantomquad_for_p3t_k.hpp:122
PhantomGrapeQuad::PhantomGrapeQuad
PhantomGrapeQuad()
Definition: phantomquad_for_p3t_k.hpp:47
PhantomGrapeQuad
Definition: phantomquad_for_p3t_k.hpp:4