Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_WilsonGeneral_impl.cpp
Go to the documentation of this file.
1 
15 
16 namespace Imp {
17 #if defined USE_GROUP_SU3
18 #include "fopr_Wilson_impl_SU3.inc"
19 #elif defined USE_GROUP_SU2
20 #include "fopr_Wilson_impl_SU2.inc"
21 #elif defined USE_GROUP_SU_N
22 #include "fopr_Wilson_impl_SU_N.inc"
23 #endif
24 
25  const std::string Fopr_WilsonGeneral::class_name = "Imp::Fopr_WilsonGeneral";
26 
27 //====================================================================
28  void Fopr_WilsonGeneral::init(std::string repr)
29  {
31 
32  vout.general(m_vl, "%s: Construction of fermion operator(imp).\n", class_name.c_str());
33 
34  check_Nc();
35 
38  m_Nvc = 2 * m_Nc;
39  m_Ndf = 2 * m_Nc * m_Nc;
40 
45 
48  m_boundary.resize(m_Ndim);
49  m_boundary2.resize(m_Ndim);
50 
51  m_repr = repr;
52 
53  m_GM.resize(m_Ndim + 1);
54 
55  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
56 
57  m_GM[0] = gmset->get_GM(GammaMatrixSet::GAMMA1);
58  m_GM[1] = gmset->get_GM(GammaMatrixSet::GAMMA2);
59  m_GM[2] = gmset->get_GM(GammaMatrixSet::GAMMA3);
60  m_GM[3] = gmset->get_GM(GammaMatrixSet::GAMMA4);
61  m_GM[4] = gmset->get_GM(GammaMatrixSet::GAMMA5);
62 
63  m_U = 0;
64 
67 
68  if (m_repr == "Dirac") {
74  } else if (m_repr == "Chiral") {
80  } else {
81  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n", class_name.c_str());
82  exit(EXIT_FAILURE);
83  }
84 
85  m_w1.reset(m_Nvc * m_Nd, m_Nvol, 1);
86  m_w2.reset(m_Nvc * m_Nd, m_Nvol, 1);
87 
88  int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
89  vcp1_x_plus = new double[Nvx];
90  vcp2_x_plus = new double[Nvx];
91  vcp1_x_minus = new double[Nvx];
92  vcp2_x_minus = new double[Nvx];
93 
94  int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
95  vcp1_y_plus = new double[Nvy];
96  vcp2_y_plus = new double[Nvy];
97  vcp1_y_minus = new double[Nvy];
98  vcp2_y_minus = new double[Nvy];
99 
100  int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
101  vcp1_z_plus = new double[Nvz];
102  vcp2_z_plus = new double[Nvz];
103  vcp1_z_minus = new double[Nvz];
104  vcp2_z_minus = new double[Nvz];
105 
106  // int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
107  int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
108  vcp1_t_plus = new double[Nvt];
109  vcp2_t_plus = new double[Nvt];
110  vcp1_t_minus = new double[Nvt];
111  vcp2_t_minus = new double[Nvt];
112 
113  setup_thread();
114  }
115 
116 
117 //====================================================================
118  void Fopr_WilsonGeneral::set_mode(std::string mode)
119  {
120  m_mode = mode;
121 
122  if (m_mode == "D") {
125  } else if (m_mode == "Ddag") {
128  } else if (m_mode == "DdagD") {
131  } else if (m_mode == "DDdag") {
134  } else if (m_mode == "H") {
137  } else {
138  vout.crucial(m_vl, "Error at %s: input mode is undefined.\n", class_name.c_str());
139  exit(EXIT_FAILURE);
140  }
141  }
142 
143 
144 //====================================================================
146  {
147  delete[] vcp1_x_plus;
148  delete[] vcp2_x_plus;
149  delete[] vcp1_x_minus;
150  delete[] vcp2_x_minus;
151 
152  delete[] vcp1_y_plus;
153  delete[] vcp2_y_plus;
154  delete[] vcp1_y_minus;
155  delete[] vcp2_y_minus;
156 
157  delete[] vcp1_z_plus;
158  delete[] vcp2_z_plus;
159  delete[] vcp1_z_minus;
160  delete[] vcp2_z_minus;
161 
162  delete[] vcp1_t_plus;
163  delete[] vcp2_t_plus;
164  delete[] vcp1_t_minus;
165  delete[] vcp2_t_minus;
166  }
167 
168 
169 //====================================================================
170  std::string Fopr_WilsonGeneral::get_mode() const
171  {
172  return m_mode;
173  }
174 
175 
176 //====================================================================
178  {
179  const string str_vlevel = params.get_string("verbose_level");
180 
181  m_vl = vout.set_verbose_level(str_vlevel);
182 
183  //- fetch and check input parameters
184  double kappa_s, kappa_t;
185  double nu_s, r_s;
186  std::vector<int> bc;
187 
188  int err = 0;
189  err += params.fetch_double("hopping_parameter_spatial", kappa_s);
190  err += params.fetch_double("hopping_parameter_temporal", kappa_t);
191  err += params.fetch_double("dispersion_parameter_spatial", nu_s);
192  err += params.fetch_double("Wilson_parameter_spatial", r_s);
193  err += params.fetch_int_vector("boundary_condition", bc);
194 
195  if (err) {
196  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
197  exit(EXIT_FAILURE);
198  }
199 
200  set_parameters(kappa_s, kappa_t, nu_s, r_s, bc);
201  }
202 
203 
204 //====================================================================
205  void Fopr_WilsonGeneral::set_parameters(const double kappa_s,
206  const double kappa_t,
207  const double nu_s,
208  const double r_s,
209  const std::vector<int> bc)
210  {
211  assert(bc.size() == m_Ndim);
212 
213  //- print input parameters
214  vout.general(m_vl, "%s: input parameters\n", class_name.c_str());
215  vout.general(m_vl, " kappa_s = %12.8f\n", kappa_s);
216  vout.general(m_vl, " kappa_t = %12.8f\n", kappa_t);
217  vout.general(m_vl, " nu_s = %12.8f\n", nu_s);
218  vout.general(m_vl, " r_s = %12.8f\n", r_s);
219  for (int mu = 0; mu < m_Ndim; ++mu) {
220  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
221  }
222 
223  //- store values
224  m_kappa_s = kappa_s;
225  m_kappa_t = kappa_t;
226  m_nu_s = nu_s;
227  m_r_s = r_s;
228 
229  for (int mu = 0; mu < m_Ndim; ++mu) {
230  m_boundary[mu] = bc[mu];
231  }
232 
233  //- additional boundary condition for each node:
234  for (int idir = 0; idir < m_Ndim; ++idir) {
235  m_boundary2[idir] = 1.0;
236  if (Communicator::ipe(idir) == 0) m_boundary2[idir] = m_boundary[idir];
237  }
238  }
239 
240 
241 //====================================================================
243  {
244  // The following counting explicitly depends on the implementation.
245  // It will be recalculated when the code is modified.
246  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
247 
248  int Lvol = CommonParameters::Lvol();
249  double flop_site, flop;
250 
251  if (m_repr == "Dirac") {
252  flop_site = static_cast<double>(
253  m_Nc * m_Nd * (4 + 6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
254  } else if (m_repr == "Chiral") {
255  flop_site = static_cast<double>(
256  m_Nc * m_Nd * (4 + 8 * (4 * m_Nc + 2)));
257  } else {
258  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
259  class_name.c_str());
260  exit(EXIT_FAILURE);
261  }
262 
263  flop = flop_site * static_cast<double>(Lvol);
264 
265  if ((m_mode == "DdagD") || (m_mode == "DDdag")) flop *= 2.0;
266 
267  return flop;
268  }
269 
270 
271 //====================================================================
273  {
274  // D_ex_dirac(w, 0, f, 0);
275  // daypx(w, -m_kappa_s, f);
276 
277  clear(w);
278 
279  clear(m_w1);
280  for (int mu = 0; mu < (m_Ndim - 1); ++mu) {
281  mult_up(mu, m_w1, f);
282  mult_dn(mu, m_w1, f);
283  }
284  daxpy(w, -m_kappa_s, m_w1);
285 
286  clear(m_w1);
287  int mu = (m_Ndim - 1);
288  {
289  mult_up(mu, m_w1, f);
290  mult_dn(mu, m_w1, f);
291  }
292  daxpy(w, -m_kappa_t, m_w1);
293 
294 
295  daxpy(w, 1.0, f); // w += f;
296  }
297 
298 
299 //====================================================================
301  {
302  // D_ex_chiral(w, 0, f, 0);
303  // daypx(w, -m_kappa_s, f);
304 
305  clear(w);
306 
307  clear(m_w1);
308  for (int mu = 0; mu < (m_Ndim - 1); ++mu) {
309  mult_up(mu, m_w1, f);
310  mult_dn(mu, m_w1, f);
311  }
312  daxpy(w, -m_kappa_s, m_w1);
313 
314  clear(m_w1);
315  int mu = (m_Ndim - 1);
316  {
317  mult_up(mu, m_w1, f);
318  mult_dn(mu, m_w1, f);
319  }
320  daxpy(w, -m_kappa_t, m_w1);
321 
322 
323  daxpy(w, 1.0, f); // w += f;
324  }
325 
326 
327 //====================================================================
329  Field& w, const Field& f)
330  {
331  if (mu == 0) {
332  mult_x_plus(w, f);
333  } else if (mu == 1) {
334  mult_y_plus(w, f);
335  } else if (mu == 2) {
336  mult_z_plus(w, f);
337  } else if (mu == 3) {
338  (this->*m_mult_t_plus)(w, f);
339  } else {
340  vout.crucial(m_vl, "Error at %s: illegal mu=%d in mult_up.\n", class_name.c_str(), mu);
341  exit(EXIT_FAILURE);
342  }
343  }
344 
345 
346 //====================================================================
347  void Fopr_WilsonGeneral::mult_dn(int mu, Field& w, const Field& f)
348  {
349  if (mu == 0) {
350  mult_x_minus(w, f);
351  } else if (mu == 1) {
352  mult_y_minus(w, f);
353  } else if (mu == 2) {
354  mult_z_minus(w, f);
355  } else if (mu == 3) {
356  (this->*m_mult_t_minus)(w, f);
357  } else {
358  vout.crucial(m_vl, "Error at %s: illegal mu=%d in mult_dn.\n", class_name.c_str(), mu);
359  exit(EXIT_FAILURE);
360  }
361  }
362 
363 
364 //====================================================================
365  void Fopr_WilsonGeneral::D_ex_dirac(Field& w, const int ex1,
366  const Field& f, const int ex2)
367  {
368  int Ninvol = m_Nvc * m_Nd * m_Nvol;
369  const double *v1 = f.ptr(Ninvol * ex2);
370  double *v2 = w.ptr(Ninvol * ex1);
371 
373  int i_thread = ThreadManager_OpenMP::get_thread_id();
374 
375  int is = m_Ntask * i_thread / Nthread;
376  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
377 
378  for (int i = is; i < is + ns; ++i) {
387  }
388 
389 #pragma omp barrier
390 #pragma omp master
391  {
392  int idir_x = 0;
393  int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
394  Communicator::exchange(Nvx, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
395  Communicator::exchange(Nvx, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
396 
397  int idir_y = 1;
398  int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
399  Communicator::exchange(Nvy, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
400  Communicator::exchange(Nvy, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
401 
402  int idir_z = 2;
403  int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
404  Communicator::exchange(Nvz, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
405  Communicator::exchange(Nvz, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
406 
407  int idir_t = 3;
408  // int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
409  int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
410  Communicator::exchange(Nvt, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
411  Communicator::exchange(Nvt, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
412  }
413 #pragma omp barrier
414 
415  for (int i = is; i < is + ns; ++i) {
416  clear_thread(i, v2);
417  mult_x_plus_bulk_thread(i, v2, v1);
418  mult_x_minus_bulk_thread(i, v2, v1);
419  mult_y_plus_bulk_thread(i, v2, v1);
420  mult_y_minus_bulk_thread(i, v2, v1);
421  mult_z_plus_bulk_thread(i, v2, v1);
422  mult_z_minus_bulk_thread(i, v2, v1);
425  }
426 
427  for (int i = is; i < is + ns; ++i) {
436  }
437 
438  // for (int i = is; i < is + ns; ++i) {
439  // daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
440  // daypx_thread(i, v2, -m_kappa_s, v1);
441  // }
442 
443 
445  }
446 
447 
448 //====================================================================
449  void Fopr_WilsonGeneral::D_ex_chiral(Field& w, const int ex1,
450  const Field& f, const int ex2)
451  {
452  int Ninvol = m_Nvc * m_Nd * m_Nvol;
453  const double *v1 = f.ptr(Ninvol * ex2);
454  double *v2 = w.ptr(Ninvol * ex1);
455 
457  int i_thread = ThreadManager_OpenMP::get_thread_id();
458 
459  int is = m_Ntask * i_thread / Nthread;
460  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
461 
462  for (int i = is; i < is + ns; ++i) {
471  }
472 #pragma omp barrier
473 
474 #pragma omp master
475  {
476  int idir_x = 0;
477  int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
478  Communicator::exchange(Nvx, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
479  Communicator::exchange(Nvx, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
480 
481  int idir_y = 1;
482  int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
483  Communicator::exchange(Nvy, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
484  Communicator::exchange(Nvy, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
485 
486  int idir_z = 2;
487  int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
488  Communicator::exchange(Nvz, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
489  Communicator::exchange(Nvz, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
490 
491  int idir_t = 3;
492  // int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
493  int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
494  Communicator::exchange(Nvt, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
495  Communicator::exchange(Nvt, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
496  }
497 #pragma omp barrier
498 
499  for (int i = is; i < is + ns; ++i) {
500  clear_thread(i, v2);
501  mult_x_plus_bulk_thread(i, v2, v1);
502  mult_x_minus_bulk_thread(i, v2, v1);
503  mult_y_plus_bulk_thread(i, v2, v1);
504  mult_y_minus_bulk_thread(i, v2, v1);
505  mult_z_plus_bulk_thread(i, v2, v1);
506  mult_z_minus_bulk_thread(i, v2, v1);
509  }
510 
511  for (int i = is; i < is + ns; ++i) {
520  }
521 
522  // for (int i = is; i < is + ns; ++i) {
523  // daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
524  // daypx_thread(i, v2, -m_kappa_s, v1); // w = -m_kappa * w + f.
525  // }
526 
527 
529 
530  // clear(w);
531  // mult_x_plus(w,f);
532  // mult_x_minus(w,f);
533  // mult_y_plus(w,f);
534  // mult_y_minus(w,f);
535  // mult_z_plus(w,f);
536  // mult_z_minus(w,f);
537  // mult_t_plus_chiral(w,f);
538  // mult_t_minus_chiral(w,f);
539  // daypx(w, -m_kappa, f); // w = -m_kappa * w + f.
540  }
541 
542 
543 //====================================================================
545  Field& v, const Field& w)
546  {
547  clear(m_w2);
548 
549  mult_up(mu, m_w2, w);
550  mult_gm5(v, m_w2);
551  }
552 
553 
554 //====================================================================
555  void Fopr_WilsonGeneral::proj_chiral(Field& w, const int ex1,
556  const Field& v, const int ex2,
557  const int ipm)
558  {
559  double fpm = 0.0;
560 
561  if (ipm == 1) {
562  fpm = 1.0;
563  } else if (ipm == -1) {
564  fpm = -1.0;
565  } else {
566  vout.crucial(m_vl, "Error at %s: illegal chirality = %d.\n", class_name.c_str(), ipm);
567  exit(EXIT_FAILURE);
568  }
569 
570  m_w1.setpart_ex(0, v, ex2);
571  mult_gm5(m_w2, m_w1);
572  m_w1.addpart_ex(0, m_w2, 0, fpm);
573  w.setpart_ex(ex1, m_w1, 0);
574 
575 #pragma omp barrier
576  }
577 
578 
579 //====================================================================
581  double fac, const Field& f)
582  {
583  const double *v1 = f.ptr(0);
584  double *v2 = w.ptr(0);
585 
587  int i_thread = ThreadManager_OpenMP::get_thread_id();
588 
589  int is = m_Ntask * i_thread / Nthread;
590  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
591 
592  for (int i = is; i < is + ns; ++i) {
593  daxpy_thread(i, v2, fac, v1);
594  }
595 #pragma omp barrier
596  }
597 
598 
599 //====================================================================
601  double fac, const Field& f)
602  {
603  const double *v1 = f.ptr(0);
604  double *v2 = w.ptr(0);
605 
607  int i_thread = ThreadManager_OpenMP::get_thread_id();
608 
609  int is = m_Ntask * i_thread / Nthread;
610  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
611 
612  for (int i = is; i < is + ns; ++i) {
613  daypx_thread(i, v2, fac, v1);
614  }
615 #pragma omp barrier
616  }
617 
618 
619 //====================================================================
621  double fac)
622  {
623  double *v2 = w.ptr(0);
624 
626  int i_thread = ThreadManager_OpenMP::get_thread_id();
627 
628  int is = m_Ntask * i_thread / Nthread;
629  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
630 
631  for (int i = is; i < is + ns; ++i) {
632  scal_thread(i, v2, fac);
633  }
634 #pragma omp barrier
635  }
636 
637 
638 //====================================================================
640  {
641  double *v2 = w.ptr(0);
642 
644  int i_thread = ThreadManager_OpenMP::get_thread_id();
645 
646  int is = m_Ntask * i_thread / Nthread;
647  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
648 
649  for (int i = is; i < is + ns; ++i) {
650  clear_thread(i, v2);
651  }
652 #pragma omp barrier
653  }
654 
655 
656 //====================================================================
658  {
659  const double *v1 = f.ptr(0);
660  double *v2 = w.ptr(0);
661 
663  int i_thread = ThreadManager_OpenMP::get_thread_id();
664 
665  int is = m_Ntask * i_thread / Nthread;
666  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
667 
668  for (int i = is; i < is + ns; ++i) {
669  gm5_dirac_thread(i, v2, v1);
670  }
671 #pragma omp barrier
672  }
673 
674 
675 //====================================================================
677  {
678  const double *v1 = f.ptr(0);
679  double *v2 = w.ptr(0);
680 
682  int i_thread = ThreadManager_OpenMP::get_thread_id();
683 
684  int is = m_Ntask * i_thread / Nthread;
685  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
686 
687  for (int i = is; i < is + ns; ++i) {
688  gm5_chiral_thread(i, v2, v1);
689  }
690 #pragma omp barrier
691  }
692 
693 
694 //====================================================================
696  {
697  const double *v1 = f.ptr(0);
698  double *v2 = w.ptr(0);
699 
701  int i_thread = ThreadManager_OpenMP::get_thread_id();
702 
703  int is = m_Ntask * i_thread / Nthread;
704  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
705 
706 #pragma omp barrier
707 
708  for (int i = is; i < is + ns; ++i) {
710  }
711 
712 #pragma omp barrier
713 #pragma omp master
714  {
715  int idir_x = 0;
716  int Nv = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
717  Communicator::exchange(Nv, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
718  }
719 #pragma omp barrier
720 
721  for (int i = is; i < is + ns; ++i) {
722  mult_x_plus_bulk_thread(i, v2, v1);
723  }
724 
725  for (int i = is; i < is + ns; ++i) {
727  }
728 
730  }
731 
732 
733 //====================================================================
735  {
736  const double *v1 = f.ptr(0);
737  double *v2 = w.ptr(0);
738 
740  int i_thread = ThreadManager_OpenMP::get_thread_id();
741 
742  int is = m_Ntask * i_thread / Nthread;
743  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
744 
745 #pragma omp barrier
746 
747  for (int i = is; i < is + ns; ++i) {
749  }
750 
751 #pragma omp barrier
752 #pragma omp master
753  {
754  int idir_x = 0;
755  int Nv = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
756  Communicator::exchange(Nv, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
757  }
758 #pragma omp barrier
759 
760  for (int i = is; i < is + ns; ++i) {
761  mult_x_minus_bulk_thread(i, v2, v1);
762  }
763 
764  for (int i = is; i < is + ns; ++i) {
766  }
767 
769  }
770 
771 
772 //====================================================================
774  {
775  const double *v1 = f.ptr(0);
776  double *v2 = w.ptr(0);
777 
779  int i_thread = ThreadManager_OpenMP::get_thread_id();
780 
781  int is = m_Ntask * i_thread / Nthread;
782  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
783 
784 #pragma omp barrier
785 
786  for (int i = is; i < is + ns; ++i) {
788  }
789 
790 #pragma omp barrier
791 #pragma omp master
792  {
793  int idir_y = 1;
794  int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
795  Communicator::exchange(Nv, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
796  }
797 #pragma omp barrier
798 
799  for (int i = is; i < is + ns; ++i) {
800  mult_y_plus_bulk_thread(i, v2, v1);
801  }
802 
803  for (int i = is; i < is + ns; ++i) {
805  }
806 
808  }
809 
810 
811 //====================================================================
813  {
814  const double *v1 = f.ptr(0);
815  double *v2 = w.ptr(0);
816 
818  int i_thread = ThreadManager_OpenMP::get_thread_id();
819 
820  int is = m_Ntask * i_thread / Nthread;
821  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
822 
823 #pragma omp barrier
824 
825  for (int i = is; i < is + ns; ++i) {
827  }
828 
829 #pragma omp barrier
830 #pragma omp master
831  {
832  int idir_y = 1;
833  int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
834  Communicator::exchange(Nv, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
835  }
836 #pragma omp barrier
837 
838  for (int i = is; i < is + ns; ++i) {
839  mult_y_minus_bulk_thread(i, v2, v1);
840  }
841 
842  for (int i = is; i < is + ns; ++i) {
844  }
845 
847  }
848 
849 
850 //====================================================================
852  {
853  const double *v1 = f.ptr(0);
854  double *v2 = w.ptr(0);
855 
857  int i_thread = ThreadManager_OpenMP::get_thread_id();
858 
859  int is = m_Ntask * i_thread / Nthread;
860  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
861 
862 #pragma omp barrier
863 
864  for (int i = is; i < is + ns; ++i) {
866  }
867 
868 #pragma omp barrier
869 #pragma omp master
870  {
871  int idir_z = 2;
872  int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
873  Communicator::exchange(Nv, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
874  }
875 #pragma omp barrier
876 
877  for (int i = is; i < is + ns; ++i) {
878  mult_z_plus_bulk_thread(i, v2, v1);
879  }
880 
881  for (int i = is; i < is + ns; ++i) {
883  }
884 
886  }
887 
888 
889 //====================================================================
891  {
892  const double *v1 = f.ptr(0);
893  double *v2 = w.ptr(0);
894 
896  int i_thread = ThreadManager_OpenMP::get_thread_id();
897 
898  int is = m_Ntask * i_thread / Nthread;
899  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
900 
901 #pragma omp barrier
902 
903  for (int i = is; i < is + ns; ++i) {
905  }
906 
907 #pragma omp barrier
908 #pragma omp master
909  {
910  int idir_z = 2;
911  int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
912  Communicator::exchange(Nv, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
913  }
914 #pragma omp barrier
915 
916  for (int i = is; i < is + ns; ++i) {
917  mult_z_minus_bulk_thread(i, v2, v1);
918  }
919 
920  for (int i = is; i < is + ns; ++i) {
922  }
923 
925  }
926 
927 
928 //====================================================================
930  {
931  const double *v1 = f.ptr(0);
932  double *v2 = w.ptr(0);
933 
935  int i_thread = ThreadManager_OpenMP::get_thread_id();
936 
937  int is = m_Ntask * i_thread / Nthread;
938  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
939 
940 #pragma omp barrier
941 
942  for (int i = is; i < is + ns; ++i) {
944  }
945 
946 #pragma omp barrier
947 #pragma omp master
948  {
949  int idir_t = 3;
950  // int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
951  int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
952  Communicator::exchange(Nv, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
953  }
954 #pragma omp barrier
955 
956  for (int i = is; i < is + ns; ++i) {
958  }
959 
960  for (int i = is; i < is + ns; ++i) {
962  }
963 
965  }
966 
967 
968 //====================================================================
970  {
971  const double *v1 = f.ptr(0);
972  double *v2 = w.ptr(0);
973 
975  int i_thread = ThreadManager_OpenMP::get_thread_id();
976 
977  int is = m_Ntask * i_thread / Nthread;
978  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
979 
980 #pragma omp barrier
981 
982  for (int i = is; i < is + ns; ++i) {
984  }
985 
986 #pragma omp barrier
987 #pragma omp master
988  {
989  int idir_t = 3;
990  // int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
991  int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
992  Communicator::exchange(Nv, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
993  }
994 #pragma omp barrier
995 
996  for (int i = is; i < is + ns; ++i) {
998  }
999 
1000  for (int i = is; i < is + ns; ++i) {
1002  }
1003 
1005  }
1006 
1007 
1008 //====================================================================
1010  {
1011  const double *v1 = f.ptr(0);
1012  double *v2 = w.ptr(0);
1013 
1014  int Nthread = ThreadManager_OpenMP::get_num_threads();
1015  int i_thread = ThreadManager_OpenMP::get_thread_id();
1016 
1017  int is = m_Ntask * i_thread / Nthread;
1018  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
1019 
1020 #pragma omp barrier
1021 
1022  for (int i = is; i < is + ns; ++i) {
1024  }
1025 
1026 #pragma omp barrier
1027 #pragma omp master
1028  {
1029  int idir_t = 3;
1030  // int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1031  int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1032  Communicator::exchange(Nv, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
1033  }
1034 #pragma omp barrier
1035 
1036  for (int i = is; i < is + ns; ++i) {
1037  mult_t_plus_bulk_chiral_thread(i, v2, v1);
1038  }
1039 
1040  for (int i = is; i < is + ns; ++i) {
1042  }
1043 
1045  }
1046 
1047 
1048 //====================================================================
1050  {
1051  const double *v1 = f.ptr(0);
1052  double *v2 = w.ptr(0);
1053 
1054  int Nthread = ThreadManager_OpenMP::get_num_threads();
1055  int i_thread = ThreadManager_OpenMP::get_thread_id();
1056 
1057  int is = m_Ntask * i_thread / Nthread;
1058  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
1059 
1060 #pragma omp barrier
1061 
1062  for (int i = is; i < is + ns; ++i) {
1064  }
1065 
1066 #pragma omp barrier
1067 #pragma omp master
1068  {
1069  int idir_t = 3;
1070  // int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1071  int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1072  Communicator::exchange(Nv, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
1073  }
1074 #pragma omp barrier
1075 
1076  for (int i = is; i < is + ns; ++i) {
1078  }
1079 
1080  for (int i = is; i < is + ns; ++i) {
1082  }
1083 
1085  }
1086 
1087 
1088 //====================================================================
1089 }
1090 //============================================================END=====
const Field_F mult_gm5p(int mu, const Field_F &w)
void mult_t_plus1_chiral_thread(int, double *, const double *)
BridgeIO vout
Definition: bridgeIO.cpp:495
void(Fopr_WilsonGeneral::* m_mult_t_plus)(Field &, const Field &)
static int get_num_threads()
returns available number of threads.
void DDdag(Field &w, const Field &f)
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:142
void mult_y_plus2_thread(int, double *, const double *)
double * vcp1_x_plus
arrays for data transfer.
void D_dirac(Field &, const Field &)
void mult_t_plus2_dirac_thread(int, double *, const double *)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
GammaMatrix get_GM(GMspecies spec)
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
void mult_x_minus_bulk_thread(int, double *, const double *)
void mult_x_plus2_thread(int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult)(Field &, const Field &)
static Bridge::VerboseLevel Vlevel()
Container of Field-type object.
Definition: field.h:39
void H(Field &w, const Field &f)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:211
void mult_t_plus_dirac(Field &, const Field &)
void mult_t_plus_bulk_dirac_thread(int, double *, const double *)
void mult_t_minus2_chiral_thread(int, double *, const double *)
std::string get_mode() const
only for Fopr_Overlap
void gm5_dirac_thread(int, double *, const double *)
void mult_x_plus(Field &, const Field &)
void daxpy_thread(int, double *, double, const double *)
void gm5_chiral_thread(int, double *, const double *)
Class for parameters.
Definition: parameters.h:46
static int ipe(const int dir)
logical coordinate of current proc.
double flop_count()
returns the flops per site.
void daxpy(Field &, double, const Field &)
static int Lvol()
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:193
void mult_x_minus1_thread(int, double *, const double *)
void mult_y_plus_bulk_thread(int, double *, const double *)
void mult_x_minus2_thread(int, double *, const double *)
static int get_thread_id()
returns thread id.
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_t_minus_dirac(Field &, const Field &)
void mult_z_plus_bulk_thread(int, double *, const double *)
void DdagD(Field &w, const Field &f)
void mult_y_minus(Field &, const Field &)
void mult_y_minus_bulk_thread(int, double *, const double *)
void mult_z_minus1_thread(int, double *, const double *)
void mult_t_minus1_dirac_thread(int, double *, const double *)
void mult_undef(Field &, const Field &f)
void mult_t_minus_bulk_chiral_thread(int, double *, const double *)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
void mult_x_plus1_thread(int, double *, const double *)
const Field_G * m_U
gauge configuration.
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
Field m_w2
temporary fields.
static void sync_barrier_all()
barrier among all the threads and nodes.
void daypx_thread(int, double *, double, const double *)
std::vector< double > m_boundary2
b.c. for each node.
void mult_t_plus2_chiral_thread(int, double *, const double *)
void mult_x_minus(Field &, const Field &)
void mult_dn(int mu, Field &, const Field &)
void mult_t_plus_chiral(Field &, const Field &)
static int exchange(int count, double *recv_buf, double *send_buf, int idir, int ipm, int tag)
receive array of double from upstream specified by idir and ipm, and send array to downstream...
void mult_t_minus_chiral(Field &, const Field &)
void mult_x_plus_bulk_thread(int, double *, const double *)
void mult_t_minus2_dirac_thread(int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult_dag)(Field &, const Field &)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_y_plus(Field &, const Field &)
void mult_y_minus1_thread(int, double *, const double *)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_y_minus2_thread(int, double *, const double *)
void mult_z_plus2_thread(int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult_t_minus)(Field &, const Field &)
void(Fopr_WilsonGeneral::* m_D_ex)(Field &, const int, const Field &, const int)
void scal_thread(int, double *, double)
static const std::string class_name
void mult_t_plus_bulk_chiral_thread(int, double *, const double *)
void gm5_chiral(Field &, const Field &)
void set_parameters(const Parameters &params)
void mult_z_minus_bulk_thread(int, double *, const double *)
void mult_z_plus1_thread(int, double *, const double *)
void proj_chiral(Field &w, const int ex1, const Field &v, const int ex2, const int ipm)
void Ddag(Field &w, const Field &f)
void mult_up(int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void(Fopr_WilsonGeneral::* m_gm5)(Field &, const Field &)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
void daypx(Field &, double, const Field &)
void D(Field &v, const Field &f)
void mult_z_minus(Field &, const Field &)
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
void mult_y_plus1_thread(int, double *, const double *)
string get_string(const string &key) const
Definition: parameters.cpp:116
void mult_t_minus1_chiral_thread(int, double *, const double *)
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:294
void mult_t_plus1_dirac_thread(int, double *, const double *)
std::vector< int > m_boundary
boundary condition.
void mult_z_plus(Field &, const Field &)
void gm5_dirac(Field &, const Field &)
void(Fopr_WilsonGeneral::* m_D)(Field &, const Field &)
void mult_t_minus_bulk_dirac_thread(int, double *, const double *)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void mult_z_minus2_thread(int, double *, const double *)
void D_chiral(Field &, const Field &)