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  int buf_size[m_Ndim];
116  buf_size[0] = sizeof(double) * m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
117  buf_size[1] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
118  buf_size[2] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
119  buf_size[3] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
120 
121  m_fw_send.resize(m_Ndim);
122  m_fw_recv.resize(m_Ndim);
123  m_bw_send.resize(m_Ndim);
124  m_bw_recv.resize(m_Ndim);
125 
126  m_npe.resize(m_Ndim);
131 
132  vout.general(m_vl, "communication setup start.\n");
134 
135  for (int imu = 0; imu < m_Ndim; ++imu) {
136  // forward
137  m_fw_send[imu] = Communicator::send_init(buf_size[imu], imu, +1);
138  m_fw_recv[imu] = Communicator::recv_init(buf_size[imu], imu, -1);
139 
140  // backward
141  m_bw_send[imu] = Communicator::send_init(buf_size[imu], imu, -1);
142  m_bw_recv[imu] = Communicator::recv_init(buf_size[imu], imu, +1);
143 
144  vout.paranoiac(m_vl, "pointer to m_fw_send[%d] = %x.\n",
145  imu, m_fw_send[imu]->ptr());
146  vout.paranoiac(m_vl, "pointer to m_fw_recv[%d] = %x.\n",
147  imu, m_fw_recv[imu]->ptr());
148  vout.paranoiac(m_vl, "pointer to m_bw_send[%d] = %x.\n",
149  imu, m_bw_send[imu]->ptr());
150  vout.paranoiac(m_vl, "pointer to m_bw_recv[%d] = %x.\n",
151  imu, m_bw_recv[imu]->ptr());
152  }
153  vout.general(m_vl, "communication setup end.\n");
154 
155 
156  m_v1.reset(Nvcd, m_Nvol2, 1);
157  m_v2.reset(Nvcd, m_Nvol2, 1);
158  m_w1.reset(Nvcd, m_Nvol2, 1);
159  m_w2.reset(Nvcd, m_Nvol2, 1);
160 
161  setup_thread();
162 }
163 
164 
165 //====================================================================
167 {
168  delete m_Ueo;
169 
170  delete[] vcp1_xp;
171  delete[] vcp2_xp;
172  delete[] vcp1_xm;
173  delete[] vcp2_xm;
174 
175  delete[] vcp1_yp;
176  delete[] vcp2_yp;
177  delete[] vcp1_ym;
178  delete[] vcp2_ym;
179 
180  delete[] vcp1_zp;
181  delete[] vcp2_zp;
182  delete[] vcp1_zm;
183  delete[] vcp2_zm;
184 
185  delete[] vcp1_tp;
186  delete[] vcp2_tp;
187  delete[] vcp1_tm;
188  delete[] vcp2_tm;
189 }
190 
191 
192 //====================================================================
194  const double kappa,
195  const std::vector<int> bc)
196 {
197  //- print input parameters
198  vout.general(m_vl, "Parameters of Fopr_Wilson_eo(impl):\n");
199  vout.general(m_vl, " kappa = %8.4f\n", kappa);
200  for (int mu = 0; mu < m_Ndim; ++mu) {
201  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
202  }
203 
204  //- range check
205  // NB. kappa = 0 is allowed.
206  assert(bc.size() == m_Ndim);
207 
208  //- store values
209  m_kappa = kappa;
210 
211  // m_boundary.resize(m_Ndim); // already resized in init.
212  for (int mu = 0; mu < m_Ndim; ++mu) {
213  m_boundary[mu] = bc[mu];
214  }
215 
216  // boundary condition for each node:
217  for (int idir = 0; idir < m_Ndim; ++idir) {
218  m_boundary2[idir] = 1.0;
219  if (Communicator::ipe(idir) == 0) m_boundary2[idir] = m_boundary[idir];
220  }
221 }
222 
223 
224 //====================================================================
226 {
227  int Ndim = CommonParameters::Ndim();
228  int Nvol = CommonParameters::Nvol();
229 
230  m_index.convertField(*m_Ueo, *U);
231 
232  m_U = m_Ueo;
233 }
234 
235 
236 //====================================================================
238 {
239  // The following counting explicitly depends on the implementation
240  // and to be recalculated when the code is modified.
241  // Present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
242 
243  int Lvol = CommonParameters::Lvol();
244  double flop_site, flop;
245 
246  if (m_repr == "Dirac") {
247  flop_site = static_cast<double>(
248  m_Nc * m_Nd * (6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
249  } else if (m_repr == "Chiral") {
250  flop_site = static_cast<double>(
251  m_Nc * m_Nd * 8 * (4 * m_Nc + 2));
252  } else {
253  vout.crucial(m_vl, "%s: input repr is undefined.\n",
254  class_name.c_str());
255  exit(EXIT_FAILURE);
256  }
257 
258  flop = flop_site * static_cast<double>(Lvol / 2);
259 
260  return flop;
261 }
262 
263 
264 //====================================================================
266  const Field& b)
267 {
268  int Nin = b.nin();
269  int Nex = b.nex();
270 
271  Field be(Nin, m_Nvol2, Nex);
272 
273  m_index.convertField(be, b, 0);
274  m_index.convertField(bo, b, 1);
275 
276  Be.reset(Nin, m_Nvol2, Nex);
277 
278  // Be = be - (Field)Meo(bo, 0);
279  Field_F v1(m_Nvol2, Nex);
280  copy(Be, be);
281  Meo(v1, bo, 0);
282  axpy(Be, -1.0, v1);
283 }
284 
285 
286 //====================================================================
288  const Field& xe, const Field& bo)
289 {
290  int Nin = xe.nin();
291  int Nex = xe.nex();
292 
293  Field xo(Nin, m_Nvol2, Nex);
294 
295  // xo = bo - (Field)Meo(xe, 1);
296  Field_F v1(m_Nvol2, Nex);
297 
298  copy(xo, bo);
299  Meo(v1, xe, 1);
300  axpy(xo, -1.0, v1);
301 
302  x.reset(Nin, m_Nvol2 * 2, Nex);
303  m_index.reverseField(x, xe, 0);
304  m_index.reverseField(x, xo, 1);
305 }
306 
307 
308 //====================================================================
310  Field& bo, const Field& b)
311 {
312  int Nin = b.nin();
313  int Nex = b.nex();
314 
315  Field be(Nin, m_Nvol2, Nex);
316 
317  m_index.convertField(be, b, 0);
318  m_index.convertField(bo, b, 1);
319 
320  Be.reset(Nin, m_Nvol2, Nex);
321 
322  // Be = be - (Field)Mdageo(bo, 0);
323  Field_F v1(m_Nvol2, Nex);
324  copy(Be, be);
325  Mdageo(v1, bo, 0);
326  axpy(Be, -1.0, v1);
327 }
328 
329 
330 //====================================================================
332  const Field& xe, const Field& bo)
333 {
334  int Nin = xe.nin();
335  int Nex = xe.nex();
336 
337  Field xo(Nin, m_Nvol2, Nex);
338 
339  // xo = bo - (Field)Mdageo(xe, 1);
340  Field_F v1(m_Nvol2, Nex);
341 
342  copy(xo, bo);
343  Mdageo(v1, xe, 1);
344  axpy(xo, -1.0, v1);
345 
346  x.reset(Nin, m_Nvol2 * 2, Nex);
347  m_index.reverseField(x, xe, 0);
348  m_index.reverseField(x, xo, 1);
349 }
350 
351 
352 //====================================================================
354 {
355  assert(f.nex() == 1);
356 
357  Meo(m_v1, f, 1);
358  Meo(v, m_v1, 0);
359  aypx(-1.0, v, f);
360 #pragma omp barrier
361 }
362 
363 
364 //====================================================================
366 {
367  Mdageo(m_v1, f, 1);
368  Mdageo(v, m_v1, 0);
369  aypx(-1.0, v, f);
370 #pragma omp barrier
371 }
372 
373 
374 //====================================================================
376 {
377  D(m_w1, f);
378  Ddag(v, m_w1);
379 }
380 
381 
382 //====================================================================
384 {
385  Ddag(m_w1, f);
386  D(v, m_w1);
387 }
388 
389 
390 //====================================================================
392 {
393  D(v, f);
394  mult_gm5(v);
395 #pragma omp barrier
396 }
397 
398 
399 //====================================================================
401 {
402  Meo(m_w1, f, 1);
403  Meo(m_w2, m_w1, 0);
404  axpy(v, -1.0, m_w2);
405 #pragma omp barrier
406 }
407 
408 
409 //====================================================================
411  const Field& f, const int ieo)
412 {
413 #pragma omp barrier
414 
415  // clear_impl(w); // w = 0.0;
416  w.set(0.0); // w = 0.0;
417 
418  // for (int mu = 0; mu < m_Ndim; ++mu) {
419  // mult_p(mu, w, f, ieo);
420  // mult_m(mu, w, f, ieo);
421  // }
422 
423  mult_xp(w, f, ieo);
424  mult_xm(w, f, ieo);
425 
426  mult_yp(w, f, ieo);
427  mult_ym(w, f, ieo);
428 
429  mult_zp(w, f, ieo);
430  mult_zm(w, f, ieo);
431 
432  (this->*m_mult_tp)(w, f, ieo);
433  (this->*m_mult_tm)(w, f, ieo);
434 
435  scal(w, -m_kappa); // w *= -m_kappa; using Field function.
436  // scal_impl(w, -m_kappa); // w *= -m_kappa;
437 
439 }
440 
441 
442 //====================================================================
444  const Field& f, const int ieo)
445 {
446  // Field_F v(m_Nvol2, f.nex());
447  // mult_gm5(v, (Field)f);
448  // Meo_gm5(w, v, ieo);
449 
450  mult_gm5(m_v2, f);
451  Meo(w, m_v2, ieo);
452  mult_gm5(w);
453 }
454 
455 
456 //====================================================================
458  const Field& f, const int ieo)
459 {
460  Meo(v, f, ieo);
461  mult_gm5(v);
462 }
463 
464 
465 //====================================================================
467 {
468  (this->*m_gm5)(w, f);
469 }
470 
471 
472 //====================================================================
474 {
475  (this->*m_gm5_self)(w);
476 }
477 
478 
479 //====================================================================
481  const Field& f)
482 {
483  const double *v1 = f.ptr(0);
484  double *v2 = w.ptr(0);
485 
488 
489  int is = m_Ntask * ith / nth;
490  int ns = m_Ntask * (ith + 1) / nth - is;
491 
492  for (int i = is; i < is + ns; ++i) {
493  gm5_dirac_thread(i, v2, v1);
494  }
495 }
496 
497 
498 //====================================================================
500  const Field& f)
501 {
502  const double *v1 = f.ptr(0);
503  double *v2 = w.ptr(0);
504 
507 
508  int is = m_Ntask * ith / nth;
509  int ns = m_Ntask * (ith + 1) / nth - is;
510 
511  for (int i = is; i < is + ns; ++i) {
512  gm5_chiral_thread(i, v2, v1);
513  }
514 }
515 
516 
517 //====================================================================
519 {
520  double *wp = w.ptr(0);
521 
524 
525  int is = m_Ntask * ith / nth;
526  int ns = m_Ntask * (ith + 1) / nth - is;
527 
528  for (int i = is; i < is + ns; ++i) {
529  gm5_dirac_thread(i, wp);
530  }
531 }
532 
533 
534 //====================================================================
536 {
537  double *wp = w.ptr(0);
538 
541 
542  int is = m_Ntask * ith / nth;
543  int ns = m_Ntask * (ith + 1) / nth - is;
544 
545  for (int i = is; i < is + ns; ++i) {
546  gm5_chiral_thread(i, wp);
547  }
548 }
549 
550 
551 //====================================================================
553  const Field& f)
554 {
555  // this function is probably not to be used.
556  // determines \gamma_5 * (1 - \gamma_\mu) v(x+\hat{x})
557  exit(EXIT_FAILURE);
558 }
559 
560 
561 //====================================================================
563  Field_F& w, const Field_F& f,
564  const int ieo)
565 {
566  if (mu == 0) {
567  mult_xp(w, f, ieo);
568  } else if (mu == 1) {
569  mult_yp(w, f, ieo);
570  } else if (mu == 2) {
571  mult_zp(w, f, ieo);
572  } else if (mu == 3) {
573  mult_tp_dirac(w, f, ieo);
574  } else {
575  vout.crucial(m_vl, "%s: illegal value of mu: %d",
576  class_name.c_str(), mu);
577  exit(EXIT_FAILURE);
578  }
579 }
580 
581 
582 //=====================================================================
584  Field_F& w, const Field_F& f,
585  const int ieo)
586 {
587  if (mu == 0) {
588  mult_xm(w, f, ieo);
589  } else if (mu == 1) {
590  mult_ym(w, f, ieo);
591  } else if (mu == 2) {
592  mult_zm(w, f, ieo);
593  } else if (mu == 3) {
594  mult_tm_dirac(w, f, ieo);
595  } else {
596  vout.crucial(m_vl, "%s: illegal value of mu: %d",
597  class_name.c_str(), mu);
598  exit(EXIT_FAILURE);
599  }
600 }
601 
602 
603 //====================================================================
605 {
606  double *wp = w.ptr(0);
607 
610 
611  int is = m_Ntask * ith / nth;
612  int ns = m_Ntask * (ith + 1) / nth - is;
613 
614  for (int i = is; i < is + ns; ++i) {
615  clear_thread(i, wp);
616  }
617 }
618 
619 
620 //====================================================================
622 {
623  double *wp = w.ptr(0);
624 
627 
628  int is = m_Ntask * ith / nth;
629  int ns = m_Ntask * (ith + 1) / nth - is;
630 
631  for (int i = is; i < is + ns; ++i) {
632  scal_thread(i, wp, a);
633  }
634 }
635 
636 
637 //====================================================================
639  const Field& f, const int ieo)
640 {
641  const double *v1 = f.ptr(0);
642  double *v2 = w.ptr(0);
643 
646 
647  int is = m_Ntask * ith / nth;
648  int ns = m_Ntask * (ith + 1) / nth - is;
649 
650  for (int i = is; i < is + ns; ++i) {
651  mult_xp1_thread(i, vcp1_xp, v1, ieo);
652  }
653 #pragma omp barrier
654 
655  /*
656 #pragma omp master
657  {
658  int Nv = m_Nvc * 2 * (m_Ny/2) * m_Nz * m_Nt;
659  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
660  }
661 
662 #pragma omp barrier
663  */
664  for (int i = is; i < is + ns; ++i) {
665  mult_xpb_thread(i, v2, v1, ieo);
666  }
667 
668  for (int i = is; i < is + ns; ++i) {
669  mult_xp2_thread(i, v2, vcp2_xp, ieo);
670  }
671 }
672 
673 
674 //====================================================================
676  const Field& f, const int ieo)
677 {
678  const double *v1 = f.ptr(0);
679  double *v2 = w.ptr(0);
680 
683 
684  int is = m_Ntask * ith / nth;
685  int ns = m_Ntask * (ith + 1) / nth - is;
686 
687  for (int i = is; i < is + ns; ++i) {
688  mult_xm1_thread(i, vcp1_xm, v1, ieo);
689  }
690 
691 #pragma omp barrier
692 
693  /*
694 #pragma omp master
695  {
696  int Nv = m_Nvc * 2 * (m_Ny/2) * m_Nz * m_Nt;
697  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
698  }
699 
700 #pragma omp barrier
701  */
702  for (int i = is; i < is + ns; ++i) {
703  mult_xmb_thread(i, v2, v1, ieo);
704  }
705 
706  for (int i = is; i < is + ns; ++i) {
707  mult_xm2_thread(i, v2, vcp2_xm, ieo);
708  }
709 }
710 
711 
712 //====================================================================
714  const Field& f, const int ieo)
715 {
716  const double *v1 = f.ptr(0);
717  double *v2 = w.ptr(0);
718 
721 
722  int is = m_Ntask * ith / nth;
723  int ns = m_Ntask * (ith + 1) / nth - is;
724 
725  for (int i = is; i < is + ns; ++i) {
726  mult_yp1_thread(i, vcp1_yp, v1, ieo);
727  }
728 
729 #pragma omp barrier
730 
731  /*
732 #pragma omp master
733  {
734  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
735  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
736  }
737 
738 #pragma omp barrier
739  */
740  for (int i = is; i < is + ns; ++i) {
741  mult_ypb_thread(i, v2, v1, ieo);
742  }
743 
744  for (int i = is; i < is + ns; ++i) {
745  mult_yp2_thread(i, v2, vcp2_yp, ieo);
746  }
747 }
748 
749 
750 //====================================================================
752  const Field& f, const int ieo)
753 {
754  const double *v1 = f.ptr(0);
755  double *v2 = w.ptr(0);
756 
759 
760  int is = m_Ntask * ith / nth;
761  int ns = m_Ntask * (ith + 1) / nth - is;
762 
763  for (int i = is; i < is + ns; ++i) {
764  mult_ym1_thread(i, vcp1_ym, v1, ieo);
765  }
766 
767 #pragma omp barrier
768 
769  /*
770 #pragma omp master
771  {
772  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
773  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
774  }
775 #pragma omp barrier
776  */
777 
778  for (int i = is; i < is + ns; ++i) {
779  mult_ymb_thread(i, v2, v1, ieo);
780  }
781 
782  for (int i = is; i < is + ns; ++i) {
783  mult_ym2_thread(i, v2, vcp2_ym, ieo);
784  }
785 }
786 
787 
788 //====================================================================
790  const Field& f, const int ieo)
791 {
792  const double *v1 = f.ptr(0);
793  double *v2 = w.ptr(0);
794 
797 
798  int is = m_Ntask * ith / nth;
799  int ns = m_Ntask * (ith + 1) / nth - is;
800 
801  for (int i = is; i < is + ns; ++i) {
802  mult_zp1_thread(i, vcp1_zp, v1, ieo);
803  }
804 
805 #pragma omp barrier
806 
807  /*
808 #pragma omp master
809  {
810  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
811  Communicator::exchange(Nv, vcp2_zp, vcp1_zp, 2, 1, 5);
812  }
813 
814 #pragma omp barrier
815  */
816  for (int i = is; i < is + ns; ++i) {
817  mult_zpb_thread(i, v2, v1, ieo);
818  }
819 
820  for (int i = is; i < is + ns; ++i) {
821  mult_zp2_thread(i, v2, vcp2_zp, ieo);
822  }
823 }
824 
825 
826 //====================================================================
828  const Field& f, const int ieo)
829 {
830  const double *v1 = f.ptr(0);
831  double *v2 = w.ptr(0);
832 
835 
836  int is = m_Ntask * ith / nth;
837  int ns = m_Ntask * (ith + 1) / nth - is;
838 
839  for (int i = is; i < is + ns; ++i) {
840  mult_zm1_thread(i, vcp1_zm, v1, ieo);
841  }
842 
843 #pragma omp barrier
844 
845  /*
846 #pragma omp master
847  {
848  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
849  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
850  }
851 
852 #pragma omp barrier
853  */
854  for (int i = is; i < is + ns; ++i) {
855  mult_zmb_thread(i, v2, v1, ieo);
856  }
857 
858  for (int i = is; i < is + ns; ++i) {
859  mult_zm2_thread(i, v2, vcp2_zm, ieo);
860  }
861 }
862 
863 
864 //====================================================================
866  const Field& f, const int ieo)
867 {
868  const double *v1 = f.ptr(0);
869  double *v2 = w.ptr(0);
870 
873 
874  int is = m_Ntask * ith / nth;
875  int ns = m_Ntask * (ith + 1) / nth - is;
876 
877  for (int i = is; i < is + ns; ++i) {
878  mult_tp1_dirac_thread(i, vcp1_tp, v1, ieo);
879  }
880 
881 #pragma omp barrier
882 
883 #pragma omp master
884  {
885  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
886  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
887  }
888 
889 #pragma omp barrier
890 
891  for (int i = is; i < is + ns; ++i) {
892  mult_tpb_dirac_thread(i, v2, v1, ieo);
893  }
894 
895  for (int i = is; i < is + ns; ++i) {
896  mult_tp2_dirac_thread(i, v2, vcp2_tp, ieo);
897  }
898 }
899 
900 
901 //====================================================================
903  const Field& f, const int ieo)
904 {
905  const double *v1 = f.ptr(0);
906  double *v2 = w.ptr(0);
907 
910 
911  int is = m_Ntask * ith / nth;
912  int ns = m_Ntask * (ith + 1) / nth - is;
913 
914  for (int i = is; i < is + ns; ++i) {
915  mult_tm1_dirac_thread(i, vcp1_tm, v1, ieo);
916  }
917 
918 #pragma omp barrier
919 
920 #pragma omp master
921  {
922  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
923  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
924  }
925 
926 #pragma omp barrier
927 
928  for (int i = is; i < is + ns; ++i) {
929  mult_tmb_dirac_thread(i, v2, v1, ieo);
930  }
931 
932  for (int i = is; i < is + ns; ++i) {
933  mult_tm2_dirac_thread(i, v2, vcp2_tm, ieo);
934  }
935 }
936 
937 
938 //====================================================================
940  const Field& f, const int ieo)
941 {
942  const double *v1 = f.ptr(0);
943  double *v2 = w.ptr(0);
944 
947 
948  int is = m_Ntask * ith / nth;
949  int ns = m_Ntask * (ith + 1) / nth - is;
950 
951  for (int i = is; i < is + ns; ++i) {
952  mult_tp1_chiral_thread(i, vcp1_tp, v1, ieo);
953  }
954 
955 #pragma omp barrier
956 
957  /*
958 #pragma omp master
959  {
960  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
961  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
962  }
963 
964 #pragma omp barrier
965  */
966  for (int i = is; i < is + ns; ++i) {
967  mult_tpb_chiral_thread(i, v2, v1, ieo);
968  }
969 
970  for (int i = is; i < is + ns; ++i) {
971  mult_tp2_chiral_thread(i, v2, vcp2_tp, ieo);
972  }
973 }
974 
975 
976 //====================================================================
978  const Field& f, const int ieo)
979 {
980  const double *v1 = f.ptr(0);
981  double *v2 = w.ptr(0);
982 
985 
986  int is = m_Ntask * ith / nth;
987  int ns = m_Ntask * (ith + 1) / nth - is;
988 
989  for (int i = is; i < is + ns; ++i) {
990  mult_tm1_chiral_thread(i, vcp1_tm, v1, ieo);
991  }
992 
993 #pragma omp barrier
994 
995  /*
996 #pragma omp master
997  {
998  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
999  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
1000  }
1001 
1002 #pragma omp barrier
1003  */
1004  for (int i = is; i < is + ns; ++i) {
1005  mult_tmb_chiral_thread(i, v2, v1, ieo);
1006  }
1007 
1008  for (int i = is; i < is + ns; ++i) {
1009  mult_tm2_chiral_thread(i, v2, vcp2_tm, ieo);
1010  }
1011 }
1012 
1013 
1014 //====================================================================
1015 //============================================================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.
static int NPEy()
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
static int NPEt()
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)
static Channel * recv_init(int count, int idir, int ipm)
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 paranoiac(const char *format,...)
Definition: bridgeIO.cpp:99
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
static int NPEx()
void crucial(const char *format,...)
Definition: bridgeIO.cpp:48
void H(Field &v, const Field &f)
void D(Field &v, const Field &f)
static int NPEz()
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.
static Channel * send_init(int count, int idir, int ipm)
void Ddag(Field &v, const Field &f)
void mult_yp(Field &, const Field &, const int ieo)
static int sync()
synchronize within small world.
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.