Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_impl.cpp
Go to the documentation of this file.
1 
14 #include <valarray>
15 using std::valarray;
16 #include <string>
17 using std::string;
18 
19 #include "fopr_Wilson_impl.h"
20 
21 #include "threadManager_OpenMP.h"
22 
23 //#define USE_SU2
24 
25 #if defined USE_GROUP_SU3
26 #include "fopr_Wilson_impl_SU3.inc"
27 #elif defined USE_GROUP_SU2
28 #include "fopr_Wilson_impl_SU2.inc"
29 #elif defined USE_GROUP_SU_N
30 #include "fopr_Wilson_impl_SU_N.inc"
31 #endif
32 
33 const std::string Fopr_Wilson::Fopr_Wilson_impl::class_name = "Fopr_Wilson_impl";
34 
35 //====================================================================
37 {
39 
40  vout.general(m_vl, "%s: Construction of Wilson fermion operator(imp).\n", class_name.c_str());
41 
42  check_Nc();
43 
46  m_Nvc = 2 * m_Nc;
47  m_Ndf = 2 * m_Nc * m_Nc;
48 
53 
56  m_boundary.resize(m_Ndim);
57  m_boundary2.resize(m_Ndim);
58 
59  m_repr = repr;
60 
61  m_GM.resize(m_Ndim + 1);
62 
63  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
64 
65  m_GM[0] = gmset->get_GM(GammaMatrixSet::GAMMA1);
66  m_GM[1] = gmset->get_GM(GammaMatrixSet::GAMMA2);
67  m_GM[2] = gmset->get_GM(GammaMatrixSet::GAMMA3);
68  m_GM[3] = gmset->get_GM(GammaMatrixSet::GAMMA4);
69  m_GM[4] = gmset->get_GM(GammaMatrixSet::GAMMA5);
70 
71  delete gmset;
72 
73  m_U = 0;
74 
77 
78  if (m_repr == "Dirac") {
84  } else if (m_repr == "Chiral") {
90  } else {
91  vout.crucial(m_vl, "%s: input repr is undefined.\n", class_name.c_str());
92  abort();
93  }
94 
95  m_w1.reset(m_Nvc * m_Nd, m_Nvol, 1);
96  m_w2.reset(m_Nvc * m_Nd, m_Nvol, 1);
97 
98  int Nvx = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
99  vcp1_xp = new double[Nvx];
100  vcp2_xp = new double[Nvx];
101  vcp1_xm = new double[Nvx];
102  vcp2_xm = new double[Nvx];
103 
104  int Nvy = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
105  vcp1_yp = new double[Nvy];
106  vcp2_yp = new double[Nvy];
107  vcp1_ym = new double[Nvy];
108  vcp2_ym = new double[Nvy];
109 
110  int Nvz = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
111  vcp1_zp = new double[Nvz];
112  vcp2_zp = new double[Nvz];
113  vcp1_zm = new double[Nvz];
114  vcp2_zm = new double[Nvz];
115 
116  int Nvt = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
117  vcp1_tp = new double[Nvt];
118  vcp2_tp = new double[Nvt];
119  vcp1_tm = new double[Nvt];
120  vcp2_tm = new double[Nvt];
121 
122  setup_thread();
123 }
124 
125 //====================================================================
127 {
128  m_mode = mode;
129 
130  if (m_mode == "D") {
133  } else if (m_mode == "Ddag") {
135  m_mult_dag = &Fopr_Wilson::Fopr_Wilson_impl::D;
136  } else if (m_mode == "DdagD") {
139  } else if (m_mode == "DDdag") {
142  } else if (m_mode == "H") {
144  m_mult_dag = &Fopr_Wilson::Fopr_Wilson_impl::H;
145  } else {
146  vout.crucial(m_vl, "%s: input mode is undefined.\n", class_name.c_str());
147  abort();
148  }
149 
150 }
151 
152 //====================================================================
154 {
155  delete[] vcp1_xp;
156  delete[] vcp2_xp;
157  delete[] vcp1_xm;
158  delete[] vcp2_xm;
159 
160  delete[] vcp1_yp;
161  delete[] vcp2_yp;
162  delete[] vcp1_ym;
163  delete[] vcp2_ym;
164 
165  delete[] vcp1_zp;
166  delete[] vcp2_zp;
167  delete[] vcp1_zm;
168  delete[] vcp2_zm;
169 
170  delete[] vcp1_tp;
171  delete[] vcp2_tp;
172  delete[] vcp1_tm;
173  delete[] vcp2_tm;
174 }
175 
176 //====================================================================
178 {
179  return m_mode;
180 }
181 
182 //====================================================================
183 void Fopr_Wilson::Fopr_Wilson_impl::set_parameters(const double kappa,
184  const valarray<int> bc)
185 {
186  assert(bc.size() == m_Ndim);
187 
188  m_kappa = kappa;
189 
190  for (int mu = 0; mu < m_Ndim; ++mu) {
191  m_boundary[mu] = bc[mu];
192  }
193 
194  vout.general(m_vl, "%s: input parameters\n", class_name.c_str());
195  vout.general(m_vl, " kappa = %8.4f\n", m_kappa);
196  for (int mu = 0; mu < m_Ndim; ++mu) {
197  vout.general(m_vl, " boundary[%d] = %2d\n", mu, m_boundary[mu]);
198  }
199 
200  // boundary condition for each node:
201  for (int idir = 0; idir < m_Ndim; ++idir) {
202  m_boundary2[idir] = 1.0;
203  if (Communicator::ipe(idir) == 0) m_boundary2[idir] = m_boundary[idir];
204  }
205 
206 }
207 
208 //====================================================================
210 {
211  // The following counting explicitly depends on the implementation.
212  // It will be recalculated when the code is modified.
213  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
214 
215  int Lvol = CommonParameters::Lvol();
216  double flop_site, flop;
217 
218  if (m_repr == "Dirac") {
219  flop_site = static_cast<double>(
220  m_Nc * m_Nd * (4 + 6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
221  } else if (m_repr == "Chiral") {
222  flop_site = static_cast<double>(
223  m_Nc * m_Nd * (4 + 8 * (4 * m_Nc + 2)));
224  } else {
225  vout.crucial(m_vl, "%s: input repr is undefined.\n",
226  class_name.c_str());
227  abort();
228  }
229 
230  flop = flop_site * static_cast<double>(Lvol);
231 
232  if ((m_mode == "DdagD") || (m_mode == "DDdag")) flop *= 2.0;
233 
234  return flop;
235 }
236 
237 //====================================================================
239 {
240  D_ex_dirac(w, 0, f, 0);
241 }
242 
243 //====================================================================
245 {
246  D_ex_chiral(w, 0, f, 0);
247 }
248 
249 //====================================================================
251  Field& w, const Field& f)
252 {
253  if (mu == 0) {
254  mult_xp(w, f);
255  } else if (mu == 1) {
256  mult_yp(w, f);
257  } else if (mu == 2) {
258  mult_zp(w, f);
259  } else if (mu == 3) {
260  (this->*m_mult_tp)(w, f);
261  } else {
262  vout.crucial(m_vl, "%s: illegal direction of mu in mult_up.\n", class_name.c_str());
263  abort();
264  }
265 
266 }
267 
268 //====================================================================
270 {
271  if (mu == 0) {
272  mult_xm(w, f);
273  } else if (mu == 1) {
274  mult_ym(w, f);
275  } else if (mu == 2) {
276  mult_zm(w, f);
277  } else if (mu == 3) {
278  (this->*m_mult_tm)(w, f);
279  } else {
280  vout.crucial(m_vl, "%s: illegal direction of mu in mult_dn.\n", class_name.c_str());
281  abort();
282  }
283 
284 }
285 
286 //====================================================================
288  const Field& f, const int ex2)
289 {
290  int Ninvol = m_Nvc * m_Nd * m_Nvol;
291  double *v1 = const_cast<Field *>(&f)->ptr(Ninvol * ex2);
292  double *v2 = w.ptr(Ninvol * ex1);
293 
296 
297  int is = m_Ntask * ith / nth;
298  int ns = m_Ntask * (ith + 1) / nth - is;
299 
300  for (int i = is; i < is + ns; ++i) {
301  mult_xp1_thread(i, vcp1_xp, v1);
302  mult_xm1_thread(i, vcp1_xm, v1);
303  mult_yp1_thread(i, vcp1_yp, v1);
304  mult_ym1_thread(i, vcp1_ym, v1);
305  mult_zp1_thread(i, vcp1_zp, v1);
306  mult_zm1_thread(i, vcp1_zm, v1);
307  mult_tp1_dirac_thread(i, vcp1_tp, v1);
308  mult_tm1_dirac_thread(i, vcp1_tm, v1);
309  }
310  #pragma omp barrier
311 
312  #pragma omp master
313  {
314  int Nvx = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
315  Communicator::exchange(Nvx, vcp2_xp, vcp1_xp, 0, 1, 1);
316  Communicator::exchange(Nvx, vcp2_xm, vcp1_xm, 0, -1, 2);
317 
318  int Nvy = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
319  Communicator::exchange(Nvy, vcp2_yp, vcp1_yp, 1, 1, 3);
320  Communicator::exchange(Nvy, vcp2_ym, vcp1_ym, 1, -1, 4);
321 
322  int Nvz = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
323  Communicator::exchange(Nvz, vcp2_zp, vcp1_zp, 2, 1, 5);
324  Communicator::exchange(Nvz, vcp2_zm, vcp1_zm, 2, -1, 6);
325 
326  int Nvt = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
327  Communicator::exchange(Nvt, vcp2_tp, vcp1_tp, 3, 1, 7);
328  Communicator::exchange(Nvt, vcp2_tm, vcp1_tm, 3, -1, 8);
329  }
330  #pragma omp barrier
331 
332  for (int i = is; i < is + ns; ++i) {
333  clear_thread(i, v2);
334  mult_xpb_thread(i, v2, v1);
335  mult_xmb_thread(i, v2, v1);
336  mult_ypb_thread(i, v2, v1);
337  mult_ymb_thread(i, v2, v1);
338  mult_zpb_thread(i, v2, v1);
339  mult_zmb_thread(i, v2, v1);
340  mult_tpb_dirac_thread(i, v2, v1);
341  mult_tmb_dirac_thread(i, v2, v1);
342  }
343 
344  for (int i = is; i < is + ns; ++i) {
345  mult_xp2_thread(i, v2, vcp2_xp);
346  mult_xm2_thread(i, v2, vcp2_xm);
347  mult_yp2_thread(i, v2, vcp2_yp);
348  mult_ym2_thread(i, v2, vcp2_ym);
349  mult_zp2_thread(i, v2, vcp2_zp);
350  mult_zm2_thread(i, v2, vcp2_zm);
351  mult_tp2_dirac_thread(i, v2, vcp2_tp);
352  mult_tm2_dirac_thread(i, v2, vcp2_tm);
353  daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
354  }
355 
357 }
358 
359 //====================================================================
361  const Field& f, const int ex2)
362 {
363  int Ninvol = m_Nvc * m_Nd * m_Nvol;
364  double *v1 = const_cast<Field *>(&f)->ptr(Ninvol * ex2);
365  double *v2 = w.ptr(Ninvol * ex1);
366 
369 
370  int is = m_Ntask * ith / nth;
371  int ns = m_Ntask * (ith + 1) / nth - is;
372 
373  for (int i = is; i < is + ns; ++i) {
374  mult_xp1_thread(i, vcp1_xp, v1);
375  mult_xm1_thread(i, vcp1_xm, v1);
376  mult_yp1_thread(i, vcp1_yp, v1);
377  mult_ym1_thread(i, vcp1_ym, v1);
378  mult_zp1_thread(i, vcp1_zp, v1);
379  mult_zm1_thread(i, vcp1_zm, v1);
380  mult_tp1_chiral_thread(i, vcp1_tp, v1);
381  mult_tm1_chiral_thread(i, vcp1_tm, v1);
382  }
383  #pragma omp barrier
384 
385  #pragma omp master
386  {
387  int Nvx = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
388  Communicator::exchange(Nvx, vcp2_xp, vcp1_xp, 0, 1, 1);
389  Communicator::exchange(Nvx, vcp2_xm, vcp1_xm, 0, -1, 2);
390 
391  int Nvy = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
392  Communicator::exchange(Nvy, vcp2_yp, vcp1_yp, 1, 1, 3);
393  Communicator::exchange(Nvy, vcp2_ym, vcp1_ym, 1, -1, 4);
394 
395  int Nvz = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
396  Communicator::exchange(Nvz, vcp2_zp, vcp1_zp, 2, 1, 5);
397  Communicator::exchange(Nvz, vcp2_zm, vcp1_zm, 2, -1, 6);
398 
399  int Nvt = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
400  Communicator::exchange(Nvt, vcp2_tp, vcp1_tp, 3, 1, 7);
401  Communicator::exchange(Nvt, vcp2_tm, vcp1_tm, 3, -1, 8);
402  }
403  #pragma omp barrier
404 
405  for (int i = is; i < is + ns; ++i) {
406  clear_thread(i, v2);
407  mult_xpb_thread(i, v2, v1);
408  mult_xmb_thread(i, v2, v1);
409  mult_ypb_thread(i, v2, v1);
410  mult_ymb_thread(i, v2, v1);
411  mult_zpb_thread(i, v2, v1);
412  mult_zmb_thread(i, v2, v1);
413  mult_tpb_chiral_thread(i, v2, v1);
414  mult_tmb_chiral_thread(i, v2, v1);
415  }
416 
417  for (int i = is; i < is + ns; ++i) {
418  mult_xp2_thread(i, v2, vcp2_xp);
419  mult_xm2_thread(i, v2, vcp2_xm);
420  mult_yp2_thread(i, v2, vcp2_yp);
421  mult_ym2_thread(i, v2, vcp2_ym);
422  mult_zp2_thread(i, v2, vcp2_zp);
423  mult_zm2_thread(i, v2, vcp2_zm);
424  mult_tp2_chiral_thread(i, v2, vcp2_tp);
425  mult_tm2_chiral_thread(i, v2, vcp2_tm);
426  daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
427  }
428 
430 
431  /*
432  clear(w);
433  mult_xp(w,f);
434  mult_xm(w,f);
435  mult_yp(w,f);
436  mult_ym(w,f);
437  mult_zp(w,f);
438  mult_zm(w,f);
439  mult_tp_chiral(w,f);
440  mult_tm_chiral(w,f);
441  daypx(w, -m_kappa, f); // w = -m_kappa * w + f.
442  */
443 }
444 
445 //====================================================================
447  Field& v, const Field& w)
448 {
449  clear(m_w2);
450 
451  mult_up(mu, m_w2, w);
452  mult_gm5(v, m_w2);
453 }
454 
455 //====================================================================
457  const Field& v, const int ex2, const int ipm)
458 {
459  double fpm = 0.0;
460 
461  if (ipm == 1) {
462  fpm = 1.0;
463  } else if (ipm == -1) {
464  fpm = -1.0;
465  } else {
466  vout.crucial(m_vl, "%s: illegal chirality = %d.\n", class_name.c_str(), ipm);
467  abort();
468  }
469 
470  m_w1.setpart_ex(0, v, ex2);
471  mult_gm5(m_w2, m_w1);
472  m_w1.addpart_ex(0, m_w2, 0, fpm);
473  w.setpart_ex(ex1, m_w1, 0);
474 }
475 
476 //====================================================================
478  double fac, const Field& f)
479 {
480  double *v1 = const_cast<Field *>(&f)->ptr(0);
481  double *v2 = w.ptr(0);
482 
485 
486  int is = m_Ntask * ith / nth;
487  int ns = m_Ntask * (ith + 1) / nth - is;
488 
489  for (int i = is; i < is + ns; ++i) {
490  daypx_thread(i, v2, fac, v1);
491  }
492 
493 }
494 
495 //====================================================================
497 {
498  double *v2 = w.ptr(0);
499 
502 
503  int is = m_Ntask * ith / nth;
504  int ns = m_Ntask * (ith + 1) / nth - is;
505 
506  for (int i = is; i < is + ns; ++i) {
507  clear_thread(i, v2);
508  }
509 
510 }
511 
512 //====================================================================
514 {
515  double *v1 = const_cast<Field *>(&f)->ptr(0);
516  double *v2 = w.ptr(0);
517 
520 
521  int is = m_Ntask * ith / nth;
522  int ns = m_Ntask * (ith + 1) / nth - is;
523 
524  for (int i = is; i < is + ns; ++i) {
525  gm5_dirac_thread(i, v2, v1);
526  }
527 
528 }
529 
530 //====================================================================
532 {
533  double *v1 = const_cast<Field *>(&f)->ptr(0);
534  double *v2 = w.ptr(0);
535 
538 
539  int is = m_Ntask * ith / nth;
540  int ns = m_Ntask * (ith + 1) / nth - is;
541 
542  for (int i = is; i < is + ns; ++i) {
543  gm5_chiral_thread(i, v2, v1);
544  }
545 
546 }
547 
548 //====================================================================
550 {
551  double *v1 = const_cast<Field *>(&f)->ptr(0);
552  double *v2 = w.ptr(0);
553 
556 
557  int is = m_Ntask * ith / nth;
558  int ns = m_Ntask * (ith + 1) / nth - is;
559 
560 #pragma omp barrier
561 
562  for (int i = is; i < is + ns; ++i) {
563  mult_xp1_thread(i, vcp1_xp, v1);
564  }
565  #pragma omp barrier
566 
567  #pragma omp master
568  {
569  int Nv = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
570  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
571  }
572  #pragma omp barrier
573 
574  for (int i = is; i < is + ns; ++i) {
575  mult_xpb_thread(i, v2, v1);
576  }
577 
578  for (int i = is; i < is + ns; ++i) {
579  mult_xp2_thread(i, v2, vcp2_xp);
580  }
581 
583 }
584 
585 //====================================================================
587 {
588  double *v2 = w.ptr(0);
589  double *v1 = const_cast<Field *>(&f)->ptr(0);
590 
593 
594  int is = m_Ntask * ith / nth;
595  int ns = m_Ntask * (ith + 1) / nth - is;
596 
597 #pragma omp barrier
598 
599  for (int i = is; i < is + ns; ++i) {
600  mult_xm1_thread(i, vcp1_xm, v1);
601  }
602  #pragma omp barrier
603 
604  #pragma omp master
605  {
606  int Nv = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
607  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
608  }
609  #pragma omp barrier
610 
611  for (int i = is; i < is + ns; ++i) {
612  mult_xmb_thread(i, v2, v1);
613  }
614 
615  for (int i = is; i < is + ns; ++i) {
616  mult_xm2_thread(i, v2, vcp2_xm);
617  }
618 
620 }
621 
622 //====================================================================
624 {
625  double *v1 = const_cast<Field *>(&f)->ptr(0);
626  double *v2 = w.ptr(0);
627 
630 
631  int is = m_Ntask * ith / nth;
632  int ns = m_Ntask * (ith + 1) / nth - is;
633 
634 #pragma omp barrier
635 
636  for (int i = is; i < is + ns; ++i) {
637  mult_yp1_thread(i, vcp1_yp, v1);
638  }
639  #pragma omp barrier
640 
641  #pragma omp master
642  {
643  int Nv = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
644  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
645  }
646  #pragma omp barrier
647 
648  for (int i = is; i < is + ns; ++i) {
649  mult_ypb_thread(i, v2, v1);
650  }
651 
652  for (int i = is; i < is + ns; ++i) {
653  mult_yp2_thread(i, v2, vcp2_yp);
654  }
655 
657 }
658 
659 //====================================================================
661 {
662  double *v2 = w.ptr(0);
663  double *v1 = const_cast<Field *>(&f)->ptr(0);
664 
667 
668  int is = m_Ntask * ith / nth;
669  int ns = m_Ntask * (ith + 1) / nth - is;
670 
671 #pragma omp barrier
672 
673  for (int i = is; i < is + ns; ++i) {
674  mult_ym1_thread(i, vcp1_ym, v1);
675  }
676  #pragma omp barrier
677 
678  #pragma omp master
679  {
680  int Nv = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
681  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
682  }
683  #pragma omp barrier
684 
685  for (int i = is; i < is + ns; ++i) {
686  mult_ymb_thread(i, v2, v1);
687  }
688 
689  for (int i = is; i < is + ns; ++i) {
690  mult_ym2_thread(i, v2, vcp2_ym);
691  }
692 
694 }
695 
696 //====================================================================
698 {
699  double *v1 = const_cast<Field *>(&f)->ptr(0);
700  double *v2 = w.ptr(0);
701 
704 
705  int is = m_Ntask * ith / nth;
706  int ns = m_Ntask * (ith + 1) / nth - is;
707 
708 #pragma omp barrier
709 
710  for (int i = is; i < is + ns; ++i) {
711  mult_zp1_thread(i, vcp1_zp, v1);
712  }
713  #pragma omp barrier
714 
715  #pragma omp master
716  {
717  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
718  Communicator::exchange(Nv, vcp2_zp, vcp1_zp, 2, 1, 5);
719  }
720  #pragma omp barrier
721 
722  for (int i = is; i < is + ns; ++i) {
723  mult_zpb_thread(i, v2, v1);
724  }
725 
726  for (int i = is; i < is + ns; ++i) {
727  mult_zp2_thread(i, v2, vcp2_zp);
728  }
729 
731 }
732 
733 //====================================================================
735 {
736  double *v2 = w.ptr(0);
737  double *v1 = const_cast<Field *>(&f)->ptr(0);
738 
741 
742  int is = m_Ntask * ith / nth;
743  int ns = m_Ntask * (ith + 1) / nth - is;
744 
745 #pragma omp barrier
746 
747  for (int i = is; i < is + ns; ++i) {
748  mult_zm1_thread(i, vcp1_zm, v1);
749  }
750  #pragma omp barrier
751 
752  #pragma omp master
753  {
754  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
755  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
756  }
757  #pragma omp barrier
758 
759  for (int i = is; i < is + ns; ++i) {
760  mult_zmb_thread(i, v2, v1);
761  }
762 
763  for (int i = is; i < is + ns; ++i) {
764  mult_zm2_thread(i, v2, vcp2_zm);
765  }
766 
768 }
769 
770 //====================================================================
772 {
773  double *v1 = const_cast<Field *>(&f)->ptr(0);
774  double *v2 = w.ptr(0);
775 
778 
779  int is = m_Ntask * ith / nth;
780  int ns = m_Ntask * (ith + 1) / nth - is;
781 
782 #pragma omp barrier
783 
784  for (int i = is; i < is + ns; ++i) {
785  mult_tp1_dirac_thread(i, vcp1_tp, v1);
786  }
787  #pragma omp barrier
788 
789  #pragma omp master
790  {
791  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
792  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
793  }
794  #pragma omp barrier
795 
796  for (int i = is; i < is + ns; ++i) {
797  mult_tpb_dirac_thread(i, v2, v1);
798  }
799 
800  for (int i = is; i < is + ns; ++i) {
801  mult_tp2_dirac_thread(i, v2, vcp2_tp);
802  }
803 
805 }
806 
807 //====================================================================
809 {
810  double *v2 = w.ptr(0);
811  double *v1 = const_cast<Field *>(&f)->ptr(0);
812 
815 
816  int is = m_Ntask * ith / nth;
817  int ns = m_Ntask * (ith + 1) / nth - is;
818 
819 #pragma omp barrier
820 
821  for (int i = is; i < is + ns; ++i) {
822  mult_tm1_dirac_thread(i, vcp1_tm, v1);
823  }
824  #pragma omp barrier
825 
826  #pragma omp master
827  {
828  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
829  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
830  }
831  #pragma omp barrier
832 
833  for (int i = is; i < is + ns; ++i) {
834  mult_tmb_dirac_thread(i, v2, v1);
835  }
836 
837  for (int i = is; i < is + ns; ++i) {
838  mult_tm2_dirac_thread(i, v2, vcp2_tm);
839  }
840 
842 }
843 
844 //====================================================================
846 {
847  double *v1 = const_cast<Field *>(&f)->ptr(0);
848  double *v2 = w.ptr(0);
849 
852 
853  int is = m_Ntask * ith / nth;
854  int ns = m_Ntask * (ith + 1) / nth - is;
855 
856 #pragma omp barrier
857 
858  for (int i = is; i < is + ns; ++i) {
859  mult_tp1_chiral_thread(i, vcp1_tp, v1);
860  }
861  #pragma omp barrier
862 
863  #pragma omp master
864  {
865  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
866  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
867  }
868  #pragma omp barrier
869 
870  for (int i = is; i < is + ns; ++i) {
871  mult_tpb_chiral_thread(i, v2, v1);
872  }
873 
874  for (int i = is; i < is + ns; ++i) {
875  mult_tp2_chiral_thread(i, v2, vcp2_tp);
876  }
877 
879 }
880 
881 //====================================================================
883 {
884  double *v2 = w.ptr(0);
885  double *v1 = const_cast<Field *>(&f)->ptr(0);
886 
889 
890  int is = m_Ntask * ith / nth;
891  int ns = m_Ntask * (ith + 1) / nth - is;
892 
893 #pragma omp barrier
894 
895  for (int i = is; i < is + ns; ++i) {
896  mult_tm1_chiral_thread(i, vcp1_tm, v1);
897  }
898  #pragma omp barrier
899 
900  #pragma omp master
901  {
902  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
903  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
904  }
905  #pragma omp barrier
906 
907  for (int i = is; i < is + ns; ++i) {
908  mult_tmb_chiral_thread(i, v2, v1);
909  }
910 
911  for (int i = is; i < is + ns; ++i) {
912  mult_tm2_chiral_thread(i, v2, vcp2_tm);
913  }
914 
916 }
917 
918 //====================================================================
919 //============================================================END=====
void daypx(Field &, double, const Field &)
void mult_zp(Field &, const Field &)
BridgeIO vout
Definition: bridgeIO.cpp:207
static int get_num_threads()
returns available number of threads.
void set_parameters(const double kappa, const std::valarray< int > bc)
void gm5_chiral(Field &, const Field &)
void proj_chiral(Field &w, const int ex1, const Field &v, const int ex2, const int ipm)
double * vcp1_xp
arrays for data transfer.
void mult_tm_dirac(Field &, const Field &)
void general(const char *format,...)
Definition: bridgeIO.cpp:38
GammaMatrix get_GM(GMspecies spec)
static Bridge::VerboseLevel Vlevel()
double * ptr(const int jin, const int site, const int jex)
Definition: field.h:118
Container of Field-type object.
Definition: field.h:37
void(Fopr_Wilson::Fopr_Wilson_impl::* m_D_ex)(Field &, const int, const Field &, const int)
void D(Field &v, const Field &f)
void(Fopr_Wilson::Fopr_Wilson_impl::* m_mult_dag)(Field &, const Field &)
void mult_up(int mu, Field &w, const Field &v)
adding the hopping to nearest neighbor site in mu-th direction.
void mult_tp_chiral(Field &, const Field &)
static int ipe(const int dir)
logical coordinate of current proc.
void H(Field &w, const Field &f)
static int Lvol()
std::valarray< double > m_boundary2
b.c. for each node.
void D_chiral(Field &, const Field &)
static int get_thread_id()
returns thread id.
void mult_xm(Field &, const Field &)
void DdagD(Field &w, const Field &f)
const Field_G * m_U
gauge configuration.
Field m_w2
temporary fields.
void(Fopr_Wilson::Fopr_Wilson_impl::* m_mult)(Field &, const Field &)
void DDdag(Field &w, const Field &f)
Bridge::VerboseLevel m_vl
Definition: fopr.h:99
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:82
std::valarray< GammaMatrix > m_GM
gamma matrices.
static void sync_barrier_all()
barrier among all the threads and nodes.
void mult_ym(Field &, const Field &)
void(Fopr_Wilson::Fopr_Wilson_impl::* m_D)(Field &, const Field &)
static int exchange(int count, double *recv_buf, double *send_buf, int idir, int ipm, int tag)
receive array of double from upstream specified by idir and ipm, and send array to downstream...
Set of Gamma Matrices: basis class.
static const std::string class_name
Definition: fopr_Wilson.h:56
void(Fopr_Wilson::Fopr_Wilson_impl::* m_gm5)(Field &, const Field &)
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
static const std::string class_name
const Field_F mult_gm5p(int mu, const Field_F &w)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
void set_mode(std::string mode)
void(Fopr_Wilson::Fopr_Wilson_impl::* m_mult_tm)(Field &, const Field &)
void mult_tp_dirac(Field &, const Field &)
std::valarray< int > m_boundary
boundary condition.
void mult_up(int mu, Field &, const Field &)
void D_dirac(Field &, const Field &)
void mult_zm(Field &, const Field &)
void mult_undef(Field &, const Field &f)
void mult_yp(Field &, const Field &)
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:150
void mult_xp(Field &, const Field &)
void mult_dn(int mu, Field &, const Field &)
void Ddag(Field &w, const Field &f)
void init(std::string repr)
void(Fopr_Wilson::Fopr_Wilson_impl::* m_mult_tp)(Field &, const Field &)
const Field mult_gm5(const Field &f)
Definition: fopr_Wilson.h:91
void mult_tm_chiral(Field &, const Field &)
void gm5_dirac(Field &, const Field &)