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