Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_eo_impl.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_eo_impl.h"
15 
17 
18 namespace Imp {
19 //====================================================================
20  const std::string Fopr_Wilson_eo::class_name = "Imp::Fopr_Wilson_eo";
21 
22 #ifdef USE_FACTORY_AUTOREGISTER
23  namespace {
24  bool init = Fopr_Wilson_eo::register_factory();
25  }
26 #endif
27 
28 //====================================================================
29  void Fopr_Wilson_eo::init(const std::string repr)
30  {
31  m_repr = repr;
32 
34 
37  m_Nvc = 2 * m_Nc;
38  m_Ndf = 2 * m_Nc * m_Nc;
39  const int Nvcd = m_Nvc * m_Nd;
40 
42  m_Nvol2 = m_Nvol / 2;
44 
49 
50  if ((m_Nx % 2) != 0) {
51  vout.crucial(m_vl, "Error at %s: Nx=%d must be even.\n", class_name.c_str(), m_Nx);
52  exit(EXIT_FAILURE);
53  }
54  m_Nx2 = m_Nx / 2;
55 
56  if ((m_Ny % 2) != 0) {
57  vout.crucial(m_vl, "Error at %s: Ny=%d must be even.\n", class_name.c_str(), m_Ny);
58  exit(EXIT_FAILURE);
59  }
60 
63  m_boundary.resize(m_Ndim);
65 
66  m_yzt_eo.resize(m_Ny * m_Nz * m_Nt);
67 
68  for (int t = 0; t < m_Nt; ++t) {
69  for (int z = 0; z < m_Nz; ++z) {
70  for (int y = 0; y < m_Ny; ++y) {
71  int t_global = t + Communicator::ipe(3) * m_Nt;
72  int z_global = z + Communicator::ipe(2) * m_Nz;
73  int y_global = y + Communicator::ipe(1) * m_Ny;
74 
75  m_yzt_eo[y + m_Ny * (z + m_Nz * t)] = (y_global + z_global + t_global) % 2;
76  }
77  }
78  }
79 
80  m_Ueo = new Field_G(m_Nvol, m_Ndim);
81 
82  if (m_repr == "Dirac") {
87  } else if (m_repr == "Chiral") {
92  } else {
93  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
94  class_name.c_str());
95  exit(EXIT_FAILURE);
96  }
97 
98  const int Nvx = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
99  vcp1_xp = new double[Nvx];
100  vcp2_xp = new double[Nvx];
101  vcp1_xm = new double[Nvx];
102  vcp2_xm = new double[Nvx];
103 
104  const int Nvy = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
105  vcp1_yp = new double[Nvy];
106  vcp2_yp = new double[Nvy];
107  vcp1_ym = new double[Nvy];
108  vcp2_ym = new double[Nvy];
109 
110  const int Nvz = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
111  vcp1_zp = new double[Nvz];
112  vcp2_zp = new double[Nvz];
113  vcp1_zm = new double[Nvz];
114  vcp2_zm = new double[Nvz];
115 
116  const int Nvt = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
117  vcp1_tp = new double[Nvt];
118  vcp2_tp = new double[Nvt];
119  vcp1_tm = new double[Nvt];
120  vcp2_tm = new double[Nvt];
121 
122  m_v1.reset(Nvcd, m_Nvol2, 1);
123  m_v2.reset(Nvcd, m_Nvol2, 1);
124  m_w1.reset(Nvcd, m_Nvol2, 1);
125  m_w2.reset(Nvcd, m_Nvol2, 1);
126 
127  setup_thread();
128  }
129 
130 
131 //====================================================================
133  {
134  delete m_Ueo;
135 
136  delete[] vcp1_xp;
137  delete[] vcp2_xp;
138  delete[] vcp1_xm;
139  delete[] vcp2_xm;
140 
141  delete[] vcp1_yp;
142  delete[] vcp2_yp;
143  delete[] vcp1_ym;
144  delete[] vcp2_ym;
145 
146  delete[] vcp1_zp;
147  delete[] vcp2_zp;
148  delete[] vcp1_zm;
149  delete[] vcp2_zm;
150 
151  delete[] vcp1_tp;
152  delete[] vcp2_tp;
153  delete[] vcp1_tm;
154  delete[] vcp2_tm;
155  }
156 
157 
158 //====================================================================
160  {
161  const string str_vlevel = params.get_string("verbose_level");
162 
163  m_vl = vout.set_verbose_level(str_vlevel);
164 
165  //- fetch and check input parameters
166  double kappa;
167  std::vector<int> bc;
168 
169  int err = 0;
170  err += params.fetch_double("hopping_parameter", kappa);
171  err += params.fetch_int_vector("boundary_condition", bc);
172 
173  if (err) {
174  vout.crucial(m_vl, "Error at %s: fetch error, input parameter not found.\n", class_name.c_str());
175  exit(EXIT_FAILURE);
176  }
177 
178  set_parameters(kappa, bc);
179  }
180 
181 
182 //====================================================================
184  const double kappa,
185  const std::vector<int> bc)
186  {
187  //- print input parameters
188  vout.general(m_vl, "%s:\n", class_name.c_str());
189  vout.general(m_vl, " kappa = %12.8f\n", kappa);
190  for (int mu = 0; mu < m_Ndim; ++mu) {
191  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
192  }
193 
194  //- range check
195  // NB. kappa = 0 is allowed.
196  assert(bc.size() == m_Ndim);
197 
198  //- store values
199  m_kappa = kappa;
200 
201  // m_boundary.resize(m_Ndim); // already resized in init.
202  m_boundary = bc;
203 
204  for (int idir = 0; idir < m_Ndim; ++idir) {
205  m_boundary_each_node[idir] = 1.0;
206  if (Communicator::ipe(idir) == 0) m_boundary_each_node[idir] = m_boundary[idir];
207  }
208  }
209 
210 
211 //====================================================================
213  {
214  m_index.convertField(*m_Ueo, *U);
215  m_U = m_Ueo;
216  }
217 
218 
219 //====================================================================
220  void Fopr_Wilson_eo::set_mode(std::string mode)
221  {
222  m_mode = mode;
223 
224  if (m_mode == "D") {
229  } else if (m_mode == "Ddag") {
234  } else if (m_mode == "DdagD") {
237  } else if (m_mode == "DDdag") {
240  } else if (m_mode == "H") {
243  } else {
244  vout.crucial("Error at %s: input mode is undefined.\n", class_name.c_str());
245  exit(EXIT_FAILURE);
246  }
247  }
248 
249 
250 //====================================================================
251  std::string Fopr_Wilson_eo::get_mode() const
252  {
253  return m_mode;
254  }
255 
256 
257 //====================================================================
259  const Field& b)
260  {
261  const int Nin = b.nin();
262  const int Nex = b.nex();
263 
264  Field be(Nin, m_Nvol2, Nex);
265 
266  m_index.convertField(be, b, 0);
267  m_index.convertField(bo, b, 1);
268 
269  Be.reset(Nin, m_Nvol2, Nex);
270 
271  // Be = be - (Field)Meo(bo, 0);
272  copy(Be, be);
273 
274  Field_F v1(m_Nvol2, Nex);
275  Meo(v1, bo, 0);
276 
277  axpy(Be, -1.0, v1);
278 
279 #pragma omp barrier
280  }
281 
282 
283 //====================================================================
285  const Field& xe, const Field& bo)
286  {
287  const int Nin = xe.nin();
288  const int Nex = xe.nex();
289 
290  Field xo(Nin, m_Nvol2, Nex);
291 
292  copy(xo, bo);
293 
294  Field_F v1(m_Nvol2, Nex);
295  Meo(v1, xe, 1);
296  axpy(xo, -1.0, v1);
297 
298  x.reset(Nin, m_Nvol2 * 2, Nex);
299  m_index.reverseField(x, xe, 0);
300  m_index.reverseField(x, xo, 1);
301 
302 #pragma omp barrier
303  }
304 
305 
306 //====================================================================
308  Field& bo, const Field& b)
309  {
310  const int Nin = b.nin();
311  const int Nex = b.nex();
312 
313  Field be(Nin, m_Nvol2, Nex);
314 
315  m_index.convertField(be, b, 0);
316  m_index.convertField(bo, b, 1);
317 
318  Be.reset(Nin, m_Nvol2, Nex);
319 
320  copy(Be, be);
321 
322  Field_F v1(m_Nvol2, Nex);
323  Mdageo(v1, bo, 0);
324 
325  axpy(Be, -1.0, v1);
326 
327 #pragma omp barrier
328  }
329 
330 
331 //====================================================================
333  const Field& xe, const Field& bo)
334  {
335  const int Nin = xe.nin();
336  const int Nex = xe.nex();
337 
338  Field xo(Nin, m_Nvol2, Nex);
339 
340  copy(xo, bo);
341 
342  Field_F v1(m_Nvol2, Nex);
343  Mdageo(v1, xe, 1);
344  axpy(xo, -1.0, v1);
345 
346  x.reset(Nin, m_Nvol2 * 2, Nex);
347  m_index.reverseField(x, xe, 0);
348  m_index.reverseField(x, xo, 1);
349 
350 #pragma omp barrier
351  }
352 
353 
354 //====================================================================
355  void Fopr_Wilson_eo::DdagD(Field& v, const Field& f)
356  {
357  D(m_w1, f);
358  Ddag(v, m_w1);
359  }
360 
361 
362 //====================================================================
363  void Fopr_Wilson_eo::DDdag(Field& v, const Field& f)
364  {
365  Ddag(m_w1, f);
366  D(v, m_w1);
367  }
368 
369 
370 //====================================================================
371  void Fopr_Wilson_eo::H(Field& v, const Field& f)
372  {
373  D(v, f);
374  mult_gm5(v);
375  }
376 
377 
378 //====================================================================
379  void Fopr_Wilson_eo::MeoMoe(Field& v, const Field& f)
380  {
381  Meo(m_w1, f, 1);
382  Meo(m_w2, m_w1, 0);
383  axpy(v, -1.0, m_w2);
384 
385 #pragma omp barrier
386  }
387 
388 
389 //====================================================================
390  void Fopr_Wilson_eo::D(Field& v, const Field& f)
391  {
392  assert(f.nex() == 1);
393 
394  Meo(m_v1, f, 1);
395  Meo(v, m_v1, 0);
396  aypx(-1.0, v, f);
397 
398 #pragma omp barrier
399  }
400 
401 
402 //====================================================================
403  void Fopr_Wilson_eo::Ddag(Field& v, const Field& f)
404  {
405  Mdageo(m_v1, f, 1);
406  Mdageo(v, m_v1, 0);
407  aypx(-1.0, v, f);
408 
409 #pragma omp barrier
410  }
411 
412 
413 //====================================================================
415  const Field& f, const int ieo)
416  {
417 #pragma omp barrier
418 
419  // clear_impl(w); // w = 0.0;
420  w.set(0.0); // w = 0.0;
421 
422  mult_xp(w, f, ieo);
423  mult_xm(w, f, ieo);
424 
425  mult_yp(w, f, ieo);
426  mult_ym(w, f, ieo);
427 
428  mult_zp(w, f, ieo);
429  mult_zm(w, f, ieo);
430 
431  (this->*m_mult_tp)(w, f, ieo);
432  (this->*m_mult_tm)(w, f, ieo);
433 
434  scal(w, -m_kappa); // w *= -m_kappa; using Field function.
435  // scal_impl(w, -m_kappa); // w *= -m_kappa;
436 
438  }
439 
440 
441 //====================================================================
443  const Field& f, const int ieo)
444  {
445  // Field_F v(m_Nvol2, f.nex());
446  // mult_gm5(v, (Field)f);
447  // Meo_gm5(w, v, ieo);
448 
449  mult_gm5(m_v2, f);
450  Meo(w, m_v2, ieo);
451  mult_gm5(w);
452  }
453 
454 
455 //====================================================================
457  const Field& f, const int ieo)
458  {
459  Meo(v, f, ieo);
460  mult_gm5(v);
461  }
462 
463 
464 //====================================================================
466  {
467  (this->*m_gm5)(w, f);
468  }
469 
470 
471 //====================================================================
473  {
474  (this->*m_gm5_self)(w);
475  }
476 
477 
478 //====================================================================
480  const Field& f)
481  {
482  const double *v1 = f.ptr(0);
483  double *v2 = w.ptr(0);
484 
485  const int Nthread = ThreadManager_OpenMP::get_num_threads();
486  const int i_thread = ThreadManager_OpenMP::get_thread_id();
487 
488  const int is = m_Ntask * i_thread / Nthread;
489  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
490 
491  for (int i = is; i < is + ns; ++i) {
492  gm5_dirac_thread(i, v2, v1);
493  }
494 #pragma omp barrier
495  }
496 
497 
498 //====================================================================
500  const Field& f)
501  {
502  const double *v1 = f.ptr(0);
503  double *v2 = w.ptr(0);
504 
505  const int Nthread = ThreadManager_OpenMP::get_num_threads();
506  const int i_thread = ThreadManager_OpenMP::get_thread_id();
507 
508  const int is = m_Ntask * i_thread / Nthread;
509  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
510 
511  for (int i = is; i < is + ns; ++i) {
512  gm5_chiral_thread(i, v2, v1);
513  }
514 #pragma omp barrier
515  }
516 
517 
518 //====================================================================
520  {
521  double *wp = w.ptr(0);
522 
523  const int Nthread = ThreadManager_OpenMP::get_num_threads();
524  const int i_thread = ThreadManager_OpenMP::get_thread_id();
525 
526  const int is = m_Ntask * i_thread / Nthread;
527  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
528 
529  for (int i = is; i < is + ns; ++i) {
530  gm5_dirac_thread(i, wp);
531  }
532 #pragma omp barrier
533  }
534 
535 
536 //====================================================================
538  {
539  double *wp = w.ptr(0);
540 
541  const int Nthread = ThreadManager_OpenMP::get_num_threads();
542  const int i_thread = ThreadManager_OpenMP::get_thread_id();
543 
544  const int is = m_Ntask * i_thread / Nthread;
545  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
546 
547  for (int i = is; i < is + ns; ++i) {
548  gm5_chiral_thread(i, wp);
549  }
550 #pragma omp barrier
551  }
552 
553 
554 //====================================================================
555  void Fopr_Wilson_eo::gm5p(const int mu, Field& w,
556  const Field& f)
557  {
558  // this function is probably not to be used.
559  // determines \gamma_5 * (1 - \gamma_\mu) v(x+\hat{x})
560  vout.crucial(m_vl, "Error at %s: gm5p is undefined.\n", class_name.c_str());
561  exit(EXIT_FAILURE);
562  }
563 
564 
565 //====================================================================
567  {
568  double *wp = w.ptr(0);
569 
570  const int Nthread = ThreadManager_OpenMP::get_num_threads();
571  const int i_thread = ThreadManager_OpenMP::get_thread_id();
572 
573  const int is = m_Ntask * i_thread / Nthread;
574  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
575 
576  for (int i = is; i < is + ns; ++i) {
577  clear_thread(i, wp);
578  }
579 #pragma omp barrier
580  }
581 
582 
583 //====================================================================
584  void Fopr_Wilson_eo::scal_impl(Field& w, double a)
585  {
586  double *wp = w.ptr(0);
587 
588  const int Nthread = ThreadManager_OpenMP::get_num_threads();
589  const int i_thread = ThreadManager_OpenMP::get_thread_id();
590 
591  const int is = m_Ntask * i_thread / Nthread;
592  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
593 
594  for (int i = is; i < is + ns; ++i) {
595  scal_thread(i, wp, a);
596  }
597 #pragma omp barrier
598  }
599 
600 
601 //====================================================================
603  const Field& f, const int ieo)
604  {
605  const double *v1 = f.ptr(0);
606  double *v2 = w.ptr(0);
607 
608  const int Nthread = ThreadManager_OpenMP::get_num_threads();
609  const int i_thread = ThreadManager_OpenMP::get_thread_id();
610 
611  const int is = m_Ntask * i_thread / Nthread;
612  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
613 
614  for (int i = is; i < is + ns; ++i) {
615  mult_xp1_thread(i, vcp1_xp, v1, ieo);
616  }
617 
618 #pragma omp barrier
619 #pragma omp master
620  {
621  const int Nv = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
622  Communicator::exchange(Nv, vcp2_xp, vcp1_xp, 0, 1, 1);
623  }
624 #pragma omp barrier
625 
626  for (int i = is; i < is + ns; ++i) {
627  mult_xpb_thread(i, v2, v1, ieo);
628  }
629 
630  for (int i = is; i < is + ns; ++i) {
631  mult_xp2_thread(i, v2, vcp2_xp, ieo);
632  }
633 #pragma omp barrier
634  }
635 
636 
637 //====================================================================
639  const Field& f, const int ieo)
640  {
641  const double *v1 = f.ptr(0);
642  double *v2 = w.ptr(0);
643 
644  const int Nthread = ThreadManager_OpenMP::get_num_threads();
645  const int i_thread = ThreadManager_OpenMP::get_thread_id();
646 
647  const int is = m_Ntask * i_thread / Nthread;
648  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
649 
650  for (int i = is; i < is + ns; ++i) {
651  mult_xm1_thread(i, vcp1_xm, v1, ieo);
652  }
653 
654 #pragma omp barrier
655 #pragma omp master
656  {
657  const int Nv = m_Nvc * 2 * (m_Ny / 2) * m_Nz * m_Nt;
658  Communicator::exchange(Nv, vcp2_xm, vcp1_xm, 0, -1, 2);
659  }
660 #pragma omp barrier
661 
662  for (int i = is; i < is + ns; ++i) {
663  mult_xmb_thread(i, v2, v1, ieo);
664  }
665 
666  for (int i = is; i < is + ns; ++i) {
667  mult_xm2_thread(i, v2, vcp2_xm, ieo);
668  }
669 #pragma omp barrier
670  }
671 
672 
673 //====================================================================
675  const Field& f, const int ieo)
676  {
677  const double *v1 = f.ptr(0);
678  double *v2 = w.ptr(0);
679 
680  const int Nthread = ThreadManager_OpenMP::get_num_threads();
681  const int i_thread = ThreadManager_OpenMP::get_thread_id();
682 
683  const int is = m_Ntask * i_thread / Nthread;
684  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
685 
686  for (int i = is; i < is + ns; ++i) {
687  mult_yp1_thread(i, vcp1_yp, v1, ieo);
688  }
689 
690 #pragma omp barrier
691 #pragma omp master
692  {
693  const int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
694  Communicator::exchange(Nv, vcp2_yp, vcp1_yp, 1, 1, 3);
695  }
696 #pragma omp barrier
697 
698  for (int i = is; i < is + ns; ++i) {
699  mult_ypb_thread(i, v2, v1, ieo);
700  }
701 
702  for (int i = is; i < is + ns; ++i) {
703  mult_yp2_thread(i, v2, vcp2_yp, ieo);
704  }
705 #pragma omp barrier
706  }
707 
708 
709 //====================================================================
711  const Field& f, const int ieo)
712  {
713  const double *v1 = f.ptr(0);
714  double *v2 = w.ptr(0);
715 
716  const int Nthread = ThreadManager_OpenMP::get_num_threads();
717  const int i_thread = ThreadManager_OpenMP::get_thread_id();
718 
719  const int is = m_Ntask * i_thread / Nthread;
720  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
721 
722  for (int i = is; i < is + ns; ++i) {
723  mult_ym1_thread(i, vcp1_ym, v1, ieo);
724  }
725 
726 #pragma omp barrier
727 #pragma omp master
728  {
729  const int Nv = m_Nvc * 2 * m_Nx2 * m_Nz * m_Nt;
730  Communicator::exchange(Nv, vcp2_ym, vcp1_ym, 1, -1, 4);
731  }
732 #pragma omp barrier
733 
734  for (int i = is; i < is + ns; ++i) {
735  mult_ymb_thread(i, v2, v1, ieo);
736  }
737 
738  for (int i = is; i < is + ns; ++i) {
739  mult_ym2_thread(i, v2, vcp2_ym, ieo);
740  }
741 #pragma omp barrier
742  }
743 
744 
745 //====================================================================
747  const Field& f, const int ieo)
748  {
749  const double *v1 = f.ptr(0);
750  double *v2 = w.ptr(0);
751 
752  const int Nthread = ThreadManager_OpenMP::get_num_threads();
753  const int i_thread = ThreadManager_OpenMP::get_thread_id();
754 
755  const int is = m_Ntask * i_thread / Nthread;
756  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
757 
758  for (int i = is; i < is + ns; ++i) {
759  mult_zp1_thread(i, vcp1_zp, v1, ieo);
760  }
761 
762 #pragma omp barrier
763 #pragma omp master
764  {
765  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
766  Communicator::exchange(Nv, vcp2_zp, vcp1_zp, 2, 1, 5);
767  }
768 #pragma omp barrier
769 
770  for (int i = is; i < is + ns; ++i) {
771  mult_zpb_thread(i, v2, v1, ieo);
772  }
773 
774  for (int i = is; i < is + ns; ++i) {
775  mult_zp2_thread(i, v2, vcp2_zp, ieo);
776  }
777 #pragma omp barrier
778  }
779 
780 
781 //====================================================================
783  const Field& f, const int ieo)
784  {
785  const double *v1 = f.ptr(0);
786  double *v2 = w.ptr(0);
787 
788  const int Nthread = ThreadManager_OpenMP::get_num_threads();
789  const int i_thread = ThreadManager_OpenMP::get_thread_id();
790 
791  const int is = m_Ntask * i_thread / Nthread;
792  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
793 
794  for (int i = is; i < is + ns; ++i) {
795  mult_zm1_thread(i, vcp1_zm, v1, ieo);
796  }
797 
798 #pragma omp barrier
799 #pragma omp master
800  {
801  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nt;
802  Communicator::exchange(Nv, vcp2_zm, vcp1_zm, 2, -1, 6);
803  }
804 #pragma omp barrier
805 
806  for (int i = is; i < is + ns; ++i) {
807  mult_zmb_thread(i, v2, v1, ieo);
808  }
809 
810  for (int i = is; i < is + ns; ++i) {
811  mult_zm2_thread(i, v2, vcp2_zm, ieo);
812  }
813 #pragma omp barrier
814  }
815 
816 
817 //====================================================================
819  const Field& f, const int ieo)
820  {
821  const double *v1 = f.ptr(0);
822  double *v2 = w.ptr(0);
823 
824  const int Nthread = ThreadManager_OpenMP::get_num_threads();
825  const int i_thread = ThreadManager_OpenMP::get_thread_id();
826 
827  const int is = m_Ntask * i_thread / Nthread;
828  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
829 
830  for (int i = is; i < is + ns; ++i) {
831  mult_tp1_dirac_thread(i, vcp1_tp, v1, ieo);
832  }
833 
834 #pragma omp barrier
835 #pragma omp master
836  {
837  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
838  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
839  }
840 #pragma omp barrier
841 
842  for (int i = is; i < is + ns; ++i) {
843  mult_tpb_dirac_thread(i, v2, v1, ieo);
844  }
845 
846  for (int i = is; i < is + ns; ++i) {
847  mult_tp2_dirac_thread(i, v2, vcp2_tp, ieo);
848  }
849 #pragma omp barrier
850  }
851 
852 
853 //====================================================================
855  const Field& f, const int ieo)
856  {
857  const double *v1 = f.ptr(0);
858  double *v2 = w.ptr(0);
859 
860  const int Nthread = ThreadManager_OpenMP::get_num_threads();
861  const int i_thread = ThreadManager_OpenMP::get_thread_id();
862 
863  const int is = m_Ntask * i_thread / Nthread;
864  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
865 
866  for (int i = is; i < is + ns; ++i) {
867  mult_tm1_dirac_thread(i, vcp1_tm, v1, ieo);
868  }
869 
870 #pragma omp barrier
871 #pragma omp master
872  {
873  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
874  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
875  }
876 #pragma omp barrier
877 
878  for (int i = is; i < is + ns; ++i) {
879  mult_tmb_dirac_thread(i, v2, v1, ieo);
880  }
881 
882  for (int i = is; i < is + ns; ++i) {
883  mult_tm2_dirac_thread(i, v2, vcp2_tm, ieo);
884  }
885 #pragma omp barrier
886  }
887 
888 
889 //====================================================================
891  const Field& f, const int ieo)
892  {
893  const double *v1 = f.ptr(0);
894  double *v2 = w.ptr(0);
895 
896  const int Nthread = ThreadManager_OpenMP::get_num_threads();
897  const int i_thread = ThreadManager_OpenMP::get_thread_id();
898 
899  const int is = m_Ntask * i_thread / Nthread;
900  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
901 
902  for (int i = is; i < is + ns; ++i) {
903  mult_tp1_chiral_thread(i, vcp1_tp, v1, ieo);
904  }
905 
906 #pragma omp barrier
907 #pragma omp master
908  {
909  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
910  Communicator::exchange(Nv, vcp2_tp, vcp1_tp, 3, 1, 7);
911  }
912 #pragma omp barrier
913 
914  for (int i = is; i < is + ns; ++i) {
915  mult_tpb_chiral_thread(i, v2, v1, ieo);
916  }
917 
918  for (int i = is; i < is + ns; ++i) {
919  mult_tp2_chiral_thread(i, v2, vcp2_tp, ieo);
920  }
921 #pragma omp barrier
922  }
923 
924 
925 //====================================================================
927  const Field& f, const int ieo)
928  {
929  const double *v1 = f.ptr(0);
930  double *v2 = w.ptr(0);
931 
932  const int Nthread = ThreadManager_OpenMP::get_num_threads();
933  const int i_thread = ThreadManager_OpenMP::get_thread_id();
934 
935  const int is = m_Ntask * i_thread / Nthread;
936  const int ns = m_Ntask * (i_thread + 1) / Nthread - is;
937 
938  for (int i = is; i < is + ns; ++i) {
939  mult_tm1_chiral_thread(i, vcp1_tm, v1, ieo);
940  }
941 
942 #pragma omp barrier
943 #pragma omp master
944  {
945  const int Nv = m_Nvc * 2 * m_Nx2 * m_Ny * m_Nz;
946  Communicator::exchange(Nv, vcp2_tm, vcp1_tm, 3, -1, 8);
947  }
948 #pragma omp barrier
949 
950  for (int i = is; i < is + ns; ++i) {
951  mult_tmb_chiral_thread(i, v2, v1, ieo);
952  }
953 
954  for (int i = is; i < is + ns; ++i) {
955  mult_tm2_chiral_thread(i, v2, vcp2_tm, ieo);
956  }
957 #pragma omp barrier
958  }
959 
960 
961 //====================================================================
963  {
964  // Counting of floating point operations in giga unit.
965  // The following counting explicitly depends on the implementation.
966  // It will be recalculated when the code is modified.
967  // The present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
968 
969  const int Nvol = CommonParameters::Nvol();
970  const int NPE = CommonParameters::NPE();
971 
972  int flop_site;
973 
974  if (m_repr == "Dirac") {
975  flop_site = m_Nc * m_Nd * (6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1));
976  } else if (m_repr == "Chiral") {
977  flop_site = m_Nc * m_Nd * 8 * (4 * m_Nc + 2);
978  } else {
979  vout.crucial(m_vl, "Error at %s: input repr is undefined.\n",
980  class_name.c_str());
981  exit(EXIT_FAILURE);
982  }
983 
984  double gflop = flop_site * ((Nvol / 2) * (NPE / 1.0e+9));
985 
986  return gflop;
987  }
988 
989 
990 //====================================================================
991 }
992 //============================================================END=====
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:433
void mult_zp2_thread(const int, double *, const double *, const int)
void mult_xm(Field &, const Field &, const int ieo)
void postPropD(Field &, const Field &, const Field &)
void mult_tm_dirac(Field &, const Field &, const int ieo)
void mult_tp1_dirac_thread(const int, double *, const double *, const int)
BridgeIO vout
Definition: bridgeIO.cpp:503
void mult_zpb_thread(const int, double *, const double *, const int)
void(Fopr_Wilson_eo::* m_mult_tp)(Field &, const Field &, const int ieo)
void mult_ymb_thread(const int, double *, const double *, const int)
static int get_num_threads()
returns available number of threads.
void mult_ym(Field &, const Field &, const int ieo)
void mult_xp(Field &, const Field &, const int ieo)
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:153
void mult_yp(Field &, const Field &, const int ieo)
void gm5_chiral_thread(const int, double *, const double *)
void mult_zm2_thread(const int, double *, const double *, const int)
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:175
void clear_thread(const int, double *)
void DDdag(Field &v, const Field &f)
void gm5p(const int mu, Field &, const Field &v)
gamma_5 (1 - gamma_mu) v(x + mu) used in force calculation.
void(Fopr_Wilson_eo::* m_mult)(Field &, const Field &)
void gm5_dirac(Field &, const Field &)
void general(const char *format,...)
Definition: bridgeIO.cpp:197
static Bridge::VerboseLevel Vlevel()
Container of Field-type object.
Definition: field.h:45
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
void mult_xp2_thread(const int, double *, const double *, const int)
void scal_impl(Field &, const double)
void DdagD(Field &v, const Field &f)
void Mdageo(Field &, const Field &, const int ieo)
std::vector< double > m_boundary_each_node
b.c. for each node.
void mult_tmb_chiral_thread(const int, double *, const double *, const int)
Class for parameters.
Definition: parameters.h:46
static int ipe(const int dir)
logical coordinate of current proc.
void mult_zp1_thread(const int, double *, const double *, const int)
void mult_zm(Field &, const Field &, const int ieo)
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:532
void mult_tp2_dirac_thread(const int, double *, const double *, const int)
void set_config(Field *U)
setting pointer to the gauge configuration.
void(Fopr_Wilson_eo::* m_postProp)(Field &, const Field &, const Field &)
void MeoMoe(Field &, const Field &)
void convertField(Field &eo, const Field &lex)
Definition: index_eo.cpp:20
std::vector< int > m_yzt_eo
void mult_xp1_thread(const int, double *, const double *, const int)
void mult_tp_dirac(Field &, const Field &, const int ieo)
void mult_ym1_thread(const int, double *, const double *, const int)
static int get_thread_id()
returns thread id.
Wilson-type fermion field.
Definition: field_F.h:37
void Ddag(Field &v, const Field &f)
void Meo(Field &, const Field &, const int ieo)
void(Fopr_Wilson_eo::* m_gm5)(Field &, const Field &)
void gm5_dirac_thread(const int, double *, const double *)
void(Fopr_Wilson_eo::* m_gm5_self)(Field &)
int nin() const
Definition: field.h:126
void mult_xm1_thread(const int, double *, const double *, const int)
void mult_tpb_dirac_thread(const int, double *, const double *, const int)
void(Fopr_Wilson_eo::* m_mult_dag)(Field &, const Field &)
void mult_tm2_dirac_thread(const int, double *, const double *, const int)
void mult_tp2_chiral_thread(const int, double *, const double *, const int)
void mult_yp1_thread(const int, double *, const double *, const int)
Field m_w2
working field.
SU(N) gauge field.
Definition: field_G.h:38
void init(const std::string)
void mult_tm_chiral(Field &, const Field &, const int ieo)
Bridge::VerboseLevel m_vl
Definition: fopr.h:127
void mult_zmb_thread(const int, double *, const double *, const int)
double flop_count()
this returns the number of floating point operations of Meo.
void mult_xm2_thread(const int, double *, const double *, const int)
static void sync_barrier_all()
barrier among all the threads and nodes.
double * vcp1_xp
arrays for data transfer.
void gm5_chiral(Field &, const Field &)
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
Definition: field.cpp:612
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...
int nex() const
Definition: field.h:128
Field_G * m_U
dummy: pointing m_Ueo.
void mult_tm1_dirac_thread(const int, double *, const double *, const int)
void mult_tpb_chiral_thread(const int, double *, const double *, const int)
void mult_tp_chiral(Field &, const Field &, const int ieo)
std::string m_repr
Dirac matrix representation.
void prePropDag(Field &, Field &, const Field &)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
Definition: field.h:95
void mult_yp2_thread(const int, double *, const double *, const int)
void mult_tp1_chiral_thread(const int, double *, const double *, const int)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:319
void(Fopr_Wilson_eo::* m_preProp)(Field &, Field &, const Field &)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
void Meo_gm5(Field &, const Field &, const int ieo)
void D(Field &v, const Field &f)
std::vector< int > m_boundary
boundary condition.
void mult_tm2_chiral_thread(const int, double *, const double *, const int)
void mult_tm1_chiral_thread(const int, double *, const double *, const int)
std::string get_mode() const
only for Fopr_Overlap
void reverseField(Field &lex, const Field &eo)
Definition: index_eo.cpp:112
void mult_gm5(Field &, const Field &)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
void prePropD(Field &, Field &, const Field &)
void mult_zp(Field &, const Field &, const int ieo)
void mult_xmb_thread(const int, double *, const double *, const int)
void H(Field &v, const Field &f)
double m_kappa
hopping parameter.
void(Fopr_Wilson_eo::* m_mult_tm)(Field &, const Field &, const int ieo)
std::string m_mode
mult mode.
void mult_xpb_thread(const int, double *, const double *, const int)
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 postPropDag(Field &, const Field &, const Field &)
void scal_thread(const int, double *, const double)
void mult_ym2_thread(const int, double *, const double *, const int)
void set_parameters(const Parameters &params)
static const std::string class_name
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_tmb_dirac_thread(const int, double *, const double *, const int)
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:131
void mult_ypb_thread(const int, double *, const double *, const int)
void mult_zm1_thread(const int, double *, const double *, const int)