QUDA  v0.5.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 
9  DiracWilson(param, 5), m5(param.m5), kappa5(0.5/(5.0 + m5)) { }
10 
12  DiracWilson(dirac), m5(dirac.m5), kappa5(0.5/(5.0 + m5)) { }
13 
15 
17  {
18  if (&dirac != this) {
20  m5 = dirac.m5;
21  kappa5 = dirac.kappa5;
22  }
23  return *this;
24  }
25 
28  const QudaParity parity) const
29  {
30  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
31  checkParitySpinor(in, out);
32  checkSpinorAlias(in, out);
33 
35  setFace(face); // FIXME: temporary hack maintain C linkage for dslashCuda
36  domainWallDslashCuda(&out, gauge, &in, parity, dagger, 0, mass, 0, commDim);
37 
38  long long Ls = in.X(4);
39  long long bulk = (Ls-2)*(in.Volume()/Ls);
40  long long wall = 2*in.Volume()/Ls;
41  flops += 1320LL*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
42  }
43 
47  const double &k) const
48  {
49  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
50  checkParitySpinor(in, out);
51  checkSpinorAlias(in, out);
52 
54  setFace(face); // FIXME: temporary hack maintain C linkage for dslashCuda
55  domainWallDslashCuda(&out, gauge, &in, parity, dagger, &x, mass, k, commDim);
56 
57  long long Ls = in.X(4);
58  long long bulk = (Ls-2)*(in.Volume()/Ls);
59  long long wall = 2*in.Volume()/Ls;
60  flops += (1320LL+48LL)*(long long)in.Volume() + 96LL*bulk + 120LL*wall;
61  }
62 
64  {
65  checkFullSpinor(out, in);
66  DslashXpay(out.Odd(), in.Even(), QUDA_ODD_PARITY, in.Odd(), -kappa5);
67  DslashXpay(out.Even(), in.Odd(), QUDA_EVEN_PARITY, in.Even(), -kappa5);
68  }
69 
71  {
72  checkFullSpinor(out, in);
73 
74  bool reset = newTmp(&tmp1, in);
75 
76  M(*tmp1, in);
77  Mdag(out, *tmp1);
78 
79  deleteTmp(&tmp1, reset);
80  }
81 
84  const QudaSolutionType solType) const
85  {
86  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
87  errorQuda("Preconditioned solution requires a preconditioned solve_type");
88  }
89 
90  src = &b;
91  sol = &x;
92  }
93 
95  const QudaSolutionType solType) const
96  {
97  // do nothing
98  }
99 
101  : DiracDomainWall(param)
102  {
103 
104  }
105 
107  : DiracDomainWall(dirac)
108  {
109 
110  }
111 
113  {
114 
115  }
116 
118  {
119  if (&dirac != this) {
121  }
122 
123  return *this;
124  }
125 
126  // Apply the even-odd preconditioned clover-improved Dirac operator
128  {
129  if ( in.Ndim() != 5 || out.Ndim() != 5) errorQuda("Wrong number of dimensions\n");
130  double kappa2 = -kappa5*kappa5;
131 
132  bool reset = newTmp(&tmp1, in);
133 
135  Dslash(*tmp1, in, QUDA_ODD_PARITY);
136  DslashXpay(out, *tmp1, QUDA_EVEN_PARITY, in, kappa2);
137  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
139  DslashXpay(out, *tmp1, QUDA_ODD_PARITY, in, kappa2);
140  } else {
141  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
142  }
143 
144  deleteTmp(&tmp1, reset);
145  }
146 
148  {
149 #ifdef MULTI_GPU
150  bool reset = newTmp(&tmp2, in);
151  M(*tmp2, in);
152  Mdag(out, *tmp2);
153  deleteTmp(&tmp2, reset);
154 #else
155  M(out, in);
156  Mdag(out, out);
157 #endif
158  }
159 
162  const QudaSolutionType solType) const
163  {
164  // we desire solution to preconditioned system
165  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
166  src = &b;
167  sol = &x;
168  } else {
169  // we desire solution to full system
171  // src = b_e + k D_eo b_o
172  DslashXpay(x.Odd(), b.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
173  src = &(x.Odd());
174  sol = &(x.Even());
175  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
176  // src = b_o + k D_oe b_e
177  DslashXpay(x.Even(), b.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
178  src = &(x.Even());
179  sol = &(x.Odd());
180  } else {
181  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
182  }
183  // here we use final solution to store parity solution and parity source
184  // b is now up for grabs if we want
185  }
186 
187  }
188 
190  const QudaSolutionType solType) const
191  {
192  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
193  return;
194  }
195 
196  // create full solution
197 
198  checkFullSpinor(x, b);
200  // x_o = b_o + k D_oe x_e
201  DslashXpay(x.Odd(), x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa5);
202  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
203  // x_e = b_e + k D_eo x_o
204  DslashXpay(x.Even(), x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa5);
205  } else {
206  errorQuda("MatPCType %d not valid for DiracDomainWallPC", matpcType);
207  }
208  }
209 
210 } // namespace quda