QUDA  0.9.0
dirac_domain_wall.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <dirac_quda.h>
3 #include <blas_quda.h>
4 
5 namespace quda {
6 
8  DiracWilson(param, 5), m5(param.m5), kappa5(0.5/(5.0 + m5)) { }
9 
11  DiracWilson(dirac), m5(dirac.m5), kappa5(0.5/(5.0 + m5)) { }
12 
14 
16  {
17  if (&dirac != this) {
19  m5 = dirac.m5;
20  kappa5 = dirac.kappa5;
21  }
22  return *this;
23  }
24 
26  const QudaParity parity) const
27  {
28  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
32  domainWallDslashCuda(&static_cast<cudaColorSpinorField&>(out), *gauge,
33  &static_cast<const cudaColorSpinorField&>(in),
34  parity, dagger, 0, mass, 0, commDim, profile);
35  } else {
36  errorQuda("Not implemented");
37  }
38 
39  long long Ls = in.X(4);
40  long long bulk = (Ls-2)*(in.Volume()/Ls);
41  long long wall = 2*in.Volume()/Ls;
42  flops += 1320LL*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
43  }
44 
46  const QudaParity parity, const ColorSpinorField &x,
47  const double &k) const
48  {
49  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
52 
54  domainWallDslashCuda(&static_cast<cudaColorSpinorField&>(out), *gauge,
55  &static_cast<const cudaColorSpinorField&>(in),
56  parity, dagger,
57  &static_cast<const cudaColorSpinorField&>(x),
58  mass, k, commDim, profile);
59  } else {
60  errorQuda("Not implemented");
61  }
62 
63  long long Ls = in.X(4);
64  long long bulk = (Ls-2)*(in.Volume()/Ls);
65  long long wall = 2*in.Volume()/Ls;
66  flops += (1320LL+48LL)*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
67  }
68 
70  {
72  DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, in.Odd(), -kappa5);
73  DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, in.Even(), -kappa5);
74  }
75 
77  {
79 
80  bool reset = newTmp(&tmp1, in);
81 
82  M(*tmp1, in);
83  Mdag(out, *tmp1);
84 
85  deleteTmp(&tmp1, reset);
86  }
87 
90  const QudaSolutionType solType) const
91  {
92  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
93  errorQuda("Preconditioned solution requires a preconditioned solve_type");
94  }
95 
96  src = &b;
97  sol = &x;
98  }
99 
101  const QudaSolutionType solType) const
102  {
103  // do nothing
104  }
105 
108  {
109 
110  }
111 
114  {
115 
116  }
117 
119  {
120 
121  }
122 
124  {
125  if (&dirac != this) {
127  }
128 
129  return *this;
130  }
131 
132  // Apply the even-odd preconditioned clover-improved Dirac operator
134  {
135  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
136  double kappa2 = -kappa5*kappa5;
137 
138  bool reset = newTmp(&tmp1, in);
139 
142  DslashXpay(out, *tmp1, QUDA_EVEN_PARITY, in, kappa2);
143  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
145  DslashXpay(out, *tmp1, QUDA_ODD_PARITY, in, kappa2);
146  } else {
147  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
148  }
149 
150  deleteTmp(&tmp1, reset);
151  }
152 
154  {
155  //M(out, in);
156  //Mdag(out, out);
157  bool reset = newTmp(&tmp2, in);
158  M(*tmp2, in);
159  Mdag(out, *tmp2);
160  deleteTmp(&tmp2, reset);
161  }
162 
165  const QudaSolutionType solType) const
166  {
167  // we desire solution to preconditioned system
168  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
169  src = &b;
170  sol = &x;
171  } else {
172  // we desire solution to full system
174  // src = b_e + k D_eo b_o
175  DslashXpay(x.Odd(), b.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
176  src = &(x.Odd());
177  sol = &(x.Even());
178  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
179  // src = b_o + k D_oe b_e
180  DslashXpay(x.Even(), b.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
181  src = &(x.Even());
182  sol = &(x.Odd());
183  } else {
184  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
185  }
186  // here we use final solution to store parity solution and parity source
187  // b is now up for grabs if we want
188  }
189 
190  }
191 
193  const QudaSolutionType solType) const
194  {
195  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
196  return;
197  }
198 
199  // create full solution
200 
201  checkFullSpinor(x, b);
203  // x_o = b_o + k D_oe x_e
204  DslashXpay(x.Odd(), x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
205  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
206  // x_e = b_e + k D_eo x_o
207  DslashXpay(x.Even(), x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
208  } else {
209  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
210  }
211  }
212 
213 
214 } // namespace quda
void M(ColorSpinorField &out, const ColorSpinorField &in) const
unsigned long long flops
Definition: dirac_quda.h:100
void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) const
const void * src
#define errorQuda(...)
Definition: util_quda.h:90
virtual void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
cudaGaugeField * gauge
Definition: dirac_quda.h:95
void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
virtual void checkFullSpinor(const ColorSpinorField &, const ColorSpinorField &) const
Definition: dirac.cpp:129
void Dslash(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
void deleteTmp(ColorSpinorField **, const bool &reset) const
Definition: dirac.cpp:64
#define m5
TimeProfile profile
Definition: dirac_quda.h:112
DiracWilson & operator=(const DiracWilson &dirac)
QudaGaugeParam param
Definition: pack_test.cpp:17
bool newTmp(ColorSpinorField **, const ColorSpinorField &) const
Definition: dirac.cpp:53
#define b
int commDim[QUDA_MAX_DIM]
Definition: dirac_quda.h:110
DiracDomainWallPC(const DiracParam &param)
virtual void M(ColorSpinorField &out, const ColorSpinorField &in) const
DiracDomainWall & operator=(const DiracDomainWall &dirac)
void checkSpinorAlias(const ColorSpinorField &, const ColorSpinorField &) const
Definition: dirac.cpp:137
cpuColorSpinorField * in
double mass
Definition: dirac_quda.h:97
DiracDomainWall(const DiracParam &param)
#define checkLocation(...)
enum QudaSolutionType_s QudaSolutionType
QudaDagType dagger
Definition: dirac_quda.h:99
enum QudaParity_s QudaParity
DiracDomainWallPC & operator=(const DiracDomainWallPC &dirac)
QudaMatPCType matpcType
Definition: dirac_quda.h:98
void Mdag(ColorSpinorField &out, const ColorSpinorField &in) const
Definition: dirac.cpp:73
virtual void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) const
GaugeCovDev * dirac
Definition: covdev_test.cpp:75
cpuColorSpinorField * out
void domainWallDslashCuda(cudaColorSpinorField *out, const cudaGaugeField &gauge, const cudaColorSpinorField *in, const int parity, const int dagger, const cudaColorSpinorField *x, const double &m_f, const double &k, const int *commDim, TimeProfile &profile)
void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
void DslashXpay(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k) const
virtual void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
virtual void checkParitySpinor(const ColorSpinorField &, const ColorSpinorField &) const
Definition: dirac.cpp:89
QudaParity parity
Definition: covdev_test.cpp:53
ColorSpinorField * tmp2
Definition: dirac_quda.h:102
double kappa5
ColorSpinorField * tmp1
Definition: dirac_quda.h:101