QUDA  v1.1.0
A library for QCD on GPUs
dirac_clover_hasenbusch_twist.cpp
Go to the documentation of this file.
1 #include <dirac_quda.h>
2 #include <blas_quda.h>
3 #include <multigrid.h>
4 
5 namespace quda
6 {
7 
9 
12  mu(dirac.mu)
13  {
14  }
15 
17 
19  {
20  if (&dirac != this) {
22  clover = dirac.clover;
23  mu = dirac.mu;
24  }
25  return *this;
26  }
27 
29  {
31 
32  if (!asymmetric) {
37  profile);
38  } else {
40  profile);
43  }
44 
45  // 2 c/b applies of DiracClover + (1-imu gamma_5 A)psi_{!p}
46  flops += 2 * 1872ll * in.VolumeCB() + (48ll + 504ll) * in.VolumeCB();
47  } else {
50  profile);
52  commDim, profile);
53  } else {
55  commDim, profile);
57  profile);
58  }
59  // 2 c/b applies of DiracClover + (1-imu gamma_5)psi_{!p}
60  flops += 2 * 1872ll * in.VolumeCB() + 48ll * in.VolumeCB();
61  }
62  }
63 
65  {
66  checkFullSpinor(out, in);
67 
68  bool reset = newTmp(&tmp1, in);
69  checkFullSpinor(*tmp1, in);
70 
71  M(*tmp1, in);
72  Mdag(out, *tmp1);
73 
74  deleteTmp(&tmp1, reset);
75  }
76 
78  double mass, double mu, double mu_factor) const
79  {
80  // double a = 2.0 * kappa * mu * T.Vectors().TwistFlavor();
81  // CoarseOp(Y, X, T, *gauge, &clover, kappa, a, mu_factor, QUDA_CLOVER_DIRAC, QUDA_MATPC_INVALID);
82  errorQuda("Not Yet Implemented");
83  }
84 
85  /* **********************************************
86  * DiracCloverHasenbuschTwistPC Starts Here
87  * ********************************************* */
88 
91  mu(param.mu)
92  {
93  }
94 
97  mu(dirac.mu)
98  {
99  }
100 
102 
104  {
105  if (&dirac != this) {
107  mu = dirac.mu;
108  }
109  return *this;
110  }
111 
112  // xpay version of the above
114  const QudaParity parity, const ColorSpinorField &x,
115  const double &k, const double &b) const
116  {
117  checkParitySpinor(in, out);
118  checkSpinorAlias(in, out);
119 
121 
122  // DiracCloverPC.DslashXPay -/+ mu ( i gamma_5 ) A
123  flops += (1872ll + 48ll + 504ll) * in.Volume();
124  }
125 
126  // xpay version of the above
128  const QudaParity parity, const ColorSpinorField &x,
129  const double &k, const double &b) const
130  {
131  checkParitySpinor(in, out);
132  checkSpinorAlias(in, out);
133 
135 
136  // DiracCloverPC.DslashXPay -/+ mu ( i gamma_5 )
137  flops += (1872ll + 48) * in.Volume();
138  }
139 
140  // Apply the even-odd preconditioned clover-improved Dirac operator
142  {
143  double kappa2 = -kappa * kappa;
144  bool reset1 = newTmp(&tmp1, in);
145 
146  bool symmetric = (matpcType == QUDA_MATPC_EVEN_EVEN || matpcType == QUDA_MATPC_ODD_ODD) ? true : false;
147  int odd_bit = (matpcType == QUDA_MATPC_ODD_ODD || matpcType == QUDA_MATPC_ODD_ODD_ASYMMETRIC) ? 1 : 0;
148  QudaParity parity[2] = {static_cast<QudaParity>((1 + odd_bit) % 2), static_cast<QudaParity>((0 + odd_bit) % 2)};
149 
150  if (!symmetric) {
151  // No need to change order of calls for dagger
152  // because the asymmetric operator is actually symmetric
153  // A_oo -D_oe A^{-1}_ee D_eo -> A_oo -D^\dag_oe A^{-1}_ee D^\dag_eo
154  // the pieces in Dslash and DslashXPay respect the dagger
155 
156  // DiracCloverHasenbuschTwistPC::Dslash applies A^{-1}Dslash
157  Dslash(*tmp1, in, parity[0]);
158 
159  // applies (A + imu*g5 - kappa^2 D)-
160  ApplyTwistedClover(out, *tmp1, *gauge, *clover, kappa2, mu, in, parity[1], dagger, commDim, profile);
161  flops += 1872ll * in.Volume();
162  } else if (!dagger) { // symmetric preconditioning
163  // We need two cases because M = 1-ADAD and M^\dag = 1-D^\dag A D^dag A
164  // where A is actually a clover inverse.
165 
166  // This is the non-dag case: AD
167  Dslash(*tmp1, in, parity[0]);
168 
169  // Then x + AD (AD)
170  DslashXpayTwistClovInv(out, *tmp1, parity[1], in, kappa2, mu);
171  } else { // symmetric preconditioning, dagger
172  // This is the dagger: 1 - DADA
173  // i) Apply A
174  CloverInv(out, in, parity[1]);
175  // ii) Apply A D => ADA
176  Dslash(*tmp1, out, parity[0]);
177  // iii) Apply x + D(ADA)
178  DslashXpayTwistNoClovInv(out, *tmp1, parity[1], in, kappa2, mu);
179  }
180 
181  deleteTmp(&tmp1, reset1);
182  }
183 
185  {
186  // need extra temporary because of symmetric preconditioning dagger
187  // and for multi-gpu the input and output fields cannot alias
188  bool reset = newTmp(&tmp2, in);
189  M(*tmp2, in);
190  Mdag(out, *tmp2);
191  deleteTmp(&tmp2, reset);
192  }
193 
195  double mass, double mu, double mu_factor) const
196  {
197  // double a = - 2.0 * kappa * mu * T.Vectors().TwistFlavor();
198  // CoarseOp(Y, X, T, *gauge, &clover, kappa, a, -mu_factor,QUDA_CLOVERPC_DIRAC, matpcType);
199  errorQuda("Not yet implemented\n");
200  }
201 
202 } // namespace quda
const ColorSpinorField & Odd() const
const ColorSpinorField & Even() const
void createCoarseOp(GaugeField &Y, GaugeField &X, const Transfer &T, double kappa, double mass=0., double mu=0., double mu_factor=0.) const
Create the coarse clover operator.
virtual void M(ColorSpinorField &out, const ColorSpinorField &in) const
Apply M for the dirac op. E.g. the Schur Complement operator.
DiracCloverHasenbuschTwist & operator=(const DiracCloverHasenbuschTwist &dirac)
virtual void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
Apply MdagM operator which may be optimized.
void DslashXpayTwistNoClovInv(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k, const double &b) const
void createCoarseOp(GaugeField &Y, GaugeField &X, const Transfer &T, double kappa, double mass=0., double mu=0., double mu_factor=0.) const
Create the coarse even-odd preconditioned clover operator. Unlike the Wilson operator,...
void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
Apply MdagM operator which may be optimized.
DiracCloverHasenbuschTwistPC & operator=(const DiracCloverHasenbuschTwistPC &dirac)
void M(ColorSpinorField &out, const ColorSpinorField &in) const
Apply M for the dirac op. E.g. the Schur Complement operator.
void DslashXpayTwistClovInv(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k, const double &b) const
void checkParitySpinor(const ColorSpinorField &, const ColorSpinorField &) const
Check parity spinors are usable (check geometry ?)
cudaCloverField * clover
Definition: dirac_quda.h:470
void Dslash(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
apply 'dslash' operator for the DiracOp. This may be e.g. AD
DiracCloverPC & operator=(const DiracCloverPC &dirac)
void CloverInv(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
unsigned long long flops
Definition: dirac_quda.h:150
bool newTmp(ColorSpinorField **, const ColorSpinorField &) const
Definition: dirac.cpp:72
double kappa
Definition: dirac_quda.h:145
QudaMatPCType matpcType
Definition: dirac_quda.h:148
cudaGaugeField * gauge
Definition: dirac_quda.h:144
void deleteTmp(ColorSpinorField **, const bool &reset) const
Definition: dirac.cpp:83
ColorSpinorField * tmp1
Definition: dirac_quda.h:151
TimeProfile profile
Definition: dirac_quda.h:161
QudaDagType dagger
Definition: dirac_quda.h:149
void checkSpinorAlias(const ColorSpinorField &, const ColorSpinorField &) const
check spinors do not alias
Definition: dirac.cpp:146
virtual void checkFullSpinor(const ColorSpinorField &, const ColorSpinorField &) const
check full spinors are compatible (check geometry ?)
Definition: dirac.cpp:138
ColorSpinorField * tmp2
Definition: dirac_quda.h:152
int commDim[QUDA_MAX_DIM]
Definition: dirac_quda.h:159
void Mdag(ColorSpinorField &out, const ColorSpinorField &in) const
Apply Mdag (daggered operator of M.
Definition: dirac.cpp:92
DiracWilson & operator=(const DiracWilson &dirac)
double kappa
double mass
double mu
quda::mgarray< double > mu_factor
GaugeCovDev * dirac
Definition: covdev_test.cpp:42
QudaParity parity
Definition: covdev_test.cpp:40
@ QUDA_EVEN_PARITY
Definition: enum_quda.h:284
@ QUDA_ODD_PARITY
Definition: enum_quda.h:284
@ QUDA_MATPC_ODD_ODD_ASYMMETRIC
Definition: enum_quda.h:219
@ QUDA_MATPC_EVEN_EVEN_ASYMMETRIC
Definition: enum_quda.h:218
@ QUDA_MATPC_ODD_ODD
Definition: enum_quda.h:217
@ QUDA_MATPC_EVEN_EVEN
Definition: enum_quda.h:216
enum QudaParity_s QudaParity
void ApplyWilsonCloverHasenbuschTwistPCClovInv(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, const CloverField &A, double kappa, double mu, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
Driver for applying the twisted-mass stencil.
void ApplyWilsonClover(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, const CloverField &A, double kappa, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
Driver for applying the Wilson-clover stencil.
void ApplyTwistedClover(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, const CloverField &C, double a, double b, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
Driver for applying the twisted-clover stencil.
void ApplyWilsonCloverHasenbuschTwistPCNoClovInv(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, const CloverField &A, double kappa, double mu, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
Driver for applying the Wilson-clover stencil with thist for Hasenbusch.
void ApplyWilsonCloverHasenbuschTwist(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, const CloverField &A, double kappa, double mu, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
Driver for applying the Wilson-clover stencil.
QudaGaugeParam param
Definition: pack_test.cpp:18
#define errorQuda(...)
Definition: util_quda.h:120