Bridge++  Version 1.5.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
19 #elif defined USE_GROUP_SU2
21 #elif defined USE_GROUP_SU_N
23 #endif
24 
25  const std::string Fopr_WilsonGeneral::class_name = "Imp::Fopr_WilsonGeneral";
26 
27 #ifdef USE_FACTORY_AUTOREGISTER
28  namespace {
29  bool init = Fopr_WilsonGeneral::register_factory();
30  }
31 #endif
32 
33 //====================================================================
34  void Fopr_WilsonGeneral::init(const std::string repr)
35  {
37 
38  vout.general(m_vl, "%s: Construction of fermion operator(imp).\n", class_name.c_str());
39 
40  check_Nc();
41 
44  m_Nvc = 2 * m_Nc;
45  m_Ndf = 2 * m_Nc * m_Nc;
46 
51 
54  m_boundary.resize(m_Ndim);
56 
57  m_repr = repr;
58 
59  m_GM.resize(m_Ndim + 1);
60 
61  unique_ptr<GammaMatrixSet> gmset(GammaMatrixSet::New(m_repr));
62 
63  m_GM[0] = gmset->get_GM(GammaMatrixSet::GAMMA1);
64  m_GM[1] = gmset->get_GM(GammaMatrixSet::GAMMA2);
65  m_GM[2] = gmset->get_GM(GammaMatrixSet::GAMMA3);
66  m_GM[3] = gmset->get_GM(GammaMatrixSet::GAMMA4);
67  m_GM[4] = gmset->get_GM(GammaMatrixSet::GAMMA5);
68 
69  m_U = 0;
70 
73 
74  if (m_repr == "Dirac") {
80  } else if (m_repr == "Chiral") {
86  } else {
87  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n", class_name.c_str());
88  exit(EXIT_FAILURE);
89  }
90 
91  m_w1.reset(m_Nvc * m_Nd, m_Nvol, 1);
92  m_w2.reset(m_Nvc * m_Nd, m_Nvol, 1);
93 
94  const int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
95  vcp1_x_plus = new double[Nvx];
96  vcp2_x_plus = new double[Nvx];
97  vcp1_x_minus = new double[Nvx];
98  vcp2_x_minus = new double[Nvx];
99 
100  const int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
101  vcp1_y_plus = new double[Nvy];
102  vcp2_y_plus = new double[Nvy];
103  vcp1_y_minus = new double[Nvy];
104  vcp2_y_minus = new double[Nvy];
105 
106  const int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
107  vcp1_z_plus = new double[Nvz];
108  vcp2_z_plus = new double[Nvz];
109  vcp1_z_minus = new double[Nvz];
110  vcp2_z_minus = new double[Nvz];
111 
112  // const int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
113  const int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
114  vcp1_t_plus = new double[Nvt];
115  vcp2_t_plus = new double[Nvt];
116  vcp1_t_minus = new double[Nvt];
117  vcp2_t_minus = new double[Nvt];
118 
119  setup_thread();
120  }
121 
122 
123 //====================================================================
124  void Fopr_WilsonGeneral::set_mode(const std::string mode)
125  {
126  m_mode = mode;
127 
128  if (m_mode == "D") {
131  } else if (m_mode == "Ddag") {
134  } else if (m_mode == "DdagD") {
137  } else if (m_mode == "DDdag") {
140  } else if (m_mode == "H") {
143  } else {
144  vout.crucial(m_vl, "Error at %s: input mode is undefined.\n", class_name.c_str());
145  exit(EXIT_FAILURE);
146  }
147  }
148 
149 
150 //====================================================================
152  {
153  delete[] vcp1_x_plus;
154  delete[] vcp2_x_plus;
155  delete[] vcp1_x_minus;
156  delete[] vcp2_x_minus;
157 
158  delete[] vcp1_y_plus;
159  delete[] vcp2_y_plus;
160  delete[] vcp1_y_minus;
161  delete[] vcp2_y_minus;
162 
163  delete[] vcp1_z_plus;
164  delete[] vcp2_z_plus;
165  delete[] vcp1_z_minus;
166  delete[] vcp2_z_minus;
167 
168  delete[] vcp1_t_plus;
169  delete[] vcp2_t_plus;
170  delete[] vcp1_t_minus;
171  delete[] vcp2_t_minus;
172  }
173 
174 
175 //====================================================================
176  std::string Fopr_WilsonGeneral::get_mode() const
177  {
178  return m_mode;
179  }
180 
181 
182 //====================================================================
184  {
185  const string str_vlevel = params.get_string("verbose_level");
186 
187  m_vl = vout.set_verbose_level(str_vlevel);
188 
189  //- fetch and check input parameters
190  double kappa_s, kappa_t;
191  double nu_s, r_s;
192  std::vector<int> bc;
193 
194  int err = 0;
195  err += params.fetch_double("hopping_parameter_spatial", kappa_s);
196  err += params.fetch_double("hopping_parameter_temporal", kappa_t);
197  err += params.fetch_double("dispersion_parameter_spatial", nu_s);
198  err += params.fetch_double("Wilson_parameter_spatial", r_s);
199  err += params.fetch_int_vector("boundary_condition", bc);
200 
201  if (err) {
202  vout.crucial(m_vl, "Error at %s: input parameter not found.\n", class_name.c_str());
203  exit(EXIT_FAILURE);
204  }
205 
206  set_parameters(kappa_s, kappa_t, nu_s, r_s, bc);
207  }
208 
209 
210 //====================================================================
211  void Fopr_WilsonGeneral::set_parameters(const double kappa_s,
212  const double kappa_t,
213  const double nu_s,
214  const double r_s,
215  const std::vector<int> bc)
216  {
217  //- print input parameters
218  vout.general(m_vl, "%s: input parameters\n", class_name.c_str());
219  vout.general(m_vl, " kappa_s = %12.8f\n", kappa_s);
220  vout.general(m_vl, " kappa_t = %12.8f\n", kappa_t);
221  vout.general(m_vl, " nu_s = %12.8f\n", nu_s);
222  vout.general(m_vl, " r_s = %12.8f\n", r_s);
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,cSW == 0 is allowed.
229  assert(bc.size() == m_Ndim);
230 
231  //- store values
232  m_kappa_s = kappa_s;
233  m_kappa_t = kappa_t;
234  m_nu_s = nu_s;
235  m_r_s = r_s;
236 
237  // m_boundary.resize(m_Ndim); // already resized in init.
238  m_boundary = bc;
239 
240  for (int idir = 0; idir < m_Ndim; ++idir) {
241  m_boundary_each_node[idir] = 1.0;
242  if (Communicator::ipe(idir) == 0) m_boundary_each_node[idir] = m_boundary[idir];
243  }
244  }
245 
246 
247 //====================================================================
249  {
250  // D_ex_dirac(w, 0, f, 0);
251  // daypx(w, -m_kappa_s, f);
252 
253  clear(w);
254 
255  clear(m_w1);
256  for (int mu = 0; mu < (m_Ndim - 1); ++mu) {
257  mult_up(mu, m_w1, f);
258  mult_dn(mu, m_w1, f);
259  }
260  daxpy(w, -m_kappa_s, m_w1);
261 
262  clear(m_w1);
263  const int mu = (m_Ndim - 1);
264  {
265  mult_up(mu, m_w1, f);
266  mult_dn(mu, m_w1, f);
267  }
268  daxpy(w, -m_kappa_t, m_w1);
269 
270 
271  daxpy(w, 1.0, f); // w += f;
272  }
273 
274 
275 //====================================================================
277  {
278  // D_ex_chiral(w, 0, f, 0);
279  // daypx(w, -m_kappa_s, f);
280 
281  clear(w);
282 
283  clear(m_w1);
284  for (int mu = 0; mu < (m_Ndim - 1); ++mu) {
285  mult_up(mu, m_w1, f);
286  mult_dn(mu, m_w1, f);
287  }
288  daxpy(w, -m_kappa_s, m_w1);
289 
290  clear(m_w1);
291  const int mu = (m_Ndim - 1);
292  {
293  mult_up(mu, m_w1, f);
294  mult_dn(mu, m_w1, f);
295  }
296  daxpy(w, -m_kappa_t, m_w1);
297 
298 
299  daxpy(w, 1.0, f); // w += f;
300  }
301 
302 
303 //====================================================================
304  void Fopr_WilsonGeneral::mult_up(const int mu,
305  Field& w, const Field& f)
306  {
307  if (mu == 0) {
308  mult_x_plus(w, f);
309  } else if (mu == 1) {
310  mult_y_plus(w, f);
311  } else if (mu == 2) {
312  mult_z_plus(w, f);
313  } else if (mu == 3) {
314  (this->*m_mult_t_plus)(w, f);
315  } else {
316  vout.crucial(m_vl, "Error at %s: illegal mu=%d in mult_up.\n", class_name.c_str(), mu);
317  exit(EXIT_FAILURE);
318  }
319  }
320 
321 
322 //====================================================================
323  void Fopr_WilsonGeneral::mult_dn(const int mu,
324  Field& w, const Field& f)
325  {
326  if (mu == 0) {
327  mult_x_minus(w, f);
328  } else if (mu == 1) {
329  mult_y_minus(w, f);
330  } else if (mu == 2) {
331  mult_z_minus(w, f);
332  } else if (mu == 3) {
333  (this->*m_mult_t_minus)(w, f);
334  } else {
335  vout.crucial(m_vl, "Error at %s: illegal mu=%d in mult_dn.\n", class_name.c_str(), mu);
336  exit(EXIT_FAILURE);
337  }
338  }
339 
340 
341 //====================================================================
342  void Fopr_WilsonGeneral::D_ex_dirac(Field& w, const int ex1,
343  const Field& f, const int ex2)
344  {
345  const int Ninvol = m_Nvc * m_Nd * m_Nvol;
346  const double *v1 = f.ptr(Ninvol * ex2);
347  double *v2 = w.ptr(Ninvol * ex1);
348 
349  const int Nthread = ThreadManager_OpenMP::get_num_threads();
350  const int i_thread = ThreadManager_OpenMP::get_thread_id();
351 
352  const int is = m_Ntask * i_thread / Nthread;
353  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
354 
355  for (int i = is; i < is + ns; ++i) {
364  }
365 
366 #pragma omp barrier
367 #pragma omp master
368  {
369  const int idir_x = 0;
370  const int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
371  Communicator::exchange(Nvx, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
372  Communicator::exchange(Nvx, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
373 
374  const int idir_y = 1;
375  const int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
376  Communicator::exchange(Nvy, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
377  Communicator::exchange(Nvy, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
378 
379  const int idir_z = 2;
380  const int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
381  Communicator::exchange(Nvz, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
382  Communicator::exchange(Nvz, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
383 
384  const int idir_t = 3;
385  // const int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
386  const int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
387  Communicator::exchange(Nvt, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
388  Communicator::exchange(Nvt, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
389  }
390 #pragma omp barrier
391 
392  for (int i = is; i < is + ns; ++i) {
393  clear_thread(i, v2);
394 
395  mult_x_plus_bulk_thread(i, v2, v1);
396  mult_x_minus_bulk_thread(i, v2, v1);
397  mult_y_plus_bulk_thread(i, v2, v1);
398  mult_y_minus_bulk_thread(i, v2, v1);
399  mult_z_plus_bulk_thread(i, v2, v1);
400  mult_z_minus_bulk_thread(i, v2, v1);
403  }
404 
405  for (int i = is; i < is + ns; ++i) {
414  }
415 
416  // for (int i = is; i < is + ns; ++i) {
417  // daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
418  // daypx_thread(i, v2, -m_kappa_s, v1);
419  // }
420 
421 
423  }
424 
425 
426 //====================================================================
427  void Fopr_WilsonGeneral::D_ex_chiral(Field& w, const int ex1,
428  const Field& f, const int ex2)
429  {
430  const int Ninvol = m_Nvc * m_Nd * m_Nvol;
431  const double *v1 = f.ptr(Ninvol * ex2);
432  double *v2 = w.ptr(Ninvol * ex1);
433 
434  const int Nthread = ThreadManager_OpenMP::get_num_threads();
435  const int i_thread = ThreadManager_OpenMP::get_thread_id();
436 
437  const int is = m_Ntask * i_thread / Nthread;
438  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
439 
440  for (int i = is; i < is + ns; ++i) {
449  }
450 #pragma omp barrier
451 
452 #pragma omp master
453  {
454  const int idir_x = 0;
455  const int Nvx = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
456  Communicator::exchange(Nvx, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
457  Communicator::exchange(Nvx, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
458 
459  const int idir_y = 1;
460  const int Nvy = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
461  Communicator::exchange(Nvy, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
462  Communicator::exchange(Nvy, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
463 
464  const int idir_z = 2;
465  const int Nvz = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
466  Communicator::exchange(Nvz, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
467  Communicator::exchange(Nvz, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
468 
469  const int idir_t = 3;
470  // const int Nvt = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
471  const int Nvt = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
472  Communicator::exchange(Nvt, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
473  Communicator::exchange(Nvt, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
474  }
475 #pragma omp barrier
476 
477  for (int i = is; i < is + ns; ++i) {
478  clear_thread(i, v2);
479 
480  mult_x_plus_bulk_thread(i, v2, v1);
481  mult_x_minus_bulk_thread(i, v2, v1);
482  mult_y_plus_bulk_thread(i, v2, v1);
483  mult_y_minus_bulk_thread(i, v2, v1);
484  mult_z_plus_bulk_thread(i, v2, v1);
485  mult_z_minus_bulk_thread(i, v2, v1);
488  }
489 
490  for (int i = is; i < is + ns; ++i) {
499  }
500 
501  // for (int i = is; i < is + ns; ++i) {
502  // daypx_thread(i, v2, -m_kappa, v1); // w = -m_kappa * w + f.
503  // daypx_thread(i, v2, -m_kappa_s, v1); // w = -m_kappa * w + f.
504  // }
505 
506 
508 
509  // clear(w);
510  // mult_x_plus(w,f);
511  // mult_x_minus(w,f);
512  // mult_y_plus(w,f);
513  // mult_y_minus(w,f);
514  // mult_z_plus(w,f);
515  // mult_z_minus(w,f);
516  // mult_t_plus_chiral(w,f);
517  // mult_t_minus_chiral(w,f);
518  // daypx(w, -m_kappa, f); // w = -m_kappa * w + f.
519  }
520 
521 
522 //====================================================================
523  void Fopr_WilsonGeneral::mult_gm5p(const int mu,
524  Field& v, const Field& w)
525  {
526  clear(m_w2);
527 
528  mult_up(mu, m_w2, w);
529  mult_gm5(v, m_w2);
530  }
531 
532 
533 //====================================================================
534  void Fopr_WilsonGeneral::proj_chiral(Field& w, const int ex1,
535  const Field& v, const int ex2,
536  const int ipm)
537  {
538  double fpm = 0.0;
539 
540  if (ipm == 1) {
541  fpm = 1.0;
542  } else if (ipm == -1) {
543  fpm = -1.0;
544  } else {
545  vout.crucial(m_vl, "Error at %s: illegal chirality = %d.\n", class_name.c_str(), ipm);
546  exit(EXIT_FAILURE);
547  }
548 
549  m_w1.setpart_ex(0, v, ex2);
550  mult_gm5(m_w2, m_w1);
551  m_w1.addpart_ex(0, m_w2, 0, fpm);
552  w.setpart_ex(ex1, m_w1, 0);
553 
554 #pragma omp barrier
555  }
556 
557 
558 //====================================================================
560  const double fac, const Field& f)
561  {
562  const double *v1 = f.ptr(0);
563  double *v2 = w.ptr(0);
564 
565  const int Nthread = ThreadManager_OpenMP::get_num_threads();
566  const int i_thread = ThreadManager_OpenMP::get_thread_id();
567 
568  const int is = m_Ntask * i_thread / Nthread;
569  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
570 
571  for (int i = is; i < is + ns; ++i) {
572  daxpy_thread(i, v2, fac, v1);
573  }
574 #pragma omp barrier
575  }
576 
577 
578 //====================================================================
580  const double fac, const Field& f)
581  {
582  const double *v1 = f.ptr(0);
583  double *v2 = w.ptr(0);
584 
585  const int Nthread = ThreadManager_OpenMP::get_num_threads();
586  const int i_thread = ThreadManager_OpenMP::get_thread_id();
587 
588  const int is = m_Ntask * i_thread / Nthread;
589  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
590 
591  for (int i = is; i < is + ns; ++i) {
592  daypx_thread(i, v2, fac, v1);
593  }
594 #pragma omp barrier
595  }
596 
597 
598 //====================================================================
600  const double fac)
601  {
602  double *v2 = w.ptr(0);
603 
604  const int Nthread = ThreadManager_OpenMP::get_num_threads();
605  const int i_thread = ThreadManager_OpenMP::get_thread_id();
606 
607  const int is = m_Ntask * i_thread / Nthread;
608  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
609 
610  for (int i = is; i < is + ns; ++i) {
611  scal_thread(i, v2, fac);
612  }
613 #pragma omp barrier
614  }
615 
616 
617 //====================================================================
619  {
620  double *v2 = w.ptr(0);
621 
622  const int Nthread = ThreadManager_OpenMP::get_num_threads();
623  const int i_thread = ThreadManager_OpenMP::get_thread_id();
624 
625  const int is = m_Ntask * i_thread / Nthread;
626  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
627 
628  for (int i = is; i < is + ns; ++i) {
629  clear_thread(i, v2);
630  }
631 #pragma omp barrier
632  }
633 
634 
635 //====================================================================
637  {
638  const double *v1 = f.ptr(0);
639  double *v2 = w.ptr(0);
640 
641  const int Nthread = ThreadManager_OpenMP::get_num_threads();
642  const int i_thread = ThreadManager_OpenMP::get_thread_id();
643 
644  const int is = m_Ntask * i_thread / Nthread;
645  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
646 
647  for (int i = is; i < is + ns; ++i) {
648  gm5_dirac_thread(i, v2, v1);
649  }
650 #pragma omp barrier
651  }
652 
653 
654 //====================================================================
656  {
657  const double *v1 = f.ptr(0);
658  double *v2 = w.ptr(0);
659 
660  const int Nthread = ThreadManager_OpenMP::get_num_threads();
661  const int i_thread = ThreadManager_OpenMP::get_thread_id();
662 
663  const int is = m_Ntask * i_thread / Nthread;
664  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
665 
666  for (int i = is; i < is + ns; ++i) {
667  gm5_chiral_thread(i, v2, v1);
668  }
669 #pragma omp barrier
670  }
671 
672 
673 //====================================================================
675  {
676  const double *v1 = f.ptr(0);
677  double *v2 = w.ptr(0);
678 
679  const int Nthread = ThreadManager_OpenMP::get_num_threads();
680  const int i_thread = ThreadManager_OpenMP::get_thread_id();
681 
682  const int is = m_Ntask * i_thread / Nthread;
683  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
684 
685 #pragma omp barrier
686 
687  for (int i = is; i < is + ns; ++i) {
689  }
690 
691 #pragma omp barrier
692 #pragma omp master
693  {
694  const int idir_x = 0;
695  const int Nv = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
696  Communicator::exchange(Nv, vcp2_x_plus, vcp1_x_plus, idir_x, 1, 1);
697  }
698 #pragma omp barrier
699 
700  for (int i = is; i < is + ns; ++i) {
701  mult_x_plus_bulk_thread(i, v2, v1);
702  }
703 
704  for (int i = is; i < is + ns; ++i) {
706  }
707 
709  }
710 
711 
712 //====================================================================
714  {
715  const double *v1 = f.ptr(0);
716  double *v2 = w.ptr(0);
717 
718  const int Nthread = ThreadManager_OpenMP::get_num_threads();
719  const int i_thread = ThreadManager_OpenMP::get_thread_id();
720 
721  const int is = m_Ntask * i_thread / Nthread;
722  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
723 
724 #pragma omp barrier
725 
726  for (int i = is; i < is + ns; ++i) {
728  }
729 
730 #pragma omp barrier
731 #pragma omp master
732  {
733  const int idir_x = 0;
734  const int Nv = 2 * m_Nvc * m_Nd * m_Ny * m_Nz * m_Nt;
735  Communicator::exchange(Nv, vcp2_x_minus, vcp1_x_minus, idir_x, -1, 2);
736  }
737 #pragma omp barrier
738 
739  for (int i = is; i < is + ns; ++i) {
740  mult_x_minus_bulk_thread(i, v2, v1);
741  }
742 
743  for (int i = is; i < is + ns; ++i) {
745  }
746 
748  }
749 
750 
751 //====================================================================
753  {
754  const double *v1 = f.ptr(0);
755  double *v2 = w.ptr(0);
756 
757  const int Nthread = ThreadManager_OpenMP::get_num_threads();
758  const int i_thread = ThreadManager_OpenMP::get_thread_id();
759 
760  const int is = m_Ntask * i_thread / Nthread;
761  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
762 
763 #pragma omp barrier
764 
765  for (int i = is; i < is + ns; ++i) {
767  }
768 
769 #pragma omp barrier
770 #pragma omp master
771  {
772  const int idir_y = 1;
773  const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
774  Communicator::exchange(Nv, vcp2_y_plus, vcp1_y_plus, idir_y, 1, 3);
775  }
776 #pragma omp barrier
777 
778  for (int i = is; i < is + ns; ++i) {
779  mult_y_plus_bulk_thread(i, v2, v1);
780  }
781 
782  for (int i = is; i < is + ns; ++i) {
784  }
785 
787  }
788 
789 
790 //====================================================================
792  {
793  const double *v1 = f.ptr(0);
794  double *v2 = w.ptr(0);
795 
796  const int Nthread = ThreadManager_OpenMP::get_num_threads();
797  const int i_thread = ThreadManager_OpenMP::get_thread_id();
798 
799  const int is = m_Ntask * i_thread / Nthread;
800  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
801 
802 #pragma omp barrier
803 
804  for (int i = is; i < is + ns; ++i) {
806  }
807 
808 #pragma omp barrier
809 #pragma omp master
810  {
811  const int idir_y = 1;
812  const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Nz * m_Nt;
813  Communicator::exchange(Nv, vcp2_y_minus, vcp1_y_minus, idir_y, -1, 4);
814  }
815 #pragma omp barrier
816 
817  for (int i = is; i < is + ns; ++i) {
818  mult_y_minus_bulk_thread(i, v2, v1);
819  }
820 
821  for (int i = is; i < is + ns; ++i) {
823  }
824 
826  }
827 
828 
829 //====================================================================
831  {
832  const double *v1 = f.ptr(0);
833  double *v2 = w.ptr(0);
834 
835  const int Nthread = ThreadManager_OpenMP::get_num_threads();
836  const int i_thread = ThreadManager_OpenMP::get_thread_id();
837 
838  const int is = m_Ntask * i_thread / Nthread;
839  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
840 
841 #pragma omp barrier
842 
843  for (int i = is; i < is + ns; ++i) {
845  }
846 
847 #pragma omp barrier
848 #pragma omp master
849  {
850  const int idir_z = 2;
851  const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
852  Communicator::exchange(Nv, vcp2_z_plus, vcp1_z_plus, idir_z, 1, 5);
853  }
854 #pragma omp barrier
855 
856  for (int i = is; i < is + ns; ++i) {
857  mult_z_plus_bulk_thread(i, v2, v1);
858  }
859 
860  for (int i = is; i < is + ns; ++i) {
862  }
863 
865  }
866 
867 
868 //====================================================================
870  {
871  const double *v1 = f.ptr(0);
872  double *v2 = w.ptr(0);
873 
874  const int Nthread = ThreadManager_OpenMP::get_num_threads();
875  const int i_thread = ThreadManager_OpenMP::get_thread_id();
876 
877  const int is = m_Ntask * i_thread / Nthread;
878  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
879 
880 #pragma omp barrier
881 
882  for (int i = is; i < is + ns; ++i) {
884  }
885 
886 #pragma omp barrier
887 #pragma omp master
888  {
889  const int idir_z = 2;
890  const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nt;
891  Communicator::exchange(Nv, vcp2_z_minus, vcp1_z_minus, idir_z, -1, 6);
892  }
893 #pragma omp barrier
894 
895  for (int i = is; i < is + ns; ++i) {
896  mult_z_minus_bulk_thread(i, v2, v1);
897  }
898 
899  for (int i = is; i < is + ns; ++i) {
901  }
902 
904  }
905 
906 
907 //====================================================================
909  {
910  const double *v1 = f.ptr(0);
911  double *v2 = w.ptr(0);
912 
913  const int Nthread = ThreadManager_OpenMP::get_num_threads();
914  const int i_thread = ThreadManager_OpenMP::get_thread_id();
915 
916  const int is = m_Ntask * i_thread / Nthread;
917  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
918 
919 #pragma omp barrier
920 
921  for (int i = is; i < is + ns; ++i) {
923  }
924 
925 #pragma omp barrier
926 #pragma omp master
927  {
928  const int idir_t = 3;
929  // const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
930  const int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
931  Communicator::exchange(Nv, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
932  }
933 #pragma omp barrier
934 
935  for (int i = is; i < is + ns; ++i) {
937  }
938 
939  for (int i = is; i < is + ns; ++i) {
941  }
942 
944  }
945 
946 
947 //====================================================================
949  {
950  const double *v1 = f.ptr(0);
951  double *v2 = w.ptr(0);
952 
953  const int Nthread = ThreadManager_OpenMP::get_num_threads();
954  const int i_thread = ThreadManager_OpenMP::get_thread_id();
955 
956  const int is = m_Ntask * i_thread / Nthread;
957  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
958 
959 #pragma omp barrier
960 
961  for (int i = is; i < is + ns; ++i) {
963  }
964 
965 #pragma omp barrier
966 #pragma omp master
967  {
968  const int idir_t = 3;
969  // const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
970  const int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
971  Communicator::exchange(Nv, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
972  }
973 #pragma omp barrier
974 
975  for (int i = is; i < is + ns; ++i) {
977  }
978 
979  for (int i = is; i < is + ns; ++i) {
981  }
982 
984  }
985 
986 
987 //====================================================================
989  {
990  const double *v1 = f.ptr(0);
991  double *v2 = w.ptr(0);
992 
993  const int Nthread = ThreadManager_OpenMP::get_num_threads();
994  const int i_thread = ThreadManager_OpenMP::get_thread_id();
995 
996  const int is = m_Ntask * i_thread / Nthread;
997  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
998 
999 #pragma omp barrier
1000 
1001  for (int i = is; i < is + ns; ++i) {
1003  }
1004 
1005 #pragma omp barrier
1006 #pragma omp master
1007  {
1008  const int idir_t = 3;
1009  // const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1010  const int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1011  Communicator::exchange(Nv, vcp2_t_plus, vcp1_t_plus, idir_t, 1, 7);
1012  }
1013 #pragma omp barrier
1014 
1015  for (int i = is; i < is + ns; ++i) {
1016  mult_t_plus_bulk_chiral_thread(i, v2, v1);
1017  }
1018 
1019  for (int i = is; i < is + ns; ++i) {
1021  }
1022 
1024  }
1025 
1026 
1027 //====================================================================
1029  {
1030  const double *v1 = f.ptr(0);
1031  double *v2 = w.ptr(0);
1032 
1033  const int Nthread = ThreadManager_OpenMP::get_num_threads();
1034  const int i_thread = ThreadManager_OpenMP::get_thread_id();
1035 
1036  const int is = m_Ntask * i_thread / Nthread;
1037  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
1038 
1039 #pragma omp barrier
1040 
1041  for (int i = is; i < is + ns; ++i) {
1043  }
1044 
1045 #pragma omp barrier
1046 #pragma omp master
1047  {
1048  const int idir_t = 3;
1049  // const int Nv = 2 * m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1050  const int Nv = m_Nvc * m_Nd * m_Nx * m_Ny * m_Nz;
1051  Communicator::exchange(Nv, vcp2_t_minus, vcp1_t_minus, idir_t, -1, 8);
1052  }
1053 #pragma omp barrier
1054 
1055  for (int i = is; i < is + ns; ++i) {
1057  }
1058 
1059  for (int i = is; i < is + ns; ++i) {
1061  }
1062 
1064  }
1065 
1066 
1067 //====================================================================
1069  {
1070  // Counting of floating point operations in giga unit.
1071  // The following counting explicitly depends on the implementation.
1072  // It will be recalculated when the code is modified.
1073  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
1074 
1075  const int Nvol = CommonParameters::Nvol();
1076  const int NPE = CommonParameters::NPE();
1077 
1078  int flop_site;
1079 
1080  if (m_repr == "Dirac") {
1081  flop_site = m_Nc * m_Nd * (4 + 6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1));
1082  } else if (m_repr == "Chiral") {
1083  flop_site = m_Nc * m_Nd * (4 + 8 * (4 * m_Nc + 2));
1084  } else {
1085  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
1086  class_name.c_str());
1087  exit(EXIT_FAILURE);
1088  }
1089 
1090  double gflop = flop_site * (Nvol * (NPE / 1.0e+9));
1091 
1092  if ((m_mode == "DdagD") || (m_mode == "DDdag")) gflop *= 2;
1093 
1094  return gflop;
1095  }
1096 
1097 
1098 //====================================================================
1099 }
1100 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
void(Fopr_WilsonGeneral::* m_mult_t_plus)(Field &, const Field &)
void mult_x_minus2_thread(const int, double *, const double *)
static int get_num_threads()
returns available number of threads.
void mult_z_minus_bulk_thread(const int, double *, const double *)
void DDdag(Field &w, const Field &f)
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:153
void mult_x_plus_bulk_thread(const int, double *, const double *)
double * vcp1_x_plus
arrays for data transfer.
void clear_thread(const int, double *)
void D_dirac(Field &, const Field &)
void mult_x_plus2_thread(const int, double *, const double *)
void mult_z_minus1_thread(const int, double *, const double *)
void general(const char *format,...)
Definition: bridgeIO.cpp:197
GammaMatrix get_GM(GMspecies spec)
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
void mult_t_minus2_chiral_thread(const int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult)(Field &, const Field &)
static Bridge::VerboseLevel Vlevel()
void mult_z_minus2_thread(const int, double *, const double *)
Container of Field-type object.
Definition: field.h:45
void H(Field &w, const Field &f)
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
void mult_t_plus1_dirac_thread(const int, double *, const double *)
void mult_t_plus_dirac(Field &, const Field &)
std::string get_mode() const
only for Fopr_Overlap
void mult_t_plus2_dirac_thread(const int, double *, const double *)
void mult_x_plus(Field &, const Field &)
void mult_dn(const int mu, Field &, const Field &)
void mult_y_plus2_thread(const int, double *, const double *)
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_x_minus_bulk_thread(const int, double *, const double *)
void mult_x_plus1_thread(const 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 flop in giga unit
void mult_t_minus2_dirac_thread(const int, double *, const double *)
void addpart_ex(int ex, const Field &w, int exw)
Definition: field.h:204
void gm5_dirac_thread(const int, double *, const double *)
static int get_thread_id()
returns thread id.
void mult_y_minus2_thread(const int, double *, const double *)
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_t_minus_dirac(Field &, const Field &)
void mult_t_minus1_dirac_thread(const int, double *, const double *)
void init(const std::string repr)
void mult_z_plus2_thread(const int, double *, const double *)
void DdagD(Field &w, const Field &f)
void daypx_thread(const int, double *, const double, const double *)
void mult_y_minus(Field &, const Field &)
void daxpy_thread(const int, double *, const double, const double *)
void scal_thread(const int, double *, const double)
void mult_undef(Field &, const Field &f)
void gm5_chiral_thread(const int, double *, const double *)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
void mult_z_plus_bulk_thread(const int, double *, const double *)
const Field_G * m_U
gauge configuration.
void mult_y_minus1_thread(const int, double *, const double *)
Field m_w2
temporary fields.
void mult_z_plus1_thread(const int, double *, const double *)
static void sync_barrier_all()
barrier among all the threads and nodes.
void mult_x_minus(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 daypx(Field &, const double, const Field &)
void mult_t_minus1_chiral_thread(const int, double *, const double *)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void(Fopr_WilsonGeneral::* m_mult_dag)(Field &, const Field &)
void mult_x_minus1_thread(const int, double *, const double *)
const Field_F mult_gm5p(const int mu, const Field_F &w)
void mult_y_plus(Field &, const Field &)
void mult_t_plus_bulk_chiral_thread(const int, double *, const double *)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
std::vector< double > m_boundary_each_node
b.c. for each node.
void mult_y_plus_bulk_thread(const int, double *, const double *)
void daxpy(Field &, const double, const Field &)
void(Fopr_WilsonGeneral::* m_mult_t_minus)(Field &, const Field &)
void(Fopr_WilsonGeneral::* m_D_ex)(Field &, const int, const Field &, const int)
void mult_t_minus_bulk_dirac_thread(const int, double *, const double *)
void mult_t_minus_bulk_chiral_thread(const int, double *, const double *)
static const std::string class_name
void gm5_chiral(Field &, const Field &)
void set_parameters(const Parameters &params)
void mult_t_plus1_chiral_thread(const 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_t_plus2_chiral_thread(const int, double *, const double *)
void(Fopr_WilsonGeneral::* m_gm5)(Field &, const Field &)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
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:197
string get_string(const string &key) const
Definition: parameters.cpp:221
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
void scal(Field &, const double)
void mult_t_plus_bulk_dirac_thread(const 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_y_minus_bulk_thread(const int, double *, const double *)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void mult_up(const int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void mult_y_plus1_thread(const int, double *, const double *)
void D_chiral(Field &, const Field &)