Bridge++  Version 1.4.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_impl.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_impl.h"
15 
17 
18 //#define USE_SU2
19 
20 namespace Imp {
21 #if defined USE_GROUP_SU3
22 #include "fopr_Wilson_impl_SU3.inc"
23 #elif defined USE_GROUP_SU2
24 #include "fopr_Wilson_impl_SU2.inc"
25 #elif defined USE_GROUP_SU_N
26 #include "fopr_Wilson_impl_SU_N.inc"
27 #endif
28 
29  const std::string Fopr_Wilson::class_name = "Imp::Fopr_Wilson";
30 
31 //====================================================================
32  void Fopr_Wilson::init(std::string repr)
33  {
35 
36  vout.general(m_vl, "%s: Construction of Wilson fermion operator.\n", class_name.c_str());
37 
38  check_Nc();
39 
42  m_Nvc = 2 * m_Nc;
43  m_Ndf = 2 * m_Nc * m_Nc;
44 
49 
52  m_boundary.resize(m_Ndim);
53  m_boundary2.resize(m_Ndim);
54 
55  m_repr = repr;
56 
57  m_GM.resize(m_Ndim + 1);
58 
59  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
60 
61  m_GM[0] = gmset->get_GM(GammaMatrixSet::GAMMA1);
62  m_GM[1] = gmset->get_GM(GammaMatrixSet::GAMMA2);
63  m_GM[2] = gmset->get_GM(GammaMatrixSet::GAMMA3);
64  m_GM[3] = gmset->get_GM(GammaMatrixSet::GAMMA4);
65  m_GM[4] = gmset->get_GM(GammaMatrixSet::GAMMA5);
66 
67  m_U = 0;
68 
71 
72  if (m_repr == "Dirac") {
78  } else if (m_repr == "Chiral") {
84  } else {
85  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n", class_name.c_str());
86  exit(EXIT_FAILURE);
87  }
88 
89  m_w1.reset(m_Nvc * m_Nd, m_Nvol, 1);
90  m_w2.reset(m_Nvc * m_Nd, m_Nvol, 1);
91 
92  int Nvx = m_Nvc * 2 * m_Ny * 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_Nx * 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_Nx * 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_Nx * 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  setup_thread();
117  }
118 
119 
120 //====================================================================
121  void Fopr_Wilson::set_mode(std::string mode)
122  {
123  m_mode = mode;
124 
125  if (m_mode == "D") {
128  } else if (m_mode == "Ddag") {
131  } else if (m_mode == "DdagD") {
134  } else if (m_mode == "DDdag") {
137  } else if (m_mode == "H") {
140  } else {
141  vout.crucial(m_vl, "Error at %s: input mode is undefined.\n", class_name.c_str());
142  exit(EXIT_FAILURE);
143  }
144  }
145 
146 
147 //====================================================================
149  {
150  delete[] vcp1_xp;
151  delete[] vcp2_xp;
152  delete[] vcp1_xm;
153  delete[] vcp2_xm;
154 
155  delete[] vcp1_yp;
156  delete[] vcp2_yp;
157  delete[] vcp1_ym;
158  delete[] vcp2_ym;
159 
160  delete[] vcp1_zp;
161  delete[] vcp2_zp;
162  delete[] vcp1_zm;
163  delete[] vcp2_zm;
164 
165  delete[] vcp1_tp;
166  delete[] vcp2_tp;
167  delete[] vcp1_tm;
168  delete[] vcp2_tm;
169  }
170 
171 
172 //====================================================================
173  std::string Fopr_Wilson::get_mode() const
174  {
175  return m_mode;
176  }
177 
178 
179 //====================================================================
181  {
182  const string str_vlevel = params.get_string("verbose_level");
183 
184  m_vl = vout.set_verbose_level(str_vlevel);
185 
186  //- fetch and check input parameters
187  double kappa;
188  std::vector<int> bc;
189 
190  int err = 0;
191  err += params.fetch_double("hopping_parameter", kappa);
192  err += params.fetch_int_vector("boundary_condition", bc);
193 
194  if (err) {
195  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
196  exit(EXIT_FAILURE);
197  }
198 
199  set_parameters(kappa, bc);
200  }
201 
202 
203 //====================================================================
204  void Fopr_Wilson::set_parameters(const double kappa,
205  const std::vector<int> bc)
206  {
207  assert(bc.size() == m_Ndim);
208 
209  m_kappa = kappa;
210 
211  for (int mu = 0; mu < m_Ndim; ++mu) {
212  m_boundary[mu] = bc[mu];
213  }
214 
215  vout.general(m_vl, "%s: input parameters\n", class_name.c_str());
216  vout.general(m_vl, " kappa = %12.8f\n", m_kappa);
217  for (int mu = 0; mu < m_Ndim; ++mu) {
218  vout.general(m_vl, " boundary[%d] = %2d\n", mu, m_boundary[mu]);
219  }
220 
221  // boundary condition for each node:
222  for (int idir = 0; idir < m_Ndim; ++idir) {
223  m_boundary2[idir] = 1.0;
224  if (Communicator::ipe(idir) == 0) m_boundary2[idir] = m_boundary[idir];
225  }
226  }
227 
228 
229 //====================================================================
231  {
232  // The following counting explicitly depends on the implementation.
233  // It will be recalculated when the code is modified.
234  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
235 
236  int Lvol = CommonParameters::Lvol();
237  double flop_site, flop;
238 
239  if (m_repr == "Dirac") {
240  flop_site = static_cast<double>(
241  m_Nc * m_Nd * (4 + 6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
242  } else if (m_repr == "Chiral") {
243  flop_site = static_cast<double>(
244  m_Nc * m_Nd * (4 + 8 * (4 * m_Nc + 2)));
245  } else {
246  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n", class_name.c_str());
247  exit(EXIT_FAILURE);
248  }
249 
250  flop = flop_site * static_cast<double>(Lvol);
251 
252  if ((m_mode == "DdagD") || (m_mode == "DDdag")) flop *= 2.0;
253 
254  return flop;
255  }
256 
257 
258 //====================================================================
259  void Fopr_Wilson::D_dirac(Field& w, const Field& f)
260  {
261  D_ex_dirac(w, 0, f, 0);
262  }
263 
264 
265 //====================================================================
266  void Fopr_Wilson::D_chiral(Field& w, const Field& f)
267  {
268  D_ex_chiral(w, 0, f, 0);
269  }
270 
271 
272 //====================================================================
273  void Fopr_Wilson::mult_up(int mu,
274  Field& w, const Field& f)
275  {
276  if (mu == 0) {
277  mult_xp(w, f);
278  } else if (mu == 1) {
279  mult_yp(w, f);
280  } else if (mu == 2) {
281  mult_zp(w, f);
282  } else if (mu == 3) {
283  (this->*m_mult_tp)(w, f);
284  } else {
285  vout.crucial(m_vl, "Error at %s::mult_up: illegal mu=%d\n", class_name.c_str(), mu);
286  exit(EXIT_FAILURE);
287  }
288  }
289 
290 
291 //====================================================================
292  void Fopr_Wilson::mult_dn(int mu, Field& w, const Field& f)
293  {
294  if (mu == 0) {
295  mult_xm(w, f);
296  } else if (mu == 1) {
297  mult_ym(w, f);
298  } else if (mu == 2) {
299  mult_zm(w, f);
300  } else if (mu == 3) {
301  (this->*m_mult_tm)(w, f);
302  } else {
303  vout.crucial(m_vl, "Error at %s::mult_dn: illegal mu=%d\n", class_name.c_str(), mu);
304  exit(EXIT_FAILURE);
305  }
306  }
307 
308 
309 //====================================================================
310  void Fopr_Wilson::D_ex_dirac(Field& w, const int ex1,
311  const Field& f, const int ex2)
312  {
313  int Ninvol = m_Nvc * m_Nd * m_Nvol;
314  const double *v1 = f.ptr(Ninvol * ex2);
315  double *v2 = w.ptr(Ninvol * ex1);
316 
318  int i_thread = ThreadManager_OpenMP::get_thread_id();
319 
320  int is = m_Ntask * i_thread / Nthread;
321  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
322 
323  for (int i = is; i < is + ns; ++i) {
324  mult_xp1_thread(i, vcp1_xp, v1);
325  mult_xm1_thread(i, vcp1_xm, v1);
326  mult_yp1_thread(i, vcp1_yp, v1);
327  mult_ym1_thread(i, vcp1_ym, v1);
328  mult_zp1_thread(i, vcp1_zp, v1);
329  mult_zm1_thread(i, vcp1_zm, v1);
332  }
333 
334 #pragma omp barrier
335 #pragma omp master
336  {
337  int Nvx = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
338  Communicator::exchange(Nvx, vcp2_xp, vcp1_xp, 0, 1, 1);
339  Communicator::exchange(Nvx, vcp2_xm, vcp1_xm, 0, -1, 2);
340 
341  int Nvy = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
342  Communicator::exchange(Nvy, vcp2_yp, vcp1_yp, 1, 1, 3);
343  Communicator::exchange(Nvy, vcp2_ym, vcp1_ym, 1, -1, 4);
344 
345  int Nvz = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
346  Communicator::exchange(Nvz, vcp2_zp, vcp1_zp, 2, 1, 5);
347  Communicator::exchange(Nvz, vcp2_zm, vcp1_zm, 2, -1, 6);
348 
349  int Nvt = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
350  Communicator::exchange(Nvt, vcp2_tp, vcp1_tp, 3, 1, 7);
351  Communicator::exchange(Nvt, vcp2_tm, vcp1_tm, 3, -1, 8);
352  }
353 #pragma omp barrier
354 
355  for (int i = is; i < is + ns; ++i) {
356  clear_thread(i, v2);
357  mult_xpb_thread(i, v2, v1);
358  mult_xmb_thread(i, v2, v1);
359  mult_ypb_thread(i, v2, v1);
360  mult_ymb_thread(i, v2, v1);
361  mult_zpb_thread(i, v2, v1);
362  mult_zmb_thread(i, v2, v1);
363  mult_tpb_dirac_thread(i, v2, v1);
364  mult_tmb_dirac_thread(i, v2, v1);
365  }
366 
367  for (int i = is; i < is + ns; ++i) {
368  mult_xp2_thread(i, v2, vcp2_xp);
369  mult_xm2_thread(i, v2, vcp2_xm);
370  mult_yp2_thread(i, v2, vcp2_yp);
371  mult_ym2_thread(i, v2, vcp2_ym);
372  mult_zp2_thread(i, v2, vcp2_zp);
373  mult_zm2_thread(i, v2, vcp2_zm);
376  daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
377  }
378 
380  }
381 
382 
383 //====================================================================
384  void Fopr_Wilson::D_ex_chiral(Field& w, const int ex1,
385  const Field& f, const int ex2)
386  {
387  int Ninvol = m_Nvc * m_Nd * m_Nvol;
388  const double *v1 = f.ptr(Ninvol * ex2);
389  double *v2 = w.ptr(Ninvol * ex1);
390 
392  int i_thread = ThreadManager_OpenMP::get_thread_id();
393 
394  int is = m_Ntask * i_thread / Nthread;
395  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
396 
397  for (int i = is; i < is + ns; ++i) {
398  mult_xp1_thread(i, vcp1_xp, v1);
399  mult_xm1_thread(i, vcp1_xm, v1);
400  mult_yp1_thread(i, vcp1_yp, v1);
401  mult_ym1_thread(i, vcp1_ym, v1);
402  mult_zp1_thread(i, vcp1_zp, v1);
403  mult_zm1_thread(i, vcp1_zm, v1);
406  }
407 #pragma omp barrier
408 
409 #pragma omp master
410  {
411  int Nvx = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
412  Communicator::exchange(Nvx, vcp2_xp, vcp1_xp, 0, 1, 1);
413  Communicator::exchange(Nvx, vcp2_xm, vcp1_xm, 0, -1, 2);
414 
415  int Nvy = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
416  Communicator::exchange(Nvy, vcp2_yp, vcp1_yp, 1, 1, 3);
417  Communicator::exchange(Nvy, vcp2_ym, vcp1_ym, 1, -1, 4);
418 
419  int Nvz = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
420  Communicator::exchange(Nvz, vcp2_zp, vcp1_zp, 2, 1, 5);
421  Communicator::exchange(Nvz, vcp2_zm, vcp1_zm, 2, -1, 6);
422 
423  int Nvt = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
424  Communicator::exchange(Nvt, vcp2_tp, vcp1_tp, 3, 1, 7);
425  Communicator::exchange(Nvt, vcp2_tm, vcp1_tm, 3, -1, 8);
426  }
427 #pragma omp barrier
428 
429  for (int i = is; i < is + ns; ++i) {
430  clear_thread(i, v2);
431  mult_xpb_thread(i, v2, v1);
432  mult_xmb_thread(i, v2, v1);
433  mult_ypb_thread(i, v2, v1);
434  mult_ymb_thread(i, v2, v1);
435  mult_zpb_thread(i, v2, v1);
436  mult_zmb_thread(i, v2, v1);
437  mult_tpb_chiral_thread(i, v2, v1);
438  mult_tmb_chiral_thread(i, v2, v1);
439  }
440 
441  for (int i = is; i < is + ns; ++i) {
442  mult_xp2_thread(i, v2, vcp2_xp);
443  mult_xm2_thread(i, v2, vcp2_xm);
444  mult_yp2_thread(i, v2, vcp2_yp);
445  mult_ym2_thread(i, v2, vcp2_ym);
446  mult_zp2_thread(i, v2, vcp2_zp);
447  mult_zm2_thread(i, v2, vcp2_zm);
450  daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
451  }
452 
454 
455  /*
456  clear(w);
457  mult_xp(w,f);
458  mult_xm(w,f);
459  mult_yp(w,f);
460  mult_ym(w,f);
461  mult_zp(w,f);
462  mult_zm(w,f);
463  mult_tp_chiral(w,f);
464  mult_tm_chiral(w,f);
465  daypx(w, -m_kappa, f); // w = -m_kappa * w + f.
466  */
467  }
468 
469 
470 //====================================================================
472  Field& v, const Field& w)
473  {
474  clear(m_w2);
475 
476  mult_up(mu, m_w2, w);
477  mult_gm5(v, m_w2);
478  }
479 
480 
481 //====================================================================
482  void Fopr_Wilson::proj_chiral(Field& w, const int ex1,
483  const Field& v, const int ex2, const int ipm)
484  {
485  double fpm = 0.0;
486 
487  if (ipm == 1) {
488  fpm = 1.0;
489  } else if (ipm == -1) {
490  fpm = -1.0;
491  } else {
492  vout.crucial(m_vl, "Error at %s: illegal chirality = %d\n", class_name.c_str(), ipm);
493  exit(EXIT_FAILURE);
494  }
495 
496  m_w1.setpart_ex(0, v, ex2);
497  mult_gm5(m_w2, m_w1);
498  m_w1.addpart_ex(0, m_w2, 0, fpm);
499  w.setpart_ex(ex1, m_w1, 0);
500 
501 #pragma omp barrier
502  }
503 
504 
505 //====================================================================
507  double fac, const Field& f)
508  {
509  const double *v1 = f.ptr(0);
510  double *v2 = w.ptr(0);
511 
513  int i_thread = ThreadManager_OpenMP::get_thread_id();
514 
515  int is = m_Ntask * i_thread / Nthread;
516  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
517 
518  for (int i = is; i < is + ns; ++i) {
519  daypx_thread(i, v2, fac, v1);
520  }
521 #pragma omp barrier
522  }
523 
524 
525 //====================================================================
527  {
528  double *v2 = w.ptr(0);
529 
531  int i_thread = ThreadManager_OpenMP::get_thread_id();
532 
533  int is = m_Ntask * i_thread / Nthread;
534  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
535 
536  for (int i = is; i < is + ns; ++i) {
537  clear_thread(i, v2);
538  }
539 #pragma omp barrier
540  }
541 
542 
543 //====================================================================
544  void Fopr_Wilson::gm5_dirac(Field& w, const Field& f)
545  {
546  const double *v1 = f.ptr(0);
547  double *v2 = w.ptr(0);
548 
550  int i_thread = ThreadManager_OpenMP::get_thread_id();
551 
552  int is = m_Ntask * i_thread / Nthread;
553  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
554 
555  for (int i = is; i < is + ns; ++i) {
556  gm5_dirac_thread(i, v2, v1);
557  }
558 #pragma omp barrier
559  }
560 
561 
562 //====================================================================
564  {
565  const double *v1 = f.ptr(0);
566  double *v2 = w.ptr(0);
567 
569  int i_thread = ThreadManager_OpenMP::get_thread_id();
570 
571  int is = m_Ntask * i_thread / Nthread;
572  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
573 
574  for (int i = is; i < is + ns; ++i) {
575  gm5_chiral_thread(i, v2, v1);
576  }
577 #pragma omp barrier
578  }
579 
580 
581 //====================================================================
582  void Fopr_Wilson::mult_xp(Field& w, const Field& f)
583  {
584  const double *v1 = f.ptr(0);
585  double *v2 = w.ptr(0);
586 
588  int i_thread = ThreadManager_OpenMP::get_thread_id();
589 
590  int is = m_Ntask * i_thread / Nthread;
591  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
592 
593 #pragma omp barrier
594 
595  for (int i = is; i < is + ns; ++i) {
596  mult_xp1_thread(i, vcp1_xp, v1);
597  }
598 
599 #pragma omp barrier
600 #pragma omp master
601  {
602  int Nv = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
603  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
604  }
605 #pragma omp barrier
606 
607  for (int i = is; i < is + ns; ++i) {
608  mult_xpb_thread(i, v2, v1);
609  }
610 
611  for (int i = is; i < is + ns; ++i) {
612  mult_xp2_thread(i, v2, vcp2_xp);
613  }
614 
616  }
617 
618 
619 //====================================================================
620  void Fopr_Wilson::mult_xm(Field& w, const Field& f)
621  {
622  double *v2 = w.ptr(0);
623  const double *v1 = f.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 #pragma omp barrier
632 
633  for (int i = is; i < is + ns; ++i) {
634  mult_xm1_thread(i, vcp1_xm, v1);
635  }
636 
637 #pragma omp barrier
638 #pragma omp master
639  {
640  int Nv = m_Nvc * 2 * m_Ny * m_Nz * m_Nt;
641  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
642  }
643 #pragma omp barrier
644 
645  for (int i = is; i < is + ns; ++i) {
646  mult_xmb_thread(i, v2, v1);
647  }
648 
649  for (int i = is; i < is + ns; ++i) {
650  mult_xm2_thread(i, v2, vcp2_xm);
651  }
652 
654  }
655 
656 
657 //====================================================================
658  void Fopr_Wilson::mult_yp(Field& w, const Field& f)
659  {
660  const double *v1 = f.ptr(0);
661  double *v2 = w.ptr(0);
662 
664  int i_thread = ThreadManager_OpenMP::get_thread_id();
665 
666  int is = m_Ntask * i_thread / Nthread;
667  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
668 
669 #pragma omp barrier
670 
671  for (int i = is; i < is + ns; ++i) {
672  mult_yp1_thread(i, vcp1_yp, v1);
673  }
674 
675 #pragma omp barrier
676 #pragma omp master
677  {
678  int Nv = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
679  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
680  }
681 #pragma omp barrier
682 
683  for (int i = is; i < is + ns; ++i) {
684  mult_ypb_thread(i, v2, v1);
685  }
686 
687  for (int i = is; i < is + ns; ++i) {
688  mult_yp2_thread(i, v2, vcp2_yp);
689  }
690 
692  }
693 
694 
695 //====================================================================
696  void Fopr_Wilson::mult_ym(Field& w, const Field& f)
697  {
698  double *v2 = w.ptr(0);
699  const double *v1 = f.ptr(0);
700 
702  int i_thread = ThreadManager_OpenMP::get_thread_id();
703 
704  int is = m_Ntask * i_thread / Nthread;
705  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
706 
707 #pragma omp barrier
708 
709  for (int i = is; i < is + ns; ++i) {
710  mult_ym1_thread(i, vcp1_ym, v1);
711  }
712 
713 #pragma omp barrier
714 #pragma omp master
715  {
716  int Nv = m_Nvc * 2 * m_Nx * m_Nz * m_Nt;
717  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
718  }
719 #pragma omp barrier
720 
721  for (int i = is; i < is + ns; ++i) {
722  mult_ymb_thread(i, v2, v1);
723  }
724 
725  for (int i = is; i < is + ns; ++i) {
726  mult_ym2_thread(i, v2, vcp2_ym);
727  }
728 
730  }
731 
732 
733 //====================================================================
734  void Fopr_Wilson::mult_zp(Field& w, const Field& f)
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) {
748  mult_zp1_thread(i, vcp1_zp, v1);
749  }
750 
751 #pragma omp barrier
752 #pragma omp master
753  {
754  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
755  Communicator::exchange(Nv, vcp2_zp, vcp1_zp, 2, 1, 5);
756  }
757 #pragma omp barrier
758 
759  for (int i = is; i < is + ns; ++i) {
760  mult_zpb_thread(i, v2, v1);
761  }
762 
763  for (int i = is; i < is + ns; ++i) {
764  mult_zp2_thread(i, v2, vcp2_zp);
765  }
766 
768  }
769 
770 
771 //====================================================================
772  void Fopr_Wilson::mult_zm(Field& w, const Field& f)
773  {
774  double *v2 = w.ptr(0);
775  const double *v1 = f.ptr(0);
776 
778  int i_thread = ThreadManager_OpenMP::get_thread_id();
779 
780  int is = m_Ntask * i_thread / Nthread;
781  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
782 
783 #pragma omp barrier
784 
785  for (int i = is; i < is + ns; ++i) {
786  mult_zm1_thread(i, vcp1_zm, v1);
787  }
788 
789 #pragma omp barrier
790 #pragma omp master
791  {
792  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nt;
793  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
794  }
795 #pragma omp barrier
796 
797  for (int i = is; i < is + ns; ++i) {
798  mult_zmb_thread(i, v2, v1);
799  }
800 
801  for (int i = is; i < is + ns; ++i) {
802  mult_zm2_thread(i, v2, vcp2_zm);
803  }
804 
806  }
807 
808 
809 //====================================================================
811  {
812  const double *v1 = f.ptr(0);
813  double *v2 = w.ptr(0);
814 
816  int i_thread = ThreadManager_OpenMP::get_thread_id();
817 
818  int is = m_Ntask * i_thread / Nthread;
819  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
820 
821 #pragma omp barrier
822 
823  for (int i = is; i < is + ns; ++i) {
825  }
826 
827 #pragma omp barrier
828 #pragma omp master
829  {
830  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
831  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
832  }
833 #pragma omp barrier
834 
835  for (int i = is; i < is + ns; ++i) {
836  mult_tpb_dirac_thread(i, v2, v1);
837  }
838 
839  for (int i = is; i < is + ns; ++i) {
841  }
842 
844  }
845 
846 
847 //====================================================================
849  {
850  double *v2 = w.ptr(0);
851  const double *v1 = f.ptr(0);
852 
854  int i_thread = ThreadManager_OpenMP::get_thread_id();
855 
856  int is = m_Ntask * i_thread / Nthread;
857  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
858 
859 #pragma omp barrier
860 
861  for (int i = is; i < is + ns; ++i) {
863  }
864 
865 #pragma omp barrier
866 #pragma omp master
867  {
868  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
869  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
870  }
871 #pragma omp barrier
872 
873  for (int i = is; i < is + ns; ++i) {
874  mult_tmb_dirac_thread(i, v2, v1);
875  }
876 
877  for (int i = is; i < is + ns; ++i) {
879  }
880 
882  }
883 
884 
885 //====================================================================
887  {
888  const double *v1 = f.ptr(0);
889  double *v2 = w.ptr(0);
890 
892  int i_thread = ThreadManager_OpenMP::get_thread_id();
893 
894  int is = m_Ntask * i_thread / Nthread;
895  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
896 
897 #pragma omp barrier
898 
899  for (int i = is; i < is + ns; ++i) {
901  }
902 
903 #pragma omp barrier
904 #pragma omp master
905  {
906  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
907  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
908  }
909 #pragma omp barrier
910 
911  for (int i = is; i < is + ns; ++i) {
912  mult_tpb_chiral_thread(i, v2, v1);
913  }
914 
915  for (int i = is; i < is + ns; ++i) {
917  }
918 
920  }
921 
922 
923 //====================================================================
925  {
926  double *v2 = w.ptr(0);
927  const double *v1 = f.ptr(0);
928 
930  int i_thread = ThreadManager_OpenMP::get_thread_id();
931 
932  int is = m_Ntask * i_thread / Nthread;
933  int ns = m_Ntask * (i_thread + 1) / Nthread - is;
934 
935 #pragma omp barrier
936 
937  for (int i = is; i < is + ns; ++i) {
939  }
940 
941 #pragma omp barrier
942 #pragma omp master
943  {
944  int Nv = m_Nvc * 2 * m_Nx * m_Ny * m_Nz;
945  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
946  }
947 #pragma omp barrier
948 
949  for (int i = is; i < is + ns; ++i) {
950  mult_tmb_chiral_thread(i, v2, v1);
951  }
952 
953  for (int i = is; i < is + ns; ++i) {
955  }
956 
958  }
959 
960 
961 //====================================================================
962 }
963 //============================================================END=====
void mult_tp_dirac(Field &, const Field &)
void mult_zm1_thread(int, double *, const double *)
void mult_zpb_thread(int, double *, const double *)
void Ddag(Field &w, const Field &f)
void mult_ymb_thread(int, double *, const double *)
double flop_count()
returns the flops per site.
BridgeIO vout
Definition: bridgeIO.cpp:495
void mult_zp(Field &, const Field &)
void DDdag(Field &w, const Field &f)
void(Fopr_Wilson::* m_mult_dag)(Field &, const Field &)
static int get_num_threads()
returns available number of threads.
void mult_tp2_chiral_thread(int, double *, const double *)
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:142
std::string m_repr
void(Fopr_Wilson::* m_mult)(Field &, const Field &)
void proj_chiral(Field &w, const int ex1, const Field &v, const int ex2, const int ipm)
void(Fopr_Wilson::* m_gm5)(Field &, const Field &)
void mult_ym2_thread(int, double *, const double *)
void mult_zmb_thread(int, double *, const double *)
void D_dirac(Field &, const Field &)
void mult_xpb_thread(int, double *, const double *)
void(Fopr_Wilson::* m_mult_tp)(Field &, const Field &)
void general(const char *format,...)
Definition: bridgeIO.cpp:195
GammaMatrix get_GM(GMspecies spec)
void mult_yp(Field &, const Field &)
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
void gm5_chiral(Field &, const Field &)
void mult_tm1_chiral_thread(int, double *, const double *)
void mult_tm_chiral(Field &, const Field &)
void D(Field &v, const Field &f)
const Field_F mult_gm5p(int mu, const Field_F &w)
double * vcp1_xp
arrays for data transfer.
Bridge::VerboseLevel m_vl
void gm5_chiral_thread(int, double *, const double *)
void mult_ypb_thread(int, double *, const double *)
void gm5_dirac(Field &, const Field &)
void(Fopr_Wilson::* m_D_ex)(Field &, const int, const Field &, const int)
const Field_G * m_U
gauge configuration.
void mult_tm1_dirac_thread(int, double *, const double *)
Class for parameters.
Definition: parameters.h:46
void(Fopr_Wilson::* m_D)(Field &, const Field &)
static int ipe(const int dir)
logical coordinate of current proc.
void mult_xm(Field &, const Field &)
void set_parameters(const Parameters &params)
static int Lvol()
void mult_tp1_chiral_thread(int, double *, const double *)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:193
void gm5_dirac_thread(int, double *, const double *)
void mult_tmb_chiral_thread(int, double *, const double *)
static int get_thread_id()
returns thread id.
void mult_zp1_thread(int, double *, const double *)
void daypx(Field &, double, const Field &)
void mult_up(int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void mult_ym1_thread(int, double *, const double *)
void mult_tp_chiral(Field &, const Field &)
void daypx_thread(int, double *, double, const double *)
std::vector< int > m_boundary
boundary condition.
void D_chiral(Field &, const Field &)
void mult_xp1_thread(int, double *, const double *)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
Definition: field.h:84
void mult_tpb_chiral_thread(int, double *, const double *)
static void sync_barrier_all()
barrier among all the threads and nodes.
void mult_tm2_dirac_thread(int, double *, const double *)
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 init(std::string repr)
std::string m_mode
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
void mult_tm_dirac(Field &, const Field &)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void mult_zp2_thread(int, double *, const double *)
std::vector< double > m_boundary2
b.c. for each node.
void mult_undef(Field &, const Field &f)
void mult_tm2_chiral_thread(int, double *, const double *)
void mult_tp2_dirac_thread(int, double *, const double *)
void mult_ym(Field &, const Field &)
void mult_xm2_thread(int, double *, const double *)
void clear_thread(int, double *)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
void DdagD(Field &w, const Field &f)
void H(Field &w, const Field &f)
void mult_yp2_thread(int, double *, const double *)
void mult_xm1_thread(int, double *, const double *)
void(Fopr_Wilson::* m_mult_tm)(Field &, const Field &)
std::string get_mode() const
only for Fopr_Overlap
void mult_tpb_dirac_thread(int, double *, const double *)
void mult_xp(Field &, const Field &)
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:186
void mult_xmb_thread(int, double *, const double *)
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
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_zm(Field &, const Field &)
void mult_zm2_thread(int, double *, const double *)
void mult_dn(int mu, Field &, const Field &)
Field m_w2
temporary fields.
void mult_tp1_dirac_thread(int, double *, const double *)
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void mult_yp1_thread(int, double *, const double *)
void mult_tmb_dirac_thread(int, double *, const double *)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
static const std::string class_name
void mult_xp2_thread(int, double *, const double *)