12 template<
typename AFIELD>
16 template<
typename AFIELD>
32 vout.
general(m_vl,
"%s: construction\n", class_name.c_str());
38 if (repr !=
"Dirac") {
39 vout.
crucial(
" Error at %s: unsupported gamma-matrix type: %s\n",
40 class_name.c_str(), repr.c_str());
55 m_Ndf = 2 * m_Nc * m_Nc;
66 m_Nx2v = m_Nx2 /
VLENX;
68 m_Nst2v = m_Nst2 /
VLEN;
76 if (m_Nx % (2 *
VLENX) != 0) {
77 vout.
crucial(m_vl,
"%s: Nx must be mulriple of 2*VLENX.\n",
81 if (m_Ny % (
VLENY) != 0) {
82 vout.
crucial(m_vl,
"%s: Ny must be multiple of VLENY.\n",
91 m_Leo.resize(m_Ny * m_Nz * m_Nt);
96 for (
int t = 0; t < m_Nt; ++t) {
97 for (
int z = 0; z < m_Nz; ++z) {
98 for (
int y = 0; y < m_Ny; ++y) {
99 int t2 = ipe3 * m_Nt + t;
100 int z2 = ipe2 * m_Nz + z;
101 int y2 = ipe1 * m_Ny + y;
102 m_Leo[y + m_Ny * (z + m_Nz * t)] = (y2 + z2 + t2) % 2;
113 for (
int mu = 0; mu < m_Ndim; ++mu) {
116 do_comm_any += do_comm[mu];
117 vout.
general(
" do_comm[%d] = %d\n", mu, do_comm[mu]);
121 m_bdsize.resize(m_Ndim);
123 m_bdsize[0] = m_Nvc * Nd2 * ((m_Ny * m_Nz * m_Nt + 1) / 2);
124 m_bdsize[1] = m_Nvc * Nd2 * m_Nx2 * m_Nz * m_Nt;
125 m_bdsize[2] = m_Nvc * Nd2 * m_Nx2 * m_Ny * m_Nt;
126 m_bdsize[3] = m_Nvc * Nd2 * m_Nx2 * m_Ny * m_Nz;
131 m_Ulex.reset(m_Ndf, m_Nst, m_Ndim);
132 m_Ueo.reset(m_Ndf, m_Nst, m_Ndim);
135 int NinF = 2 * m_Nc * m_Nd;
136 m_v1.reset(NinF, m_Nst2, 1);
137 m_v2.reset(NinF, m_Nst2, 1);
139 m_z1.reset(NinF, m_Nst, 1);
143 set_parameters(params);
153 template<
typename AFIELD>
156 chsend_up.resize(m_Ndim);
157 chrecv_up.resize(m_Ndim);
158 chsend_dn.resize(m_Ndim);
159 chrecv_dn.resize(m_Ndim);
161 for (
int mu = 0; mu < m_Ndim; ++mu) {
162 size_t Nvsize = m_bdsize[mu] *
sizeof(
real_t);
164 chsend_dn[mu].send_init(Nvsize, mu, -1);
165 chsend_up[mu].send_init(Nvsize, mu, 1);
167 chrecv_up[mu].recv_init(Nvsize, mu, 1);
168 chrecv_dn[mu].recv_init(Nvsize, mu, -1);
170 void *buf_up = (
void *)chsend_dn[mu].ptr();
171 chrecv_up[mu].recv_init(Nvsize, mu, 1, buf_up);
172 void *buf_dn = (
void *)chsend_up[mu].ptr();
173 chrecv_dn[mu].recv_init(Nvsize, mu, -1, buf_dn);
176 if (do_comm[mu] == 1) {
177 chset_send.append(chsend_up[mu]);
178 chset_send.append(chsend_dn[mu]);
179 chset_recv.append(chrecv_up[mu]);
180 chset_recv.append(chrecv_dn[mu]);
187 template<
typename AFIELD>
197 template<
typename AFIELD>
200 const string str_vlevel = params.
get_string(
"verbose_level");
211 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
216 set_parameters(
real_t(kappa), bc);
221 template<
typename AFIELD>
223 const std::vector<int> bc)
225 assert(bc.size() == m_Ndim);
233 m_boundary.resize(m_Ndim);
234 for (
int mu = 0; mu < m_Ndim; ++mu) {
235 m_boundary[mu] = bc[mu];
239 vout.
general(m_vl,
"%s: set parameters\n", class_name.c_str());
240 vout.
general(m_vl,
" gamma-matrix type = %s\n", m_repr.c_str());
242 for (
int mu = 0; mu < m_Ndim; ++mu) {
243 vout.
general(m_vl,
" boundary[%d] = %2d\n", mu, m_boundary[mu]);
251 template<
typename AFIELD>
254 params.
set_double(
"hopping_parameter",
double(m_CKs));
256 params.
set_string(
"gamma_matrix_type", m_repr);
263 template<
typename AFIELD>
268 vout.
detailed(m_vl,
"%s: set_config is called: num_threads = %d\n",
269 class_name.c_str(), nth);
277 vout.
detailed(m_vl,
"%s: set_config finished\n", class_name.c_str());
282 template<
typename AFIELD>
295 template<
typename AFIELD>
300 int ith, nth, is, ns;
303 if (ith == 0) m_conf = u;
314 set_threadtask_mult(ith, nth, is, ns, m_Nst);
316 for (
int ex = 0; ex < m_Ndim; ++ex) {
317 for (
int site = is; site < ns; ++site) {
318 for (
int in = 0; in < m_Ndf; ++in) {
319 int iv1 = index_lex2.idx(in, m_Ndf, site, ex);
320 int iv2 = index_eo.idx(in, m_Ndf, site, ex);
321 m_Ueo.e(iv2) = m_Ulex.cmp(iv1);
331 template<
typename AFIELD>
342 template<
typename AFIELD>
353 template<
typename AFIELD>
359 if (ith == 0) m_mode = mode;
366 template<
typename AFIELD>
371 }
else if (m_mode ==
"DdagD") {
373 }
else if (m_mode ==
"Ddag") {
376 vout.
crucial(m_vl,
"%s: mode undefined.\n", class_name.c_str());
383 template<
typename AFIELD>
389 }
else if (m_mode ==
"DdagD") {
391 }
else if (m_mode ==
"Ddag") {
394 vout.
crucial(m_vl,
"%s: mode undefined.\n", class_name.c_str());
401 template<
typename AFIELD>
416 template<
typename AFIELD>
420 if (Nst != v.
nvol()) {
421 vout.
crucial(m_vl,
"%s: sizes of fields inconsisutent in mult_gm4.\n",
429 int ith, nth, is, ns;
430 set_threadtask_mult(ith, nth, is, ns, m_Nst);
435 for (
int site = is; site < ns; ++site) {
436 for (
int ic = 0; ic <
NC; ++ic) {
437 vp[m_index.idxh_SPr(ic, 0, site, 0)] = wp[m_index.idxh_SPr(ic, 0, site, 0)];
438 vp[m_index.idxh_SPi(ic, 0, site, 0)] = wp[m_index.idxh_SPi(ic, 0, site, 0)];
439 vp[m_index.idxh_SPr(ic, 1, site, 0)] = wp[m_index.idxh_SPr(ic, 1, site, 0)];
440 vp[m_index.idxh_SPi(ic, 1, site, 0)] = wp[m_index.idxh_SPi(ic, 1, site, 0)];
441 vp[m_index.idxh_SPr(ic, 2, site, 0)] = -wp[m_index.idxh_SPr(ic, 2, site, 0)];
442 vp[m_index.idxh_SPi(ic, 2, site, 0)] = -wp[m_index.idxh_SPi(ic, 2, site, 0)];
443 vp[m_index.idxh_SPr(ic, 3, site, 0)] = -wp[m_index.idxh_SPr(ic, 3, site, 0)];
444 vp[m_index.idxh_SPi(ic, 3, site, 0)] = -wp[m_index.idxh_SPi(ic, 3, site, 0)];
453 template<
typename AFIELD>
455 const std::string mode)
459 }
else if (mode ==
"Doo") {
461 }
else if (mode ==
"Dee_inv") {
463 }
else if (mode ==
"Doo_inv") {
465 }
else if (mode ==
"Deo") {
467 }
else if (mode ==
"Doe") {
470 vout.
crucial(m_vl,
"%s: illegal mode is given to mult with mode\n",
478 template<
typename AFIELD>
489 template<
typename AFIELD>
501 template<
typename AFIELD>
505 Meo(v, m_v1, w, 0, 1);
510 template<
typename AFIELD>
523 template<
typename AFIELD>
527 mult_Meo_qxs(v, w, w, ieo, 0);
532 template<
typename AFIELD>
535 const int ieo,
const int iflag)
537 mult_Meo_qxs(v, w, x, ieo, iflag);
542 template<
typename AFIELD>
545 const int ieo,
const int iflag)
557 if (do_comm_any > 0) {
558 if (ith == 0) chset_recv.start();
570 buf1_zp, buf1_zm, buf1_tp, buf1_tm,
571 up, v1, &m_boundary[0],
572 m_Nsize, do_comm, &m_Leo[0], ieo, iflag);
576 if (ith == 0) chset_send.start();
580 m_Nsize, do_comm, &m_Leo[0], ieo, iflag);
582 if (do_comm_any > 0) {
583 if (ith == 0) chset_recv.wait();
597 buf2_xp, buf2_xm, buf2_yp, buf2_ym,
598 buf2_zp, buf2_zm, buf2_tp, buf2_tm,
599 m_CKs, &m_boundary[0],
600 m_Nsize, do_comm, &m_Leo[0], ieo, iflag);
602 if (ith == 0) chset_send.wait();
610 template<
typename AFIELD>
613 int ith, nth, is, ns;
614 set_threadtask_mult(ith, nth, is, ns, m_Nst2);
616 int Ncd = m_Nvc * m_Nd;
618 for (
int i = is; i < ns; ++i) {
619 for (
int icd = 0; icd < Ncd; ++icd) {
620 int i2 = icd + Ncd * i;
621 v[i2] = a * v[i2] + w[i2];
629 template<
typename AFIELD>
632 int ith, nth, is, ns;
633 set_threadtask_mult(ith, nth, is, ns, m_Nst2);
636 int Ncd = m_Nvc * m_Nd;
638 for (
int i = is; i < ns; ++i) {
639 for (
int icd = 0; icd < Ncd; ++icd) {
640 v[icd + Ncd * i] = zero;
649 template<
typename AFIELD>
652 int ith, nth, is, ns;
653 set_threadtask_mult(ith, nth, is, ns, m_Nst2);
655 int Ncd = m_Nvc * m_Nd;
657 for (
int i = is; i < ns; ++i) {
658 for (
int icd = 0; icd < Ncd; ++icd) {
659 v[icd + Ncd * i] *= a;
668 template<
typename AFIELD>
675 double flop_site, flop;
677 if (m_repr ==
"Dirac") {
678 flop_site =
static_cast<double>(
679 m_Nc * m_Nd * (4 + 6 * (4 * m_Nc + 2) + 2 * (4 * m_Nc + 1)));
680 }
else if (m_repr ==
"Chiral") {
681 flop_site =
static_cast<double>(
682 m_Nc * m_Nd * (4 + 8 * (4 * m_Nc + 2)));
684 vout.
crucial(m_vl,
"%s: input repr is undefined.\n");
688 if (mode ==
"Deo" ||
"Doe") {
689 flop_site = 0.5 * flop_site;
692 flop = flop_site *
static_cast<double>(Lvol);
693 if ((mode ==
"DdagD") || (mode ==
"DDdag")) flop *= 2.0;