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_BGQ {
19 //====================================================================
20  const std::string Fopr_Wilson_eo::class_name = "Imp_BGQ::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 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, "Error at %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, "Error at %s: input repr is undefined\n", class_name.c_str());
87  exit(EXIT_FAILURE);
88  }
89 
90  int Nvx = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
91  vcp1_xp = new double[Nvx];
92  vcp2_xp = new double[Nvx];
93  vcp1_xm = new double[Nvx];
94  vcp2_xm = new double[Nvx];
95 
96  int Nvy = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
97  vcp1_yp = new double[Nvy];
98  vcp2_yp = new double[Nvy];
99  vcp1_ym = new double[Nvy];
100  vcp2_ym = new double[Nvy];
101 
102  int Nvz = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
103  vcp1_zp = new double[Nvz];
104  vcp2_zp = new double[Nvz];
105  vcp1_zm = new double[Nvz];
106  vcp2_zm = new double[Nvz];
107 
108  int Nvt = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
109  vcp1_tp = new double[Nvt];
110  vcp2_tp = new double[Nvt];
111  vcp1_tm = new double[Nvt];
112  vcp2_tm = new double[Nvt];
113 
114  int buf_size[m_Ndim];
115  buf_size[0] = sizeof(double) * m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
116  buf_size[1] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
117  buf_size[2] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
118  buf_size[3] = sizeof(double) * m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
119 
120  m_fw_send.resize(m_Ndim);
121  m_fw_recv.resize(m_Ndim);
122  m_bw_send.resize(m_Ndim);
123  m_bw_recv.resize(m_Ndim);
124 
125  m_npe.resize(m_Ndim);
130 
131  vout.detailed(m_vl, "communication setup start.\n");
133 
134  for (int imu = 0; imu < m_Ndim; ++imu) {
135  // forward
136  m_fw_send[imu] = Communicator::send_init(buf_size[imu], imu, +1);
137  m_fw_recv[imu] = Communicator::recv_init(buf_size[imu], imu, -1);
138 
139  // backward
140  m_bw_send[imu] = Communicator::send_init(buf_size[imu], imu, -1);
141  m_bw_recv[imu] = Communicator::recv_init(buf_size[imu], imu, +1);
142 
143  vout.paranoiac(m_vl, "pointer to m_fw_send[%d] = %x.\n",
144  imu, m_fw_send[imu]->ptr());
145  vout.paranoiac(m_vl, "pointer to m_fw_recv[%d] = %x.\n",
146  imu, m_fw_recv[imu]->ptr());
147  vout.paranoiac(m_vl, "pointer to m_bw_send[%d] = %x.\n",
148  imu, m_bw_send[imu]->ptr());
149  vout.paranoiac(m_vl, "pointer to m_bw_recv[%d] = %x.\n",
150  imu, m_bw_recv[imu]->ptr());
151  }
152  vout.detailed(m_vl, "communication setup end.\n");
153 
154 
155  m_v1.reset(Nvcd, m_Nvol2, 1);
156  m_v2.reset(Nvcd, m_Nvol2, 1);
157  m_w1.reset(Nvcd, m_Nvol2, 1);
158  m_w2.reset(Nvcd, m_Nvol2, 1);
159 
160  setup_thread();
161  }
162 
163 
164 //====================================================================
166  {
167  delete m_Ueo;
168 
169  delete[] vcp1_xp;
170  delete[] vcp2_xp;
171  delete[] vcp1_xm;
172  delete[] vcp2_xm;
173 
174  delete[] vcp1_yp;
175  delete[] vcp2_yp;
176  delete[] vcp1_ym;
177  delete[] vcp2_ym;
178 
179  delete[] vcp1_zp;
180  delete[] vcp2_zp;
181  delete[] vcp1_zm;
182  delete[] vcp2_zm;
183 
184  delete[] vcp1_tp;
185  delete[] vcp2_tp;
186  delete[] vcp1_tm;
187  delete[] vcp2_tm;
188  }
189 
190 
191 //====================================================================
193  {
194  const string str_vlevel = params.get_string("verbose_level");
195 
196  m_vl = vout.set_verbose_level(str_vlevel);
197 
198  //- fetch and check input parameters
199  double kappa;
200  std::vector<int> bc;
201 
202  int err = 0;
203  err += params.fetch_double("hopping_parameter", kappa);
204  err += params.fetch_int_vector("boundary_condition", bc);
205 
206  if (err) {
207  vout.crucial(m_vl, "Error at %s: fetch error, input parameter not found.\n", class_name.c_str());
208  exit(EXIT_FAILURE);
209  }
210 
211  set_parameters(kappa, bc);
212  }
213 
214 
215 //====================================================================
217  const double kappa,
218  const std::vector<int> bc)
219  {
220  //- print input parameters
221  vout.general(m_vl, "%s:\n", class_name.c_str());
222  vout.general(m_vl, " kappa = %12.8f\n", kappa);
223  for (int mu = 0; mu < m_Ndim; ++mu) {
224  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
225  }
226 
227  //- range check
228  // NB. kappa = 0 is allowed.
229  assert(bc.size() == m_Ndim);
230 
231  //- store values
232  m_kappa = kappa;
233 
234  // m_boundary.resize(m_Ndim); // already resized in init.
235  for (int mu = 0; mu < m_Ndim; ++mu) {
236  m_boundary[mu] = bc[mu];
237  }
238 
239  // boundary condition for each node:
240  for (int idir = 0; idir < m_Ndim; ++idir) {
241  m_boundary2[idir] = 1.0;
242  if (Communicator::ipe(idir) == 0) m_boundary2[idir] = m_boundary[idir];
243  }
244  }
245 
246 
247 //====================================================================
249  {
250  int Ndim = CommonParameters::Ndim();
251  int Nvol = CommonParameters::Nvol();
252 
253  m_index.convertField(*m_Ueo, *U);
254 
255  m_U = m_Ueo;
256  }
257 
258 
259 //====================================================================
261  {
262  // The following counting explicitly depends on the implementation
263  // and to be recalculated when the code is modified.
264  // Present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
265 
266  int Lvol = CommonParameters::Lvol();
267  double flop_site, flop;
268 
269  if (m_repr == "Dirac") {
270  flop_site = static_cast<double>(
271  m_Nc * m_Nd * (6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
272  } else if (m_repr == "Chiral") {
273  flop_site = static_cast<double>(
274  m_Nc * m_Nd * 8 * (4 * m_Nc + 2));
275  } else {
276  vout.crucial(m_vl, "Error at %s: input repr is undefined\n", class_name.c_str());
277  exit(EXIT_FAILURE);
278  }
279 
280  flop = flop_site * static_cast<double>(Lvol / 2);
281 
282  return flop;
283  }
284 
285 
286 //====================================================================
288  const Field& b)
289  {
290  int Nin = b.nin();
291  int Nex = b.nex();
292 
293  Field be(Nin, m_Nvol2, Nex);
294 
295  m_index.convertField(be, b, 0);
296  m_index.convertField(bo, b, 1);
297 
298  Be.reset(Nin, m_Nvol2, Nex);
299 
300  // Be = be - (Field)Meo(bo, 0);
301  Field_F v1(m_Nvol2, Nex);
302  copy(Be, be);
303  Meo(v1, bo, 0);
304  axpy(Be, -1.0, v1);
305  }
306 
307 
308 //====================================================================
310  const Field& xe, const Field& bo)
311  {
312  int Nin = xe.nin();
313  int Nex = xe.nex();
314 
315  Field xo(Nin, m_Nvol2, Nex);
316 
317  // xo = bo - (Field)Meo(xe, 1);
318  Field_F v1(m_Nvol2, Nex);
319 
320  copy(xo, bo);
321  Meo(v1, xe, 1);
322  axpy(xo, -1.0, v1);
323 
324  x.reset(Nin, m_Nvol2 * 2, Nex);
325  m_index.reverseField(x, xe, 0);
326  m_index.reverseField(x, xo, 1);
327  }
328 
329 
330 //====================================================================
332  Field& bo, const Field& b)
333  {
334  int Nin = b.nin();
335  int Nex = b.nex();
336 
337  Field be(Nin, m_Nvol2, Nex);
338 
339  m_index.convertField(be, b, 0);
340  m_index.convertField(bo, b, 1);
341 
342  Be.reset(Nin, m_Nvol2, Nex);
343 
344  // Be = be - (Field)Mdageo(bo, 0);
345  Field_F v1(m_Nvol2, Nex);
346  copy(Be, be);
347  Mdageo(v1, bo, 0);
348  axpy(Be, -1.0, v1);
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  // xo = bo - (Field)Mdageo(xe, 1);
362  Field_F v1(m_Nvol2, Nex);
363 
364  copy(xo, bo);
365  Mdageo(v1, xe, 1);
366  axpy(xo, -1.0, v1);
367 
368  x.reset(Nin, m_Nvol2 * 2, Nex);
369  m_index.reverseField(x, xe, 0);
370  m_index.reverseField(x, xo, 1);
371  }
372 
373 
374 //====================================================================
375  void Fopr_Wilson_eo::D(Field& v, const Field& f)
376  {
377  assert(f.nex() == 1);
378 
379  Meo(m_v1, f, 1);
380  Meo(v, m_v1, 0);
381  aypx(-1.0, v, f);
382 #pragma omp barrier
383  }
384 
385 
386 //====================================================================
387  void Fopr_Wilson_eo::Ddag(Field& v, const Field& f)
388  {
389  Mdageo(m_v1, f, 1);
390  Mdageo(v, m_v1, 0);
391  aypx(-1.0, v, f);
392 #pragma omp barrier
393  }
394 
395 
396 //====================================================================
397  void Fopr_Wilson_eo::DdagD(Field& v, const Field& f)
398  {
399  D(m_w1, f);
400  Ddag(v, m_w1);
401  }
402 
403 
404 //====================================================================
405  void Fopr_Wilson_eo::DDdag(Field& v, const Field& f)
406  {
407  Ddag(m_w1, f);
408  D(v, m_w1);
409  }
410 
411 
412 //====================================================================
413  void Fopr_Wilson_eo::H(Field& v, const Field& f)
414  {
415  D(v, f);
416  mult_gm5(v);
417 #pragma omp barrier
418  }
419 
420 
421 //====================================================================
422  void Fopr_Wilson_eo::MeoMoe(Field& v, const Field& f)
423  {
424  Meo(m_w1, f, 1);
425  Meo(m_w2, m_w1, 0);
426  axpy(v, -1.0, m_w2);
427 #pragma omp barrier
428  }
429 
430 
431 //====================================================================
433  const Field& f, const int ieo)
434  {
435 #pragma omp barrier
436 
437  // clear_impl(w); // w = 0.0;
438  w.set(0.0); // w = 0.0;
439 
440  mult_xp(w, f, ieo);
441  mult_xm(w, f, ieo);
442 
443  mult_yp(w, f, ieo);
444  mult_ym(w, f, ieo);
445 
446  mult_zp(w, f, ieo);
447  mult_zm(w, f, ieo);
448 
449  (this->*m_mult_tp)(w, f, ieo);
450  (this->*m_mult_tm)(w, f, ieo);
451 
452  scal(w, -m_kappa); // w *= -m_kappa; using Field function.
453  // scal_impl(w, -m_kappa); // w *= -m_kappa;
454 
456  }
457 
458 
459 //====================================================================
461  const Field& f, const int ieo)
462  {
463  // Field_F v(m_Nvol2, f.nex());
464  // mult_gm5(v, (Field)f);
465  // Meo_gm5(w, v, ieo);
466 
467  mult_gm5(m_v2, f);
468  Meo(w, m_v2, ieo);
469  mult_gm5(w);
470  }
471 
472 
473 //====================================================================
475  const Field& f, const int ieo)
476  {
477  Meo(v, f, ieo);
478  mult_gm5(v);
479  }
480 
481 
482 //====================================================================
484  {
485  (this->*m_gm5)(w, f);
486  }
487 
488 
489 //====================================================================
491  {
492  (this->*m_gm5_self)(w);
493  }
494 
495 
496 //====================================================================
498  const Field& f)
499  {
500  const double *v1 = f.ptr(0);
501  double *v2 = w.ptr(0);
502 
505 
506  int is = m_Ntask * ith / nth;
507  int ns = m_Ntask * (ith + 1) / nth - is;
508 
509  for (int i = is; i < is + ns; ++i) {
510  gm5_dirac_thread(i, v2, v1);
511  }
512  }
513 
514 
515 //====================================================================
517  const Field& f)
518  {
519  const double *v1 = f.ptr(0);
520  double *v2 = 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_chiral_thread(i, v2, v1);
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_dirac_thread(i, wp);
547  }
548  }
549 
550 
551 //====================================================================
553  {
554  double *wp = w.ptr(0);
555 
558 
559  int is = m_Ntask * ith / nth;
560  int ns = m_Ntask * (ith + 1) / nth - is;
561 
562  for (int i = is; i < is + ns; ++i) {
563  gm5_chiral_thread(i, wp);
564  }
565  }
566 
567 
568 //====================================================================
569  void Fopr_Wilson_eo::gm5p(const int mu, Field& w,
570  const Field& f)
571  {
572  // this function is probably not to be used.
573  // determines \gamma_5 * (1 - \gamma_\mu) v(x+\hat{x})
574  vout.crucial(m_vl, "Error at %s: gm5p is undefined\n", class_name.c_str());
575  exit(EXIT_FAILURE);
576  }
577 
578 
579 //====================================================================
581  {
582  double *wp = w.ptr(0);
583 
586 
587  int is = m_Ntask * ith / nth;
588  int ns = m_Ntask * (ith + 1) / nth - is;
589 
590  for (int i = is; i < is + ns; ++i) {
591  clear_thread(i, wp);
592  }
593  }
594 
595 
596 //====================================================================
597  void Fopr_Wilson_eo::scal_impl(Field& w, double a)
598  {
599  double *wp = w.ptr(0);
600 
603 
604  int is = m_Ntask * ith / nth;
605  int ns = m_Ntask * (ith + 1) / nth - is;
606 
607  for (int i = is; i < is + ns; ++i) {
608  scal_thread(i, wp, a);
609  }
610  }
611 
612 
613 //====================================================================
615  const Field& f, const int ieo)
616  {
617  const double *v1 = f.ptr(0);
618  double *v2 = w.ptr(0);
619 
622 
623  int is = m_Ntask * ith / nth;
624  int ns = m_Ntask * (ith + 1) / nth - is;
625 
626  for (int i = is; i < is + ns; ++i) {
627  mult_xp1_thread(i, vcp1_xp, v1, ieo);
628  }
629 #pragma omp barrier
630 
631  /*
632  #pragma omp master
633  {
634  int Nv = m_Nvc * 2 * (m_Ny/2) * m_Nz * m_Nt;
635  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
636  }
637 
638  #pragma omp barrier
639  */
640  for (int i = is; i < is + ns; ++i) {
641  mult_xpb_thread(i, v2, v1, ieo);
642  }
643 
644  for (int i = is; i < is + ns; ++i) {
645  mult_xp2_thread(i, v2, vcp2_xp, ieo);
646  }
647  }
648 
649 
650 //====================================================================
652  const Field& f, const int ieo)
653  {
654  const double *v1 = f.ptr(0);
655  double *v2 = w.ptr(0);
656 
659 
660  int is = m_Ntask * ith / nth;
661  int ns = m_Ntask * (ith + 1) / nth - is;
662 
663  for (int i = is; i < is + ns; ++i) {
664  mult_xm1_thread(i, vcp1_xm, v1, ieo);
665  }
666 
667 #pragma omp barrier
668 
669  /*
670  #pragma omp master
671  {
672  int Nv = m_Nvc * 2 * (m_Ny/2) * m_Nz * m_Nt;
673  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
674  }
675 
676  #pragma omp barrier
677  */
678  for (int i = is; i < is + ns; ++i) {
679  mult_xmb_thread(i, v2, v1, ieo);
680  }
681 
682  for (int i = is; i < is + ns; ++i) {
683  mult_xm2_thread(i, v2, vcp2_xm, ieo);
684  }
685  }
686 
687 
688 //====================================================================
690  const Field& f, const int ieo)
691  {
692  const double *v1 = f.ptr(0);
693  double *v2 = w.ptr(0);
694 
697 
698  int is = m_Ntask * ith / nth;
699  int ns = m_Ntask * (ith + 1) / nth - is;
700 
701  for (int i = is; i < is + ns; ++i) {
702  mult_yp1_thread(i, vcp1_yp, v1, ieo);
703  }
704 
705 #pragma omp barrier
706 
707  /*
708  #pragma omp master
709  {
710  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
711  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
712  }
713 
714  #pragma omp barrier
715  */
716  for (int i = is; i < is + ns; ++i) {
717  mult_ypb_thread(i, v2, v1, ieo);
718  }
719 
720  for (int i = is; i < is + ns; ++i) {
721  mult_yp2_thread(i, v2, vcp2_yp, ieo);
722  }
723  }
724 
725 
726 //====================================================================
728  const Field& f, const int ieo)
729  {
730  const double *v1 = f.ptr(0);
731  double *v2 = w.ptr(0);
732 
735 
736  int is = m_Ntask * ith / nth;
737  int ns = m_Ntask * (ith + 1) / nth - is;
738 
739  for (int i = is; i < is + ns; ++i) {
740  mult_ym1_thread(i, vcp1_ym, v1, ieo);
741  }
742 
743 #pragma omp barrier
744 
745  /*
746  #pragma omp master
747  {
748  int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
749  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
750  }
751  #pragma omp barrier
752  */
753 
754  for (int i = is; i < is + ns; ++i) {
755  mult_ymb_thread(i, v2, v1, ieo);
756  }
757 
758  for (int i = is; i < is + ns; ++i) {
759  mult_ym2_thread(i, v2, vcp2_ym, ieo);
760  }
761  }
762 
763 
764 //====================================================================
766  const Field& f, const int ieo)
767  {
768  const double *v1 = f.ptr(0);
769  double *v2 = w.ptr(0);
770 
773 
774  int is = m_Ntask * ith / nth;
775  int ns = m_Ntask * (ith + 1) / nth - is;
776 
777  for (int i = is; i < is + ns; ++i) {
778  mult_zp1_thread(i, vcp1_zp, v1, ieo);
779  }
780 
781 #pragma omp barrier
782 
783  /*
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 
790  #pragma omp barrier
791  */
792  for (int i = is; i < is + ns; ++i) {
793  mult_zpb_thread(i, v2, v1, ieo);
794  }
795 
796  for (int i = is; i < is + ns; ++i) {
797  mult_zp2_thread(i, v2, vcp2_zp, ieo);
798  }
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 
811 
812  int is = m_Ntask * ith / nth;
813  int ns = m_Ntask * (ith + 1) / nth - 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 
821  /*
822  #pragma omp master
823  {
824  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
825  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
826  }
827 
828  #pragma omp barrier
829  */
830  for (int i = is; i < is + ns; ++i) {
831  mult_zmb_thread(i, v2, v1, ieo);
832  }
833 
834  for (int i = is; i < is + ns; ++i) {
835  mult_zm2_thread(i, v2, vcp2_zm, ieo);
836  }
837  }
838 
839 
840 //====================================================================
842  const Field& f, const int ieo)
843  {
844  const double *v1 = f.ptr(0);
845  double *v2 = w.ptr(0);
846 
849 
850  int is = m_Ntask * ith / nth;
851  int ns = m_Ntask * (ith + 1) / nth - is;
852 
853  for (int i = is; i < is + ns; ++i) {
854  mult_tp1_dirac_thread(i, vcp1_tp, v1, ieo);
855  }
856 
857 #pragma omp barrier
858 
859 #pragma omp master
860  {
861  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
862  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
863  }
864 
865 #pragma omp barrier
866 
867  for (int i = is; i < is + ns; ++i) {
868  mult_tpb_dirac_thread(i, v2, v1, ieo);
869  }
870 
871  for (int i = is; i < is + ns; ++i) {
872  mult_tp2_dirac_thread(i, v2, vcp2_tp, ieo);
873  }
874  }
875 
876 
877 //====================================================================
879  const Field& f, const int ieo)
880  {
881  const double *v1 = f.ptr(0);
882  double *v2 = w.ptr(0);
883 
886 
887  int is = m_Ntask * ith / nth;
888  int ns = m_Ntask * (ith + 1) / nth - is;
889 
890  for (int i = is; i < is + ns; ++i) {
891  mult_tm1_dirac_thread(i, vcp1_tm, v1, ieo);
892  }
893 
894 #pragma omp barrier
895 
896 #pragma omp master
897  {
898  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
899  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
900  }
901 
902 #pragma omp barrier
903 
904  for (int i = is; i < is + ns; ++i) {
905  mult_tmb_dirac_thread(i, v2, v1, ieo);
906  }
907 
908  for (int i = is; i < is + ns; ++i) {
909  mult_tm2_dirac_thread(i, v2, vcp2_tm, ieo);
910  }
911  }
912 
913 
914 //====================================================================
916  const Field& f, const int ieo)
917  {
918  const double *v1 = f.ptr(0);
919  double *v2 = w.ptr(0);
920 
923 
924  int is = m_Ntask * ith / nth;
925  int ns = m_Ntask * (ith + 1) / nth - is;
926 
927  for (int i = is; i < is + ns; ++i) {
928  mult_tp1_chiral_thread(i, vcp1_tp, v1, ieo);
929  }
930 
931 #pragma omp barrier
932 
933  /*
934  #pragma omp master
935  {
936  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
937  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
938  }
939 
940  #pragma omp barrier
941  */
942  for (int i = is; i < is + ns; ++i) {
943  mult_tpb_chiral_thread(i, v2, v1, ieo);
944  }
945 
946  for (int i = is; i < is + ns; ++i) {
947  mult_tp2_chiral_thread(i, v2, vcp2_tp, ieo);
948  }
949  }
950 
951 
952 //====================================================================
954  const Field& f, const int ieo)
955  {
956  const double *v1 = f.ptr(0);
957  double *v2 = w.ptr(0);
958 
961 
962  int is = m_Ntask * ith / nth;
963  int ns = m_Ntask * (ith + 1) / nth - is;
964 
965  for (int i = is; i < is + ns; ++i) {
966  mult_tm1_chiral_thread(i, vcp1_tm, v1, ieo);
967  }
968 
969 #pragma omp barrier
970 
971  /*
972  #pragma omp master
973  {
974  int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
975  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
976  }
977 
978  #pragma omp barrier
979  */
980  for (int i = is; i < is + ns; ++i) {
981  mult_tmb_chiral_thread(i, v2, v1, ieo);
982  }
983 
984  for (int i = is; i < is + ns; ++i) {
985  mult_tm2_chiral_thread(i, v2, vcp2_tm, ieo);
986  }
987  }
988 
989 
990 //====================================================================
991 }
992 //============================================================END=====
std::vector< Channel * > m_fw_send
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:282
void prePropD(Field &, Field &, const Field &)
BridgeIO vout
Definition: bridgeIO.cpp:495
void mult_tm1_chiral_thread(int, double *, const double *, int)
double * vcp1_xp
arrays for data transfer.
void detailed(const char *format,...)
Definition: bridgeIO.cpp:212
void mult_tm1_dirac_thread(int, double *, const double *, int)
std::vector< double > m_boundary2
b.c. for each node.
static int get_num_threads()
returns available number of threads.
static int NPEy()
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:142
static int NPEt()
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:164
std::vector< int > m_Leo
void DDdag(Field &v, const Field &f)
std::vector< int > m_boundary
boundary condition.
void mult_yp2_thread(int, double *, const double *, int)
void Meo_gm5(Field &, const Field &, const int ieo)
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
static const std::string class_name
void Mdageo(Field &, const Field &, const int ieo)
std::vector< int > m_npe
void set_config(Field *U)
setting pointer to the gauge configuration.
static Channel * recv_init(int count, int idir, int ipm)
void Ddag(Field &v, const Field &f)
void(Fopr_Wilson_eo::* m_gm5)(Field &, const Field &)
void mult_xp(Field &, const Field &, const int ieo)
void mult_tp2_dirac_thread(int, double *, const double *, int)
void(Fopr_Wilson_eo::* m_gm5_self)(Field &)
void init(const std::string)
void mult_ypb_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_tp_chiral(Field &, const Field &, const int ieo)
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 postPropD(Field &, const Field &, const Field &)
void gm5_chiral_thread(int, double *, const double *)
static int Lvol()
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
void mult_yp1_thread(int, double *, const double *, int)
void Meo(Field &, const Field &, const int ieo)
void mult_tm2_chiral_thread(int, double *, const double *, int)
void mult_tm_chiral(Field &, const Field &, const int ieo)
void scal_impl(Field &, double)
void H(Field &v, const Field &f)
static int get_thread_id()
returns thread id.
void gm5_chiral(Field &, const Field &)
void mult_ym2_thread(int, double *, const double *, int)
Wilson-type fermion field.
Definition: field_F.h:37
double flop_count()
retuns number of floating point operations of Meo.
void gm5_dirac(Field &, const Field &)
int nin() const
Definition: field.h:115
void scal_thread(int, double *, double)
void mult_xm1_thread(int, double *, const double *, int)
void mult_zp2_thread(int, double *, const double *, int)
void mult_tp1_dirac_thread(int, double *, const double *, int)
void gm5_dirac_thread(int, double *, const double *)
SU(N) gauge field.
Definition: field_G.h:38
void D(Field &v, const Field &f)
void mult_tm_dirac(Field &, const Field &, const int ieo)
void MeoMoe(Field &, const Field &)
void mult_xp2_thread(int, double *, const double *, int)
void mult_zp1_thread(int, double *, const double *, int)
Bridge::VerboseLevel m_vl
Definition: fopr.h:128
void mult_tpb_dirac_thread(int, double *, const double *, int)
void mult_zp(Field &, const Field &, const int ieo)
void mult_zmb_thread(int, double *, const double *, int)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
void mult_tp1_chiral_thread(int, double *, const double *, int)
static void sync_barrier_all()
barrier among all the threads and nodes.
std::string m_repr
Dirac matrix representation.
void mult_zpb_thread(int, double *, const double *, int)
void mult_tm2_dirac_thread(int, double *, const double *, int)
void mult_xmb_thread(int, double *, const double *, int)
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(Fopr_Wilson_eo::* m_mult_tm)(Field &, const Field &, const int ieo)
int nex() const
Definition: field.h:117
void mult_tpb_chiral_thread(int, double *, const double *, int)
Field_G * m_U
dummy: pointing m_Ueo.
void paranoiac(const char *format,...)
Definition: bridgeIO.cpp:229
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:168
void set_parameters(const Parameters &params)
void DdagD(Field &v, const Field &f)
static int NPEx()
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
std::vector< Channel * > m_bw_recv
void mult_tp2_chiral_thread(int, double *, const double *, int)
double m_kappa
hopping parameter.
void mult_ymb_thread(int, double *, const double *, int)
static int NPEz()
void prePropDag(Field &, Field &, const Field &)
void mult_yp(Field &, const Field &, const int ieo)
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu) used in force calculation.
void mult_tmb_dirac_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]
static Channel * send_init(int count, int idir, int ipm)
void mult_ym1_thread(int, double *, const double *, int)
static int sync()
synchronize within small world.
void mult_xm2_thread(int, double *, const double *, int)
Field m_w2
working field.
void mult_zm2_thread(int, double *, const double *, int)
void mult_tp_dirac(Field &, const Field &, const int ieo)
void mult_xpb_thread(int, double *, const double *, int)
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 mult_zm1_thread(int, double *, const double *, int)
std::vector< Channel * > m_fw_recv
void mult_xm(Field &, const Field &, const int ieo)
void mult_tmb_chiral_thread(int, double *, const double *, int)
void mult_xp1_thread(int, double *, const double *, int)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
std::vector< Channel * > m_bw_send
void(Fopr_Wilson_eo::* m_mult_tp)(Field &, const Field &, const int ieo)