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