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