QUDA  v0.7.0
A library for QCD on GPUs
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
7  namespace domainwall {
8 #include <dslash_init.cuh>
9  }
10 
12  DiracWilson(param, 5), m5(param.m5), kappa5(0.5/(5.0 + m5))
13  {
14  domainwall::initConstants(*param.gauge, profile);
15  }
16 
18  DiracWilson(dirac), m5(dirac.m5), kappa5(0.5/(5.0 + m5))
19  {
20  domainwall::initConstants(dirac.gauge, profile);
21  }
22 
24 
26  {
27  if (&dirac != this) {
29  m5 = dirac.m5;
30  kappa5 = dirac.kappa5;
31  }
32  return *this;
33  }
34 
37  const QudaParity parity) const
38  {
39  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
40  checkParitySpinor(in, out);
41  checkSpinorAlias(in, out);
42 
43  domainwall::setFace(face1,face2); // FIXME: temporary hack maintain C linkage for dslashCuda
44  domainWallDslashCuda(&out, gauge, &in, parity, dagger, 0, mass, 0, commDim, profile);
45 
46  long long Ls = in.X(4);
47  long long bulk = (Ls-2)*(in.Volume()/Ls);
48  long long wall = 2*in.Volume()/Ls;
49  flops += 1320LL*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
50  }
51 
52 
53 
57  const double &k) const
58  {
59  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
60  checkParitySpinor(in, out);
61  checkSpinorAlias(in, out);
62 
63  domainwall::setFace(face1,face2); // FIXME: temporary hack maintain C linkage for dslashCuda
64  domainWallDslashCuda(&out, gauge, &in, parity, dagger, &x, mass, k, commDim, profile);
65 
66  long long Ls = in.X(4);
67  long long bulk = (Ls-2)*(in.Volume()/Ls);
68  long long wall = 2*in.Volume()/Ls;
69  flops += (1320LL+48LL)*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
70  }
71 
72 
74  {
75  checkFullSpinor(out, in);
76  DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, in.Odd(), -kappa5);
77  DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, in.Even(), -kappa5);
78  }
79 
81  {
82  checkFullSpinor(out, in);
83 
84  bool reset = newTmp(&tmp1, in);
85 
86  M(*tmp1, in);
87  Mdag(out, *tmp1);
88 
89  deleteTmp(&tmp1, reset);
90  }
91 
94  const QudaSolutionType solType) const
95  {
96  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
97  errorQuda("Preconditioned solution requires a preconditioned solve_type");
98  }
99 
100  src = &b;
101  sol = &x;
102  }
103 
105  const QudaSolutionType solType) const
106  {
107  // do nothing
108  }
109 
111  : DiracDomainWall(param)
112  {
113 
114  }
115 
117  : DiracDomainWall(dirac)
118  {
119 
120  }
121 
123  {
124 
125  }
126 
128  {
129  if (&dirac != this) {
131  }
132 
133  return *this;
134  }
135 
136  // Apply the even-odd preconditioned clover-improved Dirac operator
138  {
139  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
140  double kappa2 = -kappa5*kappa5;
141 
142  bool reset = newTmp(&tmp1, in);
143 
145  Dslash(*tmp1, in, QUDA_ODD_PARITY);
146  DslashXpay(out, *tmp1, QUDA_EVEN_PARITY, in, kappa2);
147  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
149  DslashXpay(out, *tmp1, QUDA_ODD_PARITY, in, kappa2);
150  } else {
151  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
152  }
153 
154  deleteTmp(&tmp1, reset);
155  }
156 
158  {
159  //M(out, in);
160  //Mdag(out, out);
161  bool reset = newTmp(&tmp2, in);
162  M(*tmp2, in);
163  Mdag(out, *tmp2);
164  deleteTmp(&tmp2, reset);
165  }
166 
169  const QudaSolutionType solType) const
170  {
171  // we desire solution to preconditioned system
172  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
173  src = &b;
174  sol = &x;
175  } else {
176  // we desire solution to full system
178  // src = b_e + k D_eo b_o
179  DslashXpay(x.Odd(), b.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
180  src = &(x.Odd());
181  sol = &(x.Even());
182  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
183  // src = b_o + k D_oe b_e
184  DslashXpay(x.Even(), b.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
185  src = &(x.Even());
186  sol = &(x.Odd());
187  } else {
188  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
189  }
190  // here we use final solution to store parity solution and parity source
191  // b is now up for grabs if we want
192  }
193 
194  }
195 
197  const QudaSolutionType solType) const
198  {
199  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
200  return;
201  }
202 
203  // create full solution
204 
205  checkFullSpinor(x, b);
207  // x_o = b_o + k D_oe x_e
208  DslashXpay(x.Odd(), x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
209  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
210  // x_e = b_e + k D_eo x_o
211  DslashXpay(x.Even(), x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
212  } else {
213  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
214  }
215  }
216 
217 
218 } // namespace quda
FaceBuffer face1
Definition: dirac_quda.h:148
cudaGaugeField & gauge
Definition: dirac_quda.h:88
virtual void checkParitySpinor(const cudaColorSpinorField &, const cudaColorSpinorField &) const
Definition: dirac.cpp:84
unsigned long long flops
Definition: dirac_quda.h:93
const int * X() const
#define errorQuda(...)
Definition: util_quda.h:73
bool newTmp(cudaColorSpinorField **, const cudaColorSpinorField &) const
Definition: dirac.cpp:51
#define m5
TimeProfile profile
Definition: dirac_quda.h:104
virtual void prepare(cudaColorSpinorField *&src, cudaColorSpinorField *&sol, cudaColorSpinorField &x, cudaColorSpinorField &b, const QudaSolutionType) const
DiracWilson & operator=(const DiracWilson &dirac)
virtual void MdagM(cudaColorSpinorField &out, const cudaColorSpinorField &in) const
virtual void reconstruct(cudaColorSpinorField &x, const cudaColorSpinorField &b, const QudaSolutionType) const
cudaGaugeField * gauge
Definition: dirac_quda.h:30
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, const QudaDslashPolicy &dslashPolicy=QUDA_DSLASH)
QudaGaugeParam param
Definition: pack_test.cpp:17
void checkSpinorAlias(const cudaColorSpinorField &, const cudaColorSpinorField &) const
Definition: dirac.cpp:129
cudaColorSpinorField & Odd() const
virtual void M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const
int commDim[QUDA_MAX_DIM]
Definition: dirac_quda.h:102
void reconstruct(cudaColorSpinorField &x, const cudaColorSpinorField &b, const QudaSolutionType) const
DiracDomainWallPC(const DiracParam &param)
DiracDomainWall & operator=(const DiracDomainWall &dirac)
cpuColorSpinorField * in
double mass
Definition: dirac_quda.h:90
DiracDomainWall(const DiracParam &param)
enum QudaSolutionType_s QudaSolutionType
void deleteTmp(cudaColorSpinorField **, const bool &reset) const
Definition: dirac.cpp:59
Dirac * dirac
Definition: dslash_test.cpp:45
QudaDagType dagger
Definition: dirac_quda.h:92
enum QudaParity_s QudaParity
DiracDomainWallPC & operator=(const DiracDomainWallPC &dirac)
int x[4]
QudaMatPCType matpcType
Definition: dirac_quda.h:91
FaceBuffer face2
Definition: dirac_quda.h:148
cudaColorSpinorField * tmp2
Definition: dirac_quda.h:95
virtual void checkFullSpinor(const cudaColorSpinorField &, const cudaColorSpinorField &) const
Definition: dirac.cpp:121
void Dslash(cudaColorSpinorField &out, const cudaColorSpinorField &in, const QudaParity parity) const
NEW : added setFace(), domainWallDslashCuda() got an extra argument.
cpuColorSpinorField * out
cudaColorSpinorField * tmp1
Definition: dirac_quda.h:94
void prepare(cudaColorSpinorField *&src, cudaColorSpinorField *&sol, cudaColorSpinorField &x, cudaColorSpinorField &b, const QudaSolutionType) const
void M(cudaColorSpinorField &out, const cudaColorSpinorField &in) const
void Mdag(cudaColorSpinorField &out, const cudaColorSpinorField &in) const
Definition: dirac.cpp:68
void DslashXpay(cudaColorSpinorField &out, const cudaColorSpinorField &in, const QudaParity parity, const cudaColorSpinorField &x, const double &k) const
NEW : added setFace(), domainWallDslashCuda() got an extra argument.
const QudaParity parity
Definition: dslash_test.cpp:29
cudaColorSpinorField & Even() const
double kappa5
Definition: dslash_test.cpp:32
void MdagM(cudaColorSpinorField &out, const cudaColorSpinorField &in) const