Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_eo_impl.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_eo_impl.h"
15 
17 
18 namespace Imp {
19 //====================================================================
20  const std::string Fopr_Wilson_eo::class_name = "Imp::Fopr_Wilson_eo";
21 
22 //====================================================================
23  void Fopr_Wilson_eo::init(const std::string repr)
24  {
25  m_repr = repr;
26 
28 
31  m_Nvc = 2 * m_Nc;
32  m_Ndf = 2 * m_Nc * m_Nc;
33  int Nvcd = m_Nvc * m_Nd;
34 
36  m_Nvol2 = m_Nvol / 2;
38 
43 
44  if ((m_Nx % 2) != 0) {
45  vout.crucial(m_vl, "Error at %s: Nx=%d must be even.\n", class_name.c_str(), m_Nx);
46  exit(EXIT_FAILURE);
47  }
48  m_Nx2 = m_Nx / 2;
49 
50  if ((m_Ny % 2) != 0) {
51  vout.crucial(m_vl, "Error at %s: Ny=%d must be even.\n", class_name.c_str(), m_Ny);
52  exit(EXIT_FAILURE);
53  }
54 
57  m_boundary.resize(m_Ndim);
58  m_boundary2.resize(m_Ndim);
59 
60  m_Leo.resize(m_Ny * m_Nz * m_Nt);
61 
62  for (int t = 0; t < m_Nt; ++t) {
63  for (int z = 0; z < m_Nz; ++z) {
64  for (int y = 0; y < m_Ny; ++y) {
65  int t2 = Communicator::ipe(3) * m_Nt + t;
66  int z2 = Communicator::ipe(2) * m_Nz + z;
67  int y2 = Communicator::ipe(1) * m_Ny + y;
68 
69  m_Leo[y + m_Ny * (z + m_Nz * t)] = (y2 + z2 + t2) % 2;
70  }
71  }
72  }
73 
74  m_Ueo = new Field_G(m_Nvol, m_Ndim);
75 
76  if (m_repr == "Dirac") {
81  } else if (m_repr == "Chiral") {
86  } else {
87  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
88  class_name.c_str());
89  exit(EXIT_FAILURE);
90  }
91 
92  int Nvx = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
93  vcp1_xp = new double[Nvx];
94  vcp2_xp = new double[Nvx];
95  vcp1_xm = new double[Nvx];
96  vcp2_xm = new double[Nvx];
97 
98  int Nvy = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
99  vcp1_yp = new double[Nvy];
100  vcp2_yp = new double[Nvy];
101  vcp1_ym = new double[Nvy];
102  vcp2_ym = new double[Nvy];
103 
104  int Nvz = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
105  vcp1_zp = new double[Nvz];
106  vcp2_zp = new double[Nvz];
107  vcp1_zm = new double[Nvz];
108  vcp2_zm = new double[Nvz];
109 
110  int Nvt = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
111  vcp1_tp = new double[Nvt];
112  vcp2_tp = new double[Nvt];
113  vcp1_tm = new double[Nvt];
114  vcp2_tm = new double[Nvt];
115 
116  m_v1.reset(Nvcd, m_Nvol2, 1);
117  m_v2.reset(Nvcd, m_Nvol2, 1);
118  m_w1.reset(Nvcd, m_Nvol2, 1);
119  m_w2.reset(Nvcd, m_Nvol2, 1);
120 
121  setup_thread();
122  }
123 
124 
125 //====================================================================
127  {
128  delete m_Ueo;
129 
130  delete[] vcp1_xp;
131  delete[] vcp2_xp;
132  delete[] vcp1_xm;
133  delete[] vcp2_xm;
134 
135  delete[] vcp1_yp;
136  delete[] vcp2_yp;
137  delete[] vcp1_ym;
138  delete[] vcp2_ym;
139 
140  delete[] vcp1_zp;
141  delete[] vcp2_zp;
142  delete[] vcp1_zm;
143  delete[] vcp2_zm;
144 
145  delete[] vcp1_tp;
146  delete[] vcp2_tp;
147  delete[] vcp1_tm;
148  delete[] vcp2_tm;
149  }
150 
151 
152 //====================================================================
154  {
155  const string str_vlevel = params.get_string("verbose_level");
156 
157  m_vl = vout.set_verbose_level(str_vlevel);
158 
159  //- fetch and check input parameters
160  double kappa;
161  std::vector<int> bc;
162 
163  int err = 0;
164  err += params.fetch_double("hopping_parameter", kappa);
165  err += params.fetch_int_vector("boundary_condition", bc);
166 
167  if (err) {
168  vout.crucial(m_vl, "Error at %s: fetch error, input parameter not found.\n", class_name.c_str());
169  exit(EXIT_FAILURE);
170  }
171 
172  set_parameters(kappa, bc);
173  }
174 
175 
176 //====================================================================
178  const double kappa,
179  const std::vector<int> bc)
180  {
181  //- print input parameters
182  vout.general(m_vl, "%s:\n", class_name.c_str());
183  vout.general(m_vl, " kappa = %12.8f\n", kappa);
184  for (int mu = 0; mu < m_Ndim; ++mu) {
185  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
186  }
187 
188  //- range check
189  // NB. kappa = 0 is allowed.
190  assert(bc.size() == m_Ndim);
191 
192  //- store values
193  m_kappa = kappa;
194 
195  // m_boundary.resize(m_Ndim); // already resized in init.
196  for (int mu = 0; mu < m_Ndim; ++mu) {
197  m_boundary[mu] = bc[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  m_index.convertField(*m_Ueo, *U);
212  m_U = m_Ueo;
213  }
214 
215 
216 //====================================================================
217  void Fopr_Wilson_eo::set_mode(std::string mode)
218  {
219  m_mode = mode;
220 
221  if (m_mode == "D") {
226  } else if (m_mode == "Ddag") {
231  } else if (m_mode == "DdagD") {
234  } else if (m_mode == "DDdag") {
237  } else if (m_mode == "H") {
240  } else {
241  vout.crucial("Error at %s: input mode is undefined.\n", class_name.c_str());
242  exit(EXIT_FAILURE);
243  }
244  }
245 
246 
247 //====================================================================
248  std::string Fopr_Wilson_eo::get_mode() const
249  {
250  return m_mode;
251  }
252 
253 
254 //====================================================================
256  {
257  // The following counting explicitly depends on the implementation.
258  // It will be recalculated when the code is modified.
259  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
260 
261  int Lvol = CommonParameters::Lvol();
262  double flop_site, flop;
263 
264  if (m_repr == "Dirac") {
265  flop_site = static_cast<double>(
266  m_Nc * m_Nd * (6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
267  } else if (m_repr == "Chiral") {
268  flop_site = static_cast<double>(
269  m_Nc * m_Nd * 8 * (4 * m_Nc + 2));
270  } else {
271  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
272  class_name.c_str());
273  exit(EXIT_FAILURE);
274  }
275 
276  flop = flop_site * static_cast<double>(Lvol / 2);
277 
278  return flop;
279  }
280 
281 
282 //====================================================================
284  const Field& b)
285  {
286  int Nin = b.nin();
287  int Nex = b.nex();
288 
289  Field be(Nin, m_Nvol2, Nex);
290 
291  m_index.convertField(be, b, 0);
292  m_index.convertField(bo, b, 1);
293 
294  Be.reset(Nin, m_Nvol2, Nex);
295 
296  // Be = be - (Field)Meo(bo, 0);
297  Field_F v1(m_Nvol2, Nex);
298  copy(Be, be);
299  Meo(v1, bo, 0);
300  axpy(Be, -1.0, v1);
301 
302 #pragma omp barrier
303  }
304 
305 
306 //====================================================================
308  const Field& xe, const Field& bo)
309  {
310  int Nin = xe.nin();
311  int Nex = xe.nex();
312 
313  Field xo(Nin, m_Nvol2, Nex);
314 
315  Field_F v1(m_Nvol2, Nex);
316 
317  copy(xo, bo);
318  Meo(v1, xe, 1);
319  axpy(xo, -1.0, v1);
320 
321  x.reset(Nin, m_Nvol2 * 2, Nex);
322  m_index.reverseField(x, xe, 0);
323  m_index.reverseField(x, xo, 1);
324 
325 #pragma omp barrier
326  }
327 
328 
329 //====================================================================
331  Field& bo, const Field& b)
332  {
333  int Nin = b.nin();
334  int Nex = b.nex();
335 
336  Field be(Nin, m_Nvol2, Nex);
337 
338  m_index.convertField(be, b, 0);
339  m_index.convertField(bo, b, 1);
340 
341  Be.reset(Nin, m_Nvol2, Nex);
342 
343  Field_F v1(m_Nvol2, Nex);
344  copy(Be, be);
345  Mdageo(v1, bo, 0);
346  axpy(Be, -1.0, v1);
347 
348 #pragma omp barrier
349  }
350 
351 
352 //====================================================================
354  const Field& xe, const Field& bo)
355  {
356  int Nin = xe.nin();
357  int Nex = xe.nex();
358 
359  Field xo(Nin, m_Nvol2, Nex);
360 
361  Field_F v1(m_Nvol2, Nex);
362 
363  copy(xo, bo);
364  Mdageo(v1, xe, 1);
365  axpy(xo, -1.0, v1);
366 
367  x.reset(Nin, m_Nvol2 * 2, Nex);
368  m_index.reverseField(x, xe, 0);
369  m_index.reverseField(x, xo, 1);
370 
371 #pragma omp barrier
372  }
373 
374 
375 //====================================================================
376  void Fopr_Wilson_eo::DdagD(Field& v, const Field& f)
377  {
378  D(m_w1, f);
379  Ddag(v, m_w1);
380  }
381 
382 
383 //====================================================================
384  void Fopr_Wilson_eo::DDdag(Field& v, const Field& f)
385  {
386  Ddag(m_w1, f);
387  D(v, m_w1);
388  }
389 
390 
391 //====================================================================
392  void Fopr_Wilson_eo::H(Field& v, const Field& f)
393  {
394  D(v, f);
395  mult_gm5(v);
396  }
397 
398 
399 //====================================================================
400  void Fopr_Wilson_eo::MeoMoe(Field& v, const Field& f)
401  {
402  Meo(m_w1, f, 1);
403  Meo(m_w2, m_w1, 0);
404  axpy(v, -1.0, m_w2);
405 
406 #pragma omp barrier
407  }
408 
409 
410 //====================================================================
411  void Fopr_Wilson_eo::D(Field& v, const Field& f)
412  {
413  assert(f.nex() == 1);
414 
415  Meo(m_v1, f, 1);
416  Meo(v, m_v1, 0);
417  aypx(-1.0, v, f);
418 
419 #pragma omp barrier
420  }
421 
422 
423 //====================================================================
424  void Fopr_Wilson_eo::Ddag(Field& v, const Field& f)
425  {
426  Mdageo(m_v1, f, 1);
427  Mdageo(v, m_v1, 0);
428  aypx(-1.0, v, f);
429 
430 #pragma omp barrier
431  }
432 
433 
434 //====================================================================
436  const Field& f, const int ieo)
437  {
438 #pragma omp barrier
439 
440  // clear_impl(w); // w = 0.0;
441  w.set(0.0); // w = 0.0;
442 
443  mult_xp(w, f, ieo);
444  mult_xm(w, f, ieo);
445 
446  mult_yp(w, f, ieo);
447  mult_ym(w, f, ieo);
448 
449  mult_zp(w, f, ieo);
450  mult_zm(w, f, ieo);
451 
452  (this->*m_mult_tp)(w, f, ieo);
453  (this->*m_mult_tm)(w, f, ieo);
454 
455  scal(w, -m_kappa); // w *= -m_kappa; using Field function.
456  // scal_impl(w, -m_kappa); // w *= -m_kappa;
457 
459  }
460 
461 
462 //====================================================================
464  const Field& f, const int ieo)
465  {
466  // Field_F v(m_Nvol2, f.nex());
467  // mult_gm5(v, (Field)f);
468  // Meo_gm5(w, v, ieo);
469 
470  mult_gm5(m_v2, f);
471  Meo(w, m_v2, ieo);
472  mult_gm5(w);
473  }
474 
475 
476 //====================================================================
478  const Field& f, const int ieo)
479  {
480  Meo(v, f, ieo);
481  mult_gm5(v);
482  }
483 
484 
485 //====================================================================
487  {
488  (this->*m_gm5)(w, f);
489  }
490 
491 
492 //====================================================================
494  {
495  (this->*m_gm5_self)(w);
496  }
497 
498 
499 //====================================================================
501  const Field& f)
502  {
503  const double *v1 = f.ptr(0);
504  double *v2 = w.ptr(0);
505 
507  int i_thread = ThreadManager_OpenMP::get_thread_id();
508 
509  int is = m_Ntask * i_thread / Nthread;
510  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
511 
512  for (int i = is; i < is + ns; ++i) {
513  gm5_dirac_thread(i, v2, v1);
514  }
515 #pragma omp barrier
516  }
517 
518 
519 //====================================================================
521  const Field& f)
522  {
523  const double *v1 = f.ptr(0);
524  double *v2 = w.ptr(0);
525 
527  int i_thread = ThreadManager_OpenMP::get_thread_id();
528 
529  int is = m_Ntask * i_thread / Nthread;
530  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
531 
532  for (int i = is; i < is + ns; ++i) {
533  gm5_chiral_thread(i, v2, v1);
534  }
535 #pragma omp barrier
536  }
537 
538 
539 //====================================================================
541  {
542  double *wp = w.ptr(0);
543 
545  int i_thread = ThreadManager_OpenMP::get_thread_id();
546 
547  int is = m_Ntask * i_thread / Nthread;
548  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
549 
550  for (int i = is; i < is + ns; ++i) {
551  gm5_dirac_thread(i, wp);
552  }
553 #pragma omp barrier
554  }
555 
556 
557 //====================================================================
559  {
560  double *wp = w.ptr(0);
561 
563  int i_thread = ThreadManager_OpenMP::get_thread_id();
564 
565  int is = m_Ntask * i_thread / Nthread;
566  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
567 
568  for (int i = is; i < is + ns; ++i) {
569  gm5_chiral_thread(i, wp);
570  }
571 #pragma omp barrier
572  }
573 
574 
575 //====================================================================
576  void Fopr_Wilson_eo::gm5p(const int mu, Field& w,
577  const Field& f)
578  {
579  // this function is probably not to be used.
580  // determines \gamma_5 * (1 - \gamma_\mu) v(x+\hat{x})
581  vout.crucial(m_vl, "Error at %s: gm5p is undefined.\n", class_name.c_str());
582  exit(EXIT_FAILURE);
583  }
584 
585 
586 //====================================================================
588  {
589  double *wp = w.ptr(0);
590 
592  int i_thread = ThreadManager_OpenMP::get_thread_id();
593 
594  int is = m_Ntask * i_thread / Nthread;
595  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
596 
597  for (int i = is; i < is + ns; ++i) {
598  clear_thread(i, wp);
599  }
600 #pragma omp barrier
601  }
602 
603 
604 //====================================================================
605  void Fopr_Wilson_eo::scal_impl(Field& w, double a)
606  {
607  double *wp = w.ptr(0);
608 
610  int i_thread = ThreadManager_OpenMP::get_thread_id();
611 
612  int is = m_Ntask * i_thread / Nthread;
613  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
614 
615  for (int i = is; i < is + ns; ++i) {
616  scal_thread(i, wp, a);
617  }
618 #pragma omp barrier
619  }
620 
621 
622 //====================================================================
624  const Field& f, const int ieo)
625  {
626  const double *v1 = f.ptr(0);
627  double *v2 = w.ptr(0);
628 
630  int i_thread = ThreadManager_OpenMP::get_thread_id();
631 
632  int is = m_Ntask * i_thread / Nthread;
633  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
634 
635  for (int i = is; i < is + ns; ++i) {
636  mult_xp1_thread(i, vcp1_xp, v1, ieo);
637  }
638 
639 #pragma omp barrier
640 #pragma omp master
641  {
642  int Nv = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
643  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
644  }
645 #pragma omp barrier
646 
647  for (int i = is; i < is + ns; ++i) {
648  mult_xpb_thread(i, v2, v1, ieo);
649  }
650 
651  for (int i = is; i < is + ns; ++i) {
652  mult_xp2_thread(i, v2, vcp2_xp, ieo);
653  }
654 #pragma omp barrier
655  }
656 
657 
658 //====================================================================
660  const Field& f, const int ieo)
661  {
662  const double *v1 = f.ptr(0);
663  double *v2 = w.ptr(0);
664 
666  int i_thread = ThreadManager_OpenMP::get_thread_id();
667 
668  int is = m_Ntask * i_thread / Nthread;
669  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
670 
671  for (int i = is; i < is + ns; ++i) {
672  mult_xm1_thread(i, vcp1_xm, v1, ieo);
673  }
674 
675 #pragma omp barrier
676 #pragma omp master
677  {
678  int Nv = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
679  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
680  }
681 #pragma omp barrier
682 
683  for (int i = is; i < is + ns; ++i) {
684  mult_xmb_thread(i, v2, v1, ieo);
685  }
686 
687  for (int i = is; i < is + ns; ++i) {
688  mult_xm2_thread(i, v2, vcp2_xm, ieo);
689  }
690 #pragma omp barrier
691  }
692 
693 
694 //====================================================================
696  const Field& f, const int ieo)
697  {
698  const double *v1 = f.ptr(0);
699  double *v2 = w.ptr(0);
700 
702  int i_thread = ThreadManager_OpenMP::get_thread_id();
703 
704  int is = m_Ntask * i_thread / Nthread;
705  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
706 
707  for (int i = is; i < is + ns; ++i) {
708  mult_yp1_thread(i, vcp1_yp, v1, ieo);
709  }
710 
711 #pragma omp barrier
712 #pragma omp master
713  {
714  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
715  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
716  }
717 #pragma omp barrier
718 
719  for (int i = is; i < is + ns; ++i) {
720  mult_ypb_thread(i, v2, v1, ieo);
721  }
722 
723  for (int i = is; i < is + ns; ++i) {
724  mult_yp2_thread(i, v2, vcp2_yp, ieo);
725  }
726 #pragma omp barrier
727  }
728 
729 
730 //====================================================================
732  const Field& f, const int ieo)
733  {
734  const double *v1 = f.ptr(0);
735  double *v2 = w.ptr(0);
736 
738  int i_thread = ThreadManager_OpenMP::get_thread_id();
739 
740  int is = m_Ntask * i_thread / Nthread;
741  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
742 
743  for (int i = is; i < is + ns; ++i) {
744  mult_ym1_thread(i, vcp1_ym, v1, ieo);
745  }
746 
747 #pragma omp barrier
748 #pragma omp master
749  {
750  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
751  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
752  }
753 #pragma omp barrier
754 
755  for (int i = is; i < is + ns; ++i) {
756  mult_ymb_thread(i, v2, v1, ieo);
757  }
758 
759  for (int i = is; i < is + ns; ++i) {
760  mult_ym2_thread(i, v2, vcp2_ym, ieo);
761  }
762 #pragma omp barrier
763  }
764 
765 
766 //====================================================================
768  const Field& f, const int ieo)
769  {
770  const double *v1 = f.ptr(0);
771  double *v2 = w.ptr(0);
772 
774  int i_thread = ThreadManager_OpenMP::get_thread_id();
775 
776  int is = m_Ntask * i_thread / Nthread;
777  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
778 
779  for (int i = is; i < is + ns; ++i) {
780  mult_zp1_thread(i, vcp1_zp, v1, ieo);
781  }
782 
783 #pragma omp barrier
784 #pragma omp master
785  {
786  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
787  Communicator::exchange(Nv, vcp2_zp, vcp1_zp, 2, 1, 5);
788  }
789 #pragma omp barrier
790 
791  for (int i = is; i < is + ns; ++i) {
792  mult_zpb_thread(i, v2, v1, ieo);
793  }
794 
795  for (int i = is; i < is + ns; ++i) {
796  mult_zp2_thread(i, v2, vcp2_zp, ieo);
797  }
798 #pragma omp barrier
799  }
800 
801 
802 //====================================================================
804  const Field& f, const int ieo)
805  {
806  const double *v1 = f.ptr(0);
807  double *v2 = w.ptr(0);
808 
810  int i_thread = ThreadManager_OpenMP::get_thread_id();
811 
812  int is = m_Ntask * i_thread / Nthread;
813  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
814 
815  for (int i = is; i < is + ns; ++i) {
816  mult_zm1_thread(i, vcp1_zm, v1, ieo);
817  }
818 
819 #pragma omp barrier
820 #pragma omp master
821  {
822  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
823  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
824  }
825 #pragma omp barrier
826 
827  for (int i = is; i < is + ns; ++i) {
828  mult_zmb_thread(i, v2, v1, ieo);
829  }
830 
831  for (int i = is; i < is + ns; ++i) {
832  mult_zm2_thread(i, v2, vcp2_zm, ieo);
833  }
834 #pragma omp barrier
835  }
836 
837 
838 //====================================================================
840  const Field& f, const int ieo)
841  {
842  const double *v1 = f.ptr(0);
843  double *v2 = w.ptr(0);
844 
846  int i_thread = ThreadManager_OpenMP::get_thread_id();
847 
848  int is = m_Ntask * i_thread / Nthread;
849  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
850 
851  for (int i = is; i < is + ns; ++i) {
852  mult_tp1_dirac_thread(i, vcp1_tp, v1, ieo);
853  }
854 
855 #pragma omp barrier
856 #pragma omp master
857  {
858  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
859  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
860  }
861 #pragma omp barrier
862 
863  for (int i = is; i < is + ns; ++i) {
864  mult_tpb_dirac_thread(i, v2, v1, ieo);
865  }
866 
867  for (int i = is; i < is + ns; ++i) {
868  mult_tp2_dirac_thread(i, v2, vcp2_tp, ieo);
869  }
870 #pragma omp barrier
871  }
872 
873 
874 //====================================================================
876  const Field& f, const int ieo)
877  {
878  const double *v1 = f.ptr(0);
879  double *v2 = w.ptr(0);
880 
882  int i_thread = ThreadManager_OpenMP::get_thread_id();
883 
884  int is = m_Ntask * i_thread / Nthread;
885  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
886 
887  for (int i = is; i < is + ns; ++i) {
888  mult_tm1_dirac_thread(i, vcp1_tm, v1, ieo);
889  }
890 
891 #pragma omp barrier
892 #pragma omp master
893  {
894  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
895  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
896  }
897 #pragma omp barrier
898 
899  for (int i = is; i < is + ns; ++i) {
900  mult_tmb_dirac_thread(i, v2, v1, ieo);
901  }
902 
903  for (int i = is; i < is + ns; ++i) {
904  mult_tm2_dirac_thread(i, v2, vcp2_tm, ieo);
905  }
906 #pragma omp barrier
907  }
908 
909 
910 //====================================================================
912  const Field& f, const int ieo)
913  {
914  const double *v1 = f.ptr(0);
915  double *v2 = w.ptr(0);
916 
918  int i_thread = ThreadManager_OpenMP::get_thread_id();
919 
920  int is = m_Ntask * i_thread / Nthread;
921  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
922 
923  for (int i = is; i < is + ns; ++i) {
924  mult_tp1_chiral_thread(i, vcp1_tp, v1, ieo);
925  }
926 
927 #pragma omp barrier
928 #pragma omp master
929  {
930  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
931  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
932  }
933 #pragma omp barrier
934 
935  for (int i = is; i < is + ns; ++i) {
936  mult_tpb_chiral_thread(i, v2, v1, ieo);
937  }
938 
939  for (int i = is; i < is + ns; ++i) {
940  mult_tp2_chiral_thread(i, v2, vcp2_tp, ieo);
941  }
942 #pragma omp barrier
943  }
944 
945 
946 //====================================================================
948  const Field& f, const int ieo)
949  {
950  const double *v1 = f.ptr(0);
951  double *v2 = w.ptr(0);
952 
954  int i_thread = ThreadManager_OpenMP::get_thread_id();
955 
956  int is = m_Ntask * i_thread / Nthread;
957  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
958 
959  for (int i = is; i < is + ns; ++i) {
960  mult_tm1_chiral_thread(i, vcp1_tm, v1, ieo);
961  }
962 
963 #pragma omp barrier
964 #pragma omp master
965  {
966  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
967  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
968  }
969 #pragma omp barrier
970 
971  for (int i = is; i < is + ns; ++i) {
972  mult_tmb_chiral_thread(i, v2, v1, ieo);
973  }
974 
975  for (int i = is; i < is + ns; ++i) {
976  mult_tm2_chiral_thread(i, v2, vcp2_tm, ieo);
977  }
978 #pragma omp barrier
979  }
980 
981 
982 //====================================================================
983 }
984 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
void mult_ymb_thread(int, double *, const double *, int)
void mult_xm(Field &, const Field &, const int ieo)
void postPropD(Field &, const Field &, const Field &)
void mult_tm_dirac(Field &, const Field &, const int ieo)
BridgeIO vout
Definition: bridgeIO.cpp:495
void(Fopr_Wilson_eo::* m_mult_tp)(Field &, const Field &, const int ieo)
void mult_tp2_chiral_thread(int, double *, const double *, int)
static int get_num_threads()
returns available number of threads.
void mult_ym(Field &, const Field &, const int ieo)
void mult_xp(Field &, const Field &, const int ieo)
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:142
void mult_yp(Field &, const Field &, const int ieo)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
void DDdag(Field &v, const Field &f)
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu) used in force calculation.
void(Fopr_Wilson_eo::* m_mult)(Field &, const Field &)
void mult_zm1_thread(int, double *, const double *, int)
void mult_tm1_chiral_thread(int, double *, const double *, int)
void gm5_dirac(Field &, const Field &)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
static Bridge::VerboseLevel Vlevel()
Container of Field-type object.
Definition: field.h:39
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
void mult_yp1_thread(int, double *, const double *, int)
void scal_thread(int, double *, double)
void DdagD(Field &v, const Field &f)
void Mdageo(Field &, const Field &, const int ieo)
void mult_xmb_thread(int, double *, const double *, int)
Class for parameters.
Definition: parameters.h:46
static int ipe(const int dir)
logical coordinate of current proc.
void mult_zm(Field &, const Field &, const int ieo)
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:381
void gm5_dirac_thread(int, double *, const double *)
void mult_xm1_thread(int, double *, const double *, int)
static int Lvol()
void set_config(Field *U)
setting pointer to the gauge configuration.
void(Fopr_Wilson_eo::* m_postProp)(Field &, const Field &, const Field &)
void MeoMoe(Field &, const Field &)
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
void mult_tpb_chiral_thread(int, double *, const double *, int)
void mult_yp2_thread(int, double *, const double *, int)
void mult_tp_dirac(Field &, const Field &, const int ieo)
static int get_thread_id()
returns thread id.
Wilson-type fermion field.
Definition: field_F.h:37
void Ddag(Field &v, const Field &f)
void Meo(Field &, const Field &, const int ieo)
void(Fopr_Wilson_eo::* m_gm5)(Field &, const Field &)
void(Fopr_Wilson_eo::* m_gm5_self)(Field &)
int nin() const
Definition: field.h:115
void mult_ypb_thread(int, double *, const double *, int)
void(Fopr_Wilson_eo::* m_mult_dag)(Field &, const Field &)
Field m_w2
working field.
void mult_xp1_thread(int, double *, const double *, int)
SU(N) gauge field.
Definition: field_G.h:38
void init(const std::string)
void mult_tm_chiral(Field &, const Field &, const int ieo)
void mult_tp1_dirac_thread(int, double *, const double *, int)
Bridge::VerboseLevel m_vl
Definition: fopr.h:128
double flop_count()
this returns the number of floating point operations of Meo.
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
void mult_zpb_thread(int, double *, const double *, int)
static void sync_barrier_all()
barrier among all the threads and nodes.
double * vcp1_xp
arrays for data transfer.
void gm5_chiral(Field &, const Field &)
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
Definition: field.cpp:461
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...
void mult_tmb_dirac_thread(int, double *, const double *, int)
void mult_zm2_thread(int, double *, const double *, int)
int nex() const
Definition: field.h:117
void mult_tm2_dirac_thread(int, double *, const double *, int)
Field_G * m_U
dummy: pointing m_Ueo.
void mult_tp_chiral(Field &, const Field &, const int ieo)
std::string m_repr
Dirac matrix representation.
void prePropDag(Field &, Field &, const Field &)
void mult_zmb_thread(int, double *, const double *, int)
void mult_tp2_dirac_thread(int, double *, const double *, int)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:168
void mult_tp1_chiral_thread(int, double *, const double *, int)
void(Fopr_Wilson_eo::* m_preProp)(Field &, Field &, const Field &)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void Meo_gm5(Field &, const Field &, const int ieo)
void mult_xpb_thread(int, double *, const double *, int)
void D(Field &v, const Field &f)
void mult_zp1_thread(int, double *, const double *, int)
void mult_tm2_chiral_thread(int, double *, const double *, int)
std::vector< int > m_boundary
boundary condition.
void mult_tmb_chiral_thread(int, double *, const double *, int)
void mult_xm2_thread(int, double *, const double *, int)
void mult_ym1_thread(int, double *, const double *, int)
std::string get_mode() const
only for Fopr_Overlap
void mult_zp2_thread(int, double *, const double *, int)
void reverseField(Field &lex, const Field &eo)
Definition: index_eo.cpp:110
void mult_gm5(Field &, const Field &)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
void prePropD(Field &, Field &, const Field &)
void mult_zp(Field &, const Field &, const int ieo)
void mult_tpb_dirac_thread(int, double *, const double *, int)
void scal_impl(Field &, double)
void H(Field &v, const Field &f)
double m_kappa
hopping parameter.
void(Fopr_Wilson_eo::* m_mult_tm)(Field &, const Field &, const int ieo)
void mult_ym2_thread(int, double *, const double *, int)
void mult_xp2_thread(int, double *, const double *, int)
std::string m_mode
mult mode.
string get_string(const string &key) const
Definition: parameters.cpp:116
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
void postPropDag(Field &, const Field &, const Field &)
void set_parameters(const Parameters &params)
static const std::string class_name
std::vector< int > m_Leo
void gm5_chiral_thread(int, double *, const double *)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_tm1_dirac_thread(int, double *, const double *, int)
std::vector< double > m_boundary2
b.c. for each node.