Bridge++  Ver. 2.0.2
afopr_Staggered_eo-tmpl.h
Go to the documentation of this file.
1 
11 
12 template<typename AFIELD>
14  = "AFopr_Staggered_eo<AFIELD>";
15 //====================================================================
16 template<typename AFIELD>
18 {
20 
21  // switches
22  int req_comm = 1; // set 1 if communication forced any time
23  //int req_comm = 0; // set 0 if communication only when necessary
24 
25  std::string vlevel;
26  if (!params.fetch_string("verbose_level", vlevel)) {
27  m_vl = vout.set_verbose_level(vlevel);
28  } else {
29  m_vl = CommonParameters::Vlevel();
30  }
31 
32  vout.general(m_vl, "%s: construction\n", class_name.c_str());
33 
34  m_Nc = CommonParameters::Nc();
35  if (m_Nc != 3) {
36  vout.crucial("%s: only applicable to Nc = 3\n",
37  class_name.c_str());
38  exit(EXIT_FAILURE);
39  }
40 
41  m_Nvc = m_Nc * 2;
42  m_Ndf = 2 * m_Nc * m_Nc;
43  m_Nx = CommonParameters::Nx();
44  m_Ny = CommonParameters::Ny();
45  m_Nz = CommonParameters::Nz();
46  m_Nt = CommonParameters::Nt();
47  m_Nst = CommonParameters::Nvol();
48  m_Ndim = CommonParameters::Ndim();
49 
50  m_Nx2 = m_Nx / 2;
51  m_Nst2 = m_Nst / 2;
52 
53  m_Nx2v = m_Nx2 / VLENX;
54  m_Nyv = m_Ny / VLENY;
55  m_Nst2v = m_Nst2 / VLEN;
56 
57  // condition check
58  if (m_Nx % 2 != 0) {
59  vout.crucial(m_vl, "%s: Nx must be even.\n",
60  class_name.c_str());
61  exit(EXIT_FAILURE);
62  }
63  if (m_Nx % (2 * VLENX) != 0) {
64  vout.crucial(m_vl, "%s: Nx must be mulriple of 2*VLENX.\n",
65  class_name.c_str());
66  exit(EXIT_FAILURE);
67  }
68  if (m_Ny % (VLENY) != 0) {
69  vout.crucial(m_vl, "%s: Ny must be multiple of VLENY.\n",
70  class_name.c_str());
71  exit(EXIT_FAILURE);
72  }
73 
74  vout.general(m_vl, " VLENX = %2d Nx2v = %d\n", VLENX, m_Nx2v);
75  vout.general(m_vl, " VLENY = %2d Nyv = %d\n", VLENY, m_Nyv);
76  vout.general(m_vl, " VLEN = %2d Nst2v = %d\n", VLEN, m_Nst2v);
77 
78  m_Leo.resize(m_Ny * m_Nz * m_Nt);
79 
80  int ipe3 = Communicator::ipe(3);
81  int ipe2 = Communicator::ipe(2);
82  int ipe1 = Communicator::ipe(1);
83  for (int t = 0; t < m_Nt; ++t) {
84  for (int z = 0; z < m_Nz; ++z) {
85  for (int y = 0; y < m_Ny; ++y) {
86  int t2 = ipe3 * m_Nt + t;
87  int z2 = ipe2 * m_Nz + z;
88  int y2 = ipe1 * m_Ny + y;
89  m_Leo[y + m_Ny * (z + m_Nz * t)] = (y2 + z2 + t2) % 2;
90  }
91  }
92  }
93 
94  m_Nsize[0] = m_Nx2v;
95  m_Nsize[1] = m_Nyv;
96  m_Nsize[2] = m_Nz;
97  m_Nsize[3] = m_Nt;
98 
99  do_comm_any = 0;
100  for (int mu = 0; mu < m_Ndim; ++mu) {
101  do_comm[mu] = 1;
102  if ((req_comm == 0) && (Communicator::npe(mu) == 1)) do_comm[mu] = 0;
103  do_comm_any += do_comm[mu];
104  vout.general(m_vl, " do_comm[%d] = %d\n", mu, do_comm[mu]);
105  }
106 
107  m_Nbdsize.resize(m_Ndim);
108  m_Nbdsize[0] = m_Nvc * ((m_Ny * m_Nz * m_Nt + 1) / 2);
109  m_Nbdsize[1] = m_Nvc * m_Nx2 * m_Nz * m_Nt;
110  m_Nbdsize[2] = m_Nvc * m_Nx2 * m_Ny * m_Nt;
111  m_Nbdsize[3] = m_Nvc * m_Nx2 * m_Ny * m_Nz;
112 
113  setup_channels();
114 
115  // gauge configuration.
116  m_Ueo.reset(m_Ndf, m_Nst, m_Ndim);
117  m_Ulex.reset(m_Ndf, m_Nst, m_Ndim);
118 
119  // working vectors.
120  m_w1.reset(m_Nvc, m_Nst2, 1);
121  m_w2.reset(m_Nvc, m_Nst2, 1);
122  m_v1.reset(m_Nvc, m_Nst2, 1);
123  m_v2.reset(m_Nvc, m_Nst2, 1);
124 
125  // m_z1.reset(m_Nvc, m_Nst, 1); // used in convert/revese.
126 
127  // staggered phase and parity
128  m_stg_phase.reset(1, m_Nst, m_Ndim, Element_type::REAL);
129  m_parity.reset(1, m_Nst, 1, Element_type::REAL);
130 
131  set_staggered_phase();
132 
134 
135  set_parameters(params);
136 
137  m_shift = new ShiftAField_eo<AFIELD>(m_Nvc);
138 
140 
141  vout.general(m_vl, "%s: construction finished.\n",
142  class_name.c_str());
143 }
144 
145 
146 //====================================================================
147 template<typename AFIELD>
149 {
150  delete m_shift;
151 }
152 
153 
154 //====================================================================
155 template<typename AFIELD>
157 {
158  chsend_up.resize(m_Ndim);
159  chrecv_up.resize(m_Ndim);
160  chsend_dn.resize(m_Ndim);
161  chrecv_dn.resize(m_Ndim);
162 
163  for (int mu = 0; mu < m_Ndim; ++mu) {
164  int Nvsize = m_Nbdsize[mu] * sizeof(real_t);
165 
166  chsend_dn[mu].send_init(Nvsize, mu, -1);
167  chsend_up[mu].send_init(Nvsize, mu, 1);
168 #ifdef USE_MPI
169  chrecv_up[mu].recv_init(Nvsize, mu, 1);
170  chrecv_dn[mu].recv_init(Nvsize, mu, -1);
171 #else
172  void *buf_up = (void *)chsend_dn[mu].ptr();
173  chrecv_up[mu].recv_init(Nvsize, mu, 1, buf_up);
174  void *buf_dn = (void *)chsend_up[mu].ptr();
175  chrecv_dn[mu].recv_init(Nvsize, mu, -1, buf_dn);
176 #endif
177 
178  if (do_comm[mu] == 1) {
179  chset_send.append(chsend_up[mu]);
180  chset_send.append(chsend_dn[mu]);
181  chset_recv.append(chrecv_up[mu]);
182  chset_recv.append(chrecv_dn[mu]);
183  }
184  }
185 }
186 
187 
188 //====================================================================
189 template<typename AFIELD>
191 {
192  const string str_vlevel = params.get_string("verbose_level");
193  m_vl = vout.set_verbose_level(str_vlevel);
194 
195  double mq;
196  std::vector<int> bc;
197 
198  int err = 0;
199  err += params.fetch_double("quark_mass", mq);
200  err += params.fetch_int_vector("boundary_condition", bc);
201 
202  if (err) {
203  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n",
204  class_name.c_str());
205  exit(EXIT_FAILURE);
206  }
207 
208  set_parameters(real_t(mq), bc);
209 }
210 
211 
212 //====================================================================
213 template<typename AFIELD>
215  const std::vector<int> bc)
216 {
217  assert(bc.size() == m_Ndim);
218 
219 #pragma omp barrier
220 
221  int ith = ThreadManager::get_thread_id();
222 
223  if (ith == 0) {
224  m_mq = mq;
225  m_boundary.resize(m_Ndim);
226  for (int mu = 0; mu < m_Ndim; ++mu) {
227  m_boundary[mu] = bc[mu];
228  }
229  }
230 
231  vout.general(m_vl, "%s: set parameters\n", class_name.c_str());
232  vout.general(m_vl, " mq = %8.4f\n", m_mq);
233  for (int mu = 0; mu < m_Ndim; ++mu) {
234  vout.general(m_vl, " boundary[%d] = %2d\n", mu, m_boundary[mu]);
235  }
236 
237 #pragma omp barrier
238 }
239 
240 
241 //====================================================================
242 template<typename AFIELD>
244 {
245  params.set_double("quark_mass", double(m_mq));
246  params.set_int_vector("boundary_condition", m_boundary);
247 
248  params.set_string("verbose_level", vout.get_verbose_level(m_vl));
249 }
250 
251 
252 //====================================================================
253 template<typename AFIELD>
255 {
256  int ipex = Communicator::ipe(0);
257  int ipey = Communicator::ipe(1);
258  int ipez = Communicator::ipe(2);
259  int ipet = Communicator::ipe(3);
260 
261  real_t *stgph = m_stg_phase.ptr(0);
262  real_t *prty = m_parity.ptr(0);
263 
265 
266  for (int t = 0; t < m_Nt; ++t) {
267  int t2 = t + ipet * m_Nt;
268  for (int z = 0; z < m_Nz; ++z) {
269  int z2 = z + ipez * m_Nz;
270  for (int y = 0; y < m_Ny; ++y) {
271  int y2 = y + ipey * m_Ny;
272  for (int x = 0; x < m_Nx; ++x) {
273  int x2 = x + ipex * m_Nx;
274  int is = index.site(x, y, z, t);
275 
276  stgph[index.idx(0, 1, is, 0)] = 1.0;
277  stgph[index.idx(0, 1, is, 1)] = 1.0;
278  stgph[index.idx(0, 1, is, 2)] = 1.0;
279  stgph[index.idx(0, 1, is, 3)] = 1.0;
280 
281  prty[index.idx(0, 1, is, 0)] = 1.0;
282 
283  if ((x2 % 2) == 1) {
284  stgph[index.idx(0, 1, is, 1)] = -1.0;
285  }
286  if (((x2 + y2) % 2) == 1) {
287  stgph[index.idx(0, 1, is, 2)] = -1.0;
288  }
289  if (((x2 + y2 + z2) % 2) == 1) {
290  stgph[index.idx(0, 1, is, 3)] = -1.0;
291  }
292  if (((x2 + y2 + z2 + t2) % 2) == 1) {
293  prty[index.idx(0, 1, is, 0)] = -1.0;
294  }
295  }
296  }
297  }
298  }
299 }
300 
301 
302 //====================================================================
303 template<typename AFIELD>
305 {
306  int nth = ThreadManager::get_num_threads();
307 
308  vout.detailed(m_vl, "%s: set_config is called: num_threads = %d\n",
309  class_name.c_str(), nth);
310 
311  if (nth > 1) {
312  set_config_impl(u);
313  } else {
314  set_config_omp(u);
315  }
316 
317  vout.detailed(m_vl, "%s: set_config finished\n", class_name.c_str());
318 }
319 
320 
321 //====================================================================
322 template<typename AFIELD>
324 {
325  vout.detailed(m_vl, " set_config_omp is called.\n");
326 
327 #pragma omp parallel
328  {
329  set_config_impl(u);
330  }
331 }
332 
333 
334 //====================================================================
335 template<typename AFIELD>
337 {
340 
341  real_t *Ueo = m_Ueo.ptr(0);
342 
343  int Nsize_lex[4];
344  Nsize_lex[0] = m_Nsize[0] * 2;
345  Nsize_lex[1] = m_Nsize[1];
346  Nsize_lex[2] = m_Nsize[2];
347  Nsize_lex[3] = m_Nsize[3];
348 
349  convert_gauge(index_lex, m_Ulex, *U);
350 
351  QXS_Gauge::set_boundary(m_Ulex, m_boundary);
352 
353  for (int mu = 0; mu < m_Ndim; ++mu) {
354  // staggered phase is multiplied to gauge field
355  real_t *stgph = m_stg_phase.ptr(index_lex.idx(0, 1, 0, mu));
356  real_t *up = m_Ulex.ptr(index_lex.idx_G(0, 0, mu));
357  BridgeQXS::mult_staggered_phase(up, stgph, Nsize_lex, m_Ndf);
358  }
359 #pragma omp barrier
360 
361  int ith, nth, is, ns;
362  set_threadtask_mult(ith, nth, is, ns, m_Nst);
363 
364  for (int ex = 0; ex < m_Ndim; ++ex) {
365  for (int site = is; site < ns; ++site) {
366  for (int in = 0; in < m_Ndf; ++in) {
367  int iv1 = index_lex.idx(in, m_Ndf, site, ex);
368  int iv2 = index_eo.idx(in, m_Ndf, site, ex);
369  Ueo[iv2] = m_Ulex.cmp(iv1);
370  }
371  }
372  }
373 
374 #pragma omp barrier
375 }
376 
377 
378 //====================================================================
379 template<typename AFIELD>
381 {
382 #pragma omp barrier
383  scal(v, real_t(1.0) / (m_mq * m_mq));
384 #pragma omp barrier
385 }
386 
387 
388 //====================================================================
389 template<typename AFIELD>
391 {
392 #pragma omp barrier
393  scal(v, m_mq * m_mq);
394 #pragma omp barrier
395 }
396 
397 
398 //====================================================================
399 template<typename AFIELD>
401 {
402 #pragma omp barrier
403 
404  int ith = ThreadManager::get_thread_id();
405  if (ith == 0) m_mode = mode;
406 
407 #pragma omp barrier
408 }
409 
410 
411 //====================================================================
412 template<typename AFIELD>
414 {
415  if (m_mode == "D") {
416  D(v, w);
417  } else if (m_mode == "Ddag") {
418  Ddag(v, w);
419  } else if (m_mode == "DdagD") {
420  DdagD(v, w);
421  // } else if (m_mode == "H") {
422  // H(v, w);
423  } else {
424  vout.crucial(m_vl, "%s: mode undeifined.\n", class_name.c_str());
425  abort();
426  }
427 }
428 
429 
430 //====================================================================
431 template<typename AFIELD>
433 {
434  if (m_mode == "D") {
435  Ddag(v, w);
436  } else if (m_mode == "Ddag") {
437  D(v, w);
438  } else if (m_mode == "DdagD") {
439  DdagD(v, w);
440  //} else if (m_mode == "H") {
441  // H(v, w);
442  } else {
443  vout.crucial(m_vl, "%s: mode undeifined.\n", class_name.c_str());
444  abort();
445  }
446 }
447 
448 
449 //====================================================================
450 template<typename AFIELD>
452  const std::string mode)
453 {
454 #pragma omp barrier
455 
456  if (mode == "Dee") {
457  copy(v, w);
458  scal(v, m_mq);
459  } else if (mode == "Doo") {
460  copy(v, w);
461  scal(v, m_mq);
462  } else if (mode == "Dee_inv") {
463  copy(v, w);
464  scal(v, real_t(1.0) / m_mq);
465  } else if (mode == "Doo_inv") {
466  copy(v, w);
467  scal(v, real_t(1.0) / m_mq);
468  } else if (mode == "Deo") {
469  Meo(v, w, 0);
470  } else if (mode == "Doe") {
471  Meo(v, w, 1);
472  } else {
473  vout.crucial(m_vl, "%s: illegal mode is given to mult with mode\n",
474  class_name.c_str());
475  exit(EXIT_FAILURE);
476  }
477 
478 #pragma omp barrier
479 }
480 
481 
482 //====================================================================
483 template<typename AFIELD>
485  const std::string mode)
486 {
487 #pragma omp barrier
488 
489  if (mode == "Dee") {
490  copy(v, w);
491  scal(v, m_mq);
492  } else if (mode == "Doo") {
493  copy(v, w);
494  scal(v, m_mq);
495  } else if (mode == "Dee_inv") {
496  copy(v, w);
497  scal(v, real_t(1.0) / m_mq);
498  } else if (mode == "Doo_inv") {
499  copy(v, w);
500  scal(v, real_t(1.0) / m_mq);
501  } else if (mode == "Deo") {
502  Meo(v, w, 0);
503  scal(v, real_t(-1.0));
504  } else if (mode == "Doe") {
505  Meo(v, w, 1);
506  scal(v, real_t(-1.0));
507  } else {
508  vout.crucial(m_vl, "%s: illegal mode is given to mult with mode\n",
509  class_name.c_str());
510  exit(EXIT_FAILURE);
511  }
512 
513 #pragma omp barrier
514 }
515 
516 
517 //====================================================================
518 template<typename AFIELD>
520 {
521  D(v, w);
522  mult_gm5(v);
523 }
524 
525 
526 //====================================================================
527 template<typename AFIELD>
529 {
530  D(m_v2, w);
531  Ddag(v, m_v2);
532  // H(m_v2, w);
533  // H(v, m_v2);
534 }
535 
536 
537 //====================================================================
538 template<typename AFIELD>
540 {
541  // Meo(m_v1, w, w, 1, 0);
542  // Meo(v, m_v1, w, 0, 1);
543 
544  Meo(m_v1, w, w, 1, 0);
545  Meo(v, m_v1, w, 0, 0);
546 
547  // aypx(real_t(-1.0/(m_mq * m_mq)), v, w);
548 
549  scal(v, real_t(-1.0));
550  axpy(v, m_mq * m_mq, w);
551 #pragma omp barrier
552 }
553 
554 
555 //====================================================================
556 template<typename AFIELD>
558 {
559  // Meo(m_v1, w, w, 1, 0);
560  // Meo(v, m_v1, w, 0, 1);
561 
562  Meo(m_v1, w, w, 1, 0);
563  Meo(v, m_v1, w, 0, 0);
564 
565  scal(v, real_t(-1.0));
566  axpy(v, m_mq * m_mq, w);
567 #pragma omp barrier
568 }
569 
570 
571 //====================================================================
572 template<typename AFIELD>
574  int ieo)
575 {
576  mult_Meo_qxs(v, w, w, ieo, 0);
577  //mult_Meo_alt(v, w, w, ieo, 0);
578 }
579 
580 
581 //====================================================================
582 template<typename AFIELD>
584  const AFIELD& x,
585  int ieo, int iflag)
586 {
587  mult_Meo_qxs(v, w, x, ieo, iflag);
588  //mult_Meo_alt(v, w, x, ieo, iflag);
589 }
590 
591 
592 //====================================================================
593 template<typename AFIELD>
595  const AFIELD& w,
596  const AFIELD& x,
597  int ieo, int iflag)
598 {
599  real_t *vp = v.ptr(0);
600  real_t *wp = const_cast<AFIELD *>(&w)->ptr(0);
601  real_t *xp = const_cast<AFIELD *>(&x)->ptr(0);
602  real_t *up = m_Ueo.ptr(0);
603 
604  int ith = ThreadManager::get_thread_id();
605 
606 #pragma omp barrier
607 
608  if (do_comm_any > 0) {
609  if (ith == 0) chset_recv.start();
610 
611  real_t *buf1xp = (real_t *)chsend_dn[0].ptr();
612  real_t *buf1xm = (real_t *)chsend_up[0].ptr();
613 
614  real_t *buf1yp = (real_t *)chsend_dn[1].ptr();
615  real_t *buf1ym = (real_t *)chsend_up[1].ptr();
616 
617  real_t *buf1zp = (real_t *)chsend_dn[2].ptr();
618  real_t *buf1zm = (real_t *)chsend_up[2].ptr();
619 
620  real_t *buf1tp = (real_t *)chsend_dn[3].ptr();
621  real_t *buf1tm = (real_t *)chsend_up[3].ptr();
622 
623  BridgeQXS::mult_staggered_eo_1(buf1xp, buf1xm, buf1yp, buf1ym,
624  buf1zp, buf1zm, buf1tp, buf1tm,
625  up, wp,
626  m_Nsize, do_comm, &m_Leo[0], ieo);
627 
628 #pragma omp barrier
629 
630  if (ith == 0) chset_send.start();
631  }
632 
633  int jd = 1;
634  BridgeQXS::mult_staggered_eo_bulk(vp, up, wp, xp, m_mq, jd,
635  m_Nsize, do_comm,
636  &m_Leo[0], ieo, iflag);
637 
638  if (do_comm_any > 0) {
639  if (ith == 0) chset_recv.wait();
640 
641 #pragma omp barrier
642 
643  real_t *buf2xp = (real_t *)chrecv_up[0].ptr();
644  real_t *buf2xm = (real_t *)chrecv_dn[0].ptr();
645 
646  real_t *buf2yp = (real_t *)chrecv_up[1].ptr();
647  real_t *buf2ym = (real_t *)chrecv_dn[1].ptr();
648 
649  real_t *buf2zp = (real_t *)chrecv_up[2].ptr();
650  real_t *buf2zm = (real_t *)chrecv_dn[2].ptr();
651 
652  real_t *buf2tp = (real_t *)chrecv_up[3].ptr();
653  real_t *buf2tm = (real_t *)chrecv_dn[3].ptr();
654 
656  buf2xp, buf2xm, buf2yp, buf2ym,
657  buf2zp, buf2zm, buf2tp, buf2tm,
658  m_mq, m_Nsize, do_comm,
659  &m_Leo[0], ieo, iflag);
660 
661  if (ith == 0) chset_send.wait();
662  }
663 
664 #pragma omp barrier
665 }
666 
667 
668 //====================================================================
669 template<typename AFIELD>
671  const AFIELD& w,
672  const AFIELD& x,
673  int ieo, int iflag)
674 {
675  real_t *vp = v.ptr(0);
676  real_t *wp = const_cast<AFIELD *>(&w)->ptr(0);
677  real_t *xp = const_cast<AFIELD *>(&x)->ptr(0);
678 
679 #pragma omp barrier
680 
681  clear(vp);
682 #pragma omp barrier
683 
684  for (int mu = 0; mu < m_Ndim; ++mu) {
685  mult_up(mu, v, w, ieo);
686  mult_dn(mu, v, w, ieo);
687  }
688 
689 #pragma omp barrier
690 
691  // note that mass normalization is adopted.
692  if (iflag != 0) {
693  real_t fac = -1.0 / (m_mq * m_mq);
694  axpby(fac, vp, real_t(1.0), xp);
695  }
696 
697 #pragma omp barrier
698 }
699 
700 
701 //====================================================================
702 template<typename AFIELD>
704 {
705 #pragma omp barrier
706 
707  copy(v, w);
708 #pragma omp barrier
709 
710  /*
711  real_t* ph = m_parity.ptr(0);
712  real_t* vp = v.ptr(0);
713 
714  BridgeQXS::mult_staggered_phase(vp, ph, m_Nsize, m_Nvc);
715 
716 #pragma omp barrier
717  */
718 }
719 
720 
721 //====================================================================
722 template<typename AFIELD>
724 {
725  real_t *ph = m_parity.ptr(0);
726  real_t *vp = v.ptr(0);
727 
728 #pragma omp barrier
729  BridgeQXS::mult_staggered_phase(vp, ph, m_Nsize, m_Nvc);
730 #pragma omp barrier
731 }
732 
733 
734 //====================================================================
735 template<typename AFIELD>
737 {
738  BridgeQXS::mult_staggered_clear(vp, m_Nsize, m_Nvc);
739 }
740 
741 
742 //====================================================================
743 template<typename AFIELD>
745  real_t a, real_t *wp)
746 {
747  BridgeQXS::mult_staggered_axpby(b, vp, a, wp, m_Nsize, m_Nvc);
748 }
749 
750 
751 //====================================================================
752 template<typename AFIELD>
754  AFIELD& v, const AFIELD& w)
755 {
756 }
757 
758 
759 //====================================================================
760 template<typename AFIELD>
762  AFIELD& v, const AFIELD& w)
763 {
764 }
765 
766 
767 //====================================================================
768 template<typename AFIELD>
770  AFIELD& v, const AFIELD& w,
771  int ieo)
772 {
773  m_shift->backward(m_w1, w, idir, ieo);
774 
775  real_t *wp = m_w1.ptr(0);
776  real_t *up = m_Ueo.ptr(NDF * m_Nst2 * (ieo + 2 * idir));
777  real_t *vp = m_w2.ptr(0);
778 
779  BridgeQXS::mult_staggered_mult_Gn(vp, up, wp, m_Nsize);
780 #pragma omp barrier
781 
782  // copy(m_w2, m_w1);
783 
784  axpy(v, real_t(0.5), m_w2);
785 #pragma omp barrier
786 }
787 
788 
789 //====================================================================
790 template<typename AFIELD>
792  AFIELD& v, const AFIELD& w,
793  int ieo)
794 {
795  real_t *wp = const_cast<AFIELD *>(&w)->ptr(0);
796  real_t *up = m_Ueo.ptr(NDF * m_Nst2 * (1 - ieo + 2 * idir));
797  real_t *vp = m_w1.ptr(0);
798 
799  BridgeQXS::mult_staggered_mult_Gd(vp, up, wp, m_Nsize);
800 #pragma omp barrier
801 
802  // copy(m_w1, w);
803  //#pragma omp barrier
804 
805  m_shift->forward(m_w2, m_w1, idir, ieo);
806 
807  axpy(v, real_t(-0.5), m_w2);
808 #pragma omp barrier
809 }
810 
811 
812 //====================================================================
813 template<typename AFIELD>
815 {
816  return flop_count(m_mode);
817 }
818 
819 
820 //====================================================================
821 template<typename AFIELD>
822 double AFopr_Staggered_eo<AFIELD>::flop_count(const std::string mode)
823 {
824  // The following counting explicitly depends on the implementation.
825  // It will be recalculated when the code is modified.
826  // The following is based on rev.1976. [21 Jul 2019 H.Matsufuru]
827 
828  int Lvol = CommonParameters::Lvol();
829  double flop_site, flop;
830 
831  flop_site = static_cast<double>(m_Nvc * (2 + 8 * 2 * m_Nvc));
832  // #comp aypx dir FMA #comp
833 
834  flop = flop_site * static_cast<double>(Lvol);
835 
836  if ((mode == "DdagD") || (mode == "DDdag")) flop *= 2.0;
837 
838  return flop;
839 }
840 
841 
842 //============================================================END=====
CommonParameters::Ny
static int Ny()
Definition: commonParameters.h:106
CommonParameters::Nz
static int Nz()
Definition: commonParameters.h:107
CommonParameters::Lvol
static long_t Lvol()
Definition: commonParameters.h:95
AFopr_Staggered_eo::set_mode
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Staggered_eo-tmpl.h:400
Parameters::set_string
void set_string(const string &key, const string &value)
Definition: parameters.cpp:39
AFopr_Staggered_eo
Staggered_eo fermion operator.
Definition: afopr_Staggered_eo.h:42
AFopr_Staggered_eo::set_config_omp
void set_config_omp(Field *u)
setting gauge configuration (setting omp parallel).
Definition: afopr_Staggered_eo-tmpl.h:323
ThreadManager::get_num_threads
static int get_num_threads()
returns available number of threads.
Definition: threadManager.cpp:246
CommonParameters::Ndim
static int Ndim()
Definition: commonParameters.h:117
AFopr_Staggered_eo::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Staggered_eo-tmpl.h:814
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Staggered_eo::mult_Meo_qxs
void mult_Meo_qxs(AFIELD &, const AFIELD &, const AFIELD &, int ieo, int iflag)
Definition: afopr_Staggered_eo-tmpl.h:594
AIndex_lex
Definition: aindex_lex_base.h:17
Parameters::set_double
void set_double(const string &key, const double value)
Definition: parameters.cpp:33
Bridge::BridgeIO::decrease_indent
void decrease_indent()
Definition: bridgeIO.h:86
AFopr_Staggered_eo::set_config_impl
void set_config_impl(Field *u)
setting gauge configuration (implementation).
Definition: afopr_Staggered_eo-tmpl.h:336
Bridge::BridgeIO::increase_indent
void increase_indent()
Definition: bridgeIO.h:85
VLEN
#define VLEN
Definition: bridgeQXS_Clover_coarse_double.cpp:12
AFopr_Staggered_eo::normalize_fopr
void normalize_fopr(AFIELD &v)
normalize propagator if necessary (default: do nothing)
Definition: afopr_Staggered_eo-tmpl.h:380
Bridge::BridgeIO::detailed
void detailed(const char *format,...)
Definition: bridgeIO.cpp:219
AFopr_Staggered_eo::mult_Meo_alt
void mult_Meo_alt(AFIELD &, const AFIELD &, const AFIELD &, int ieo, int iflag)
Definition: afopr_Staggered_eo-tmpl.h:670
BridgeQXS::mult_staggered_phase
void mult_staggered_phase(double *v, double *ph, int *Nsize, int Nin)
Definition: mult_Staggered_qxs-inc.h:16
NDF
#define NDF
Definition: field_F_imp_SU2-inc.h:4
CommonParameters::Nvol
static int Nvol()
Definition: commonParameters.h:109
convert_gauge
void convert_gauge(INDEX &index, FIELD &v, const Field &w)
Definition: afield-inc.h:224
AFopr_Staggered_eo::real_t
AFIELD::real_t real_t
Definition: afopr_Staggered_eo.h:45
AFopr_Staggered_eo::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:557
axpy
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:380
AFopr_Staggered_eo::tidyup
void tidyup()
Definition: afopr_Staggered_eo-tmpl.h:148
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Staggered_eo::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Staggered_eo-tmpl.h:761
AFopr_Staggered_eo::set_config
void set_config(Field *U)
setting gauge configuration (common interface).
Definition: afopr_Staggered_eo-tmpl.h:304
copy
void copy(Field &y, const Field &x)
copy(y, x): y = x
Definition: field.cpp:212
AFopr_Staggered_eo::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:539
CommonParameters::Nx
static int Nx()
Definition: commonParameters.h:105
AFopr_Staggered_eo::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:528
CommonParameters::Nc
static int Nc()
Definition: commonParameters.h:115
AFopr_Staggered_eo::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Staggered_eo-tmpl.h:190
QXS_Gauge::set_boundary
void set_boundary(AField< REALTYPE, QXS > &ulex, const std::vector< int > &boundary)
Definition: afield_Gauge-inc.h:24
CommonParameters::Nt
static int Nt()
Definition: commonParameters.h:108
Parameters::fetch_int_vector
int fetch_int_vector(const string &key, vector< int > &value) const
Definition: parameters.cpp:429
Communicator::npe
static int npe(const int dir)
logical grid extent
Definition: communicator.cpp:112
BridgeQXS::mult_staggered_mult_Gd
void mult_staggered_mult_Gd(double *v, double *u, double *w, int *Nsize)
Definition: mult_Staggered_qxs-inc.h:142
BridgeQXS::mult_staggered_axpby
void mult_staggered_axpby(double b, double *y, double a, double *x, int *Nsize, int Nin)
Definition: mult_Staggered_qxs-inc.h:70
AFopr_Staggered_eo::set_staggered_phase
void set_staggered_phase()
Definition: afopr_Staggered_eo-tmpl.h:254
AFopr_Staggered_eo::Meo
void Meo(AFIELD &, const AFIELD &, int ieo)
Definition: afopr_Staggered_eo-tmpl.h:573
BridgeQXS::mult_staggered_clear
void mult_staggered_clear(double *v, int *Nsize, int Nin)
Definition: mult_Staggered_qxs-inc.h:45
threadManager.h
AFopr_Staggered_eo::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Staggered_eo-tmpl.h:519
AFopr_Staggered_eo::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Staggered_eo-tmpl.h:432
BridgeQXS::mult_staggered_eo_bulk
void mult_staggered_eo_bulk(double *v2, double *up, double *v1, double *xp, double qm, int jd, int *Nsize, int *do_comm, int *Leo, int ieo, int iflag)
Definition: mult_Staggered_eo_qxs-inc.h:16
Element_type::REAL
@ REAL
Definition: bridge_defs.h:43
AFopr_Staggered_eo::axpby
void axpby(real_t, real_t *, real_t, real_t *)
Definition: afopr_Staggered_eo-tmpl.h:744
AFopr_Staggered_eo::setup_channels
void setup_channels()
Definition: afopr_Staggered_eo-tmpl.h:156
Parameters::set_int_vector
void set_int_vector(const string &key, const vector< int > &value)
Definition: parameters.cpp:45
AFopr_Staggered_eo::init
void init(const Parameters &params)
Definition: afopr_Staggered_eo-tmpl.h:17
AFopr_Staggered_eo::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Staggered_eo-tmpl.h:413
BridgeQXS::mult_staggered_mult_Gn
void mult_staggered_mult_Gn(double *v, double *u, double *w, int *Nsize)
Definition: mult_Staggered_qxs-inc.h:100
AFopr_Staggered_eo::clear
void clear(real_t *)
Definition: afopr_Staggered_eo-tmpl.h:736
VLENY
#define VLENY
Definition: bridgeQXS_Clover_coarse_double.cpp:14
Field::ptr
const double * ptr(const int jin, const int site, const int jex) const
Definition: field.h:153
CommonParameters::Vlevel
static Bridge::VerboseLevel Vlevel()
Definition: commonParameters.h:122
Bridge::BridgeIO::set_verbose_level
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:133
VLENX
#define VLENX
Definition: bridgeQXS_Clover_coarse_double.cpp:13
AFopr_Staggered_eo::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Staggered_eo-tmpl.h:703
scal
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:261
Communicator::ipe
static int ipe(const int dir)
logical coordinate of current proc.
Definition: communicator.cpp:105
Parameters::fetch_string
int fetch_string(const string &key, string &value) const
Definition: parameters.cpp:378
Parameters::fetch_double
int fetch_double(const string &key, double &value) const
Definition: parameters.cpp:327
AFopr_Staggered_eo::normalize_fprop
void normalize_fprop(AFIELD &v)
normalize propagator if necessary (default: do nothing)
Definition: afopr_Staggered_eo-tmpl.h:390
Parameters::get_string
string get_string(const string &key) const
Definition: parameters.cpp:221
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
AFopr_Staggered_eo::get_parameters
void get_parameters(Parameters &params) const
getting parameters via a Parameters object.
Definition: afopr_Staggered_eo-tmpl.h:243
Field
Container of Field-type object.
Definition: field.h:46
ShiftAField_eo
Methods to shift a field in the even-odd site index.
Definition: shiftAField_eo.h:32
ThreadManager::get_thread_id
static int get_thread_id()
returns thread id.
Definition: threadManager.cpp:253
AFopr_Staggered_eo::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Staggered_eo-tmpl.h:753
Bridge::BridgeIO::general
void general(const char *format,...)
Definition: bridgeIO.cpp:200
BridgeQXS::mult_staggered_eo_2
void mult_staggered_eo_2(double *v2, double *up, double *v1, double *buf_xp, double *buf_xm, double *buf_yp, double *buf_ym, double *buf_zp, double *buf_zm, double *buf_tp, double *buf_tm, double qm, int *Nsize, int *do_comm, int *Leo, int ieo, int iflag)
Definition: mult_Staggered_eo_qxs-inc.h:409
BridgeQXS::mult_staggered_eo_1
void mult_staggered_eo_1(double *buf_xp, double *buf_xm, double *buf_yp, double *buf_ym, double *buf_zp, double *buf_zm, double *buf_tp, double *buf_tm, double *up, double *v1, int *Nsize, int *do_comm, int *Leo, int ieo)
Definition: mult_Staggered_eo_qxs-inc.h:198
ThreadManager::assert_single_thread
static void assert_single_thread(const std::string &class_name)
assert currently running on single thread.
Definition: threadManager.cpp:372
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
Bridge::BridgeIO::get_verbose_level
static std::string get_verbose_level(const VerboseLevel vl)
Definition: bridgeIO.cpp:154
AIndex_eo< real_t, AFIELD::IMPL >