QUDA  0.9.0
gauge_laplace.cpp
Go to the documentation of this file.
1 #include <dirac_quda.h>
2 #include <blas_quda.h>
3 #include <iostream>
4 #include <multigrid.h>
5 #include <stencil.h>
6 
7 namespace quda {
8 
10 
12 
14 
16  {
17  if (&laplace != this) Dirac::operator=(laplace);
18  return *this;
19  }
20 
22  {
24 
25  ApplyLaplace(out, in, *gauge, 1.0, nullptr, parity);
26 
27  flops += 1320ll*in.Volume(); // FIXME
28  }
29 
31  const QudaParity parity, const ColorSpinorField &x,
32  const double &k) const
33  {
35 
36  ApplyLaplace(out, in, *gauge, k, &x, parity);
37 
38  flops += 1368ll*in.Volume(); // FIXME
39  }
40 
42  {
45  }
46 
48  {
49  bool reset = newTmp(&tmp1, in);
51 
52  M(*tmp1, in);
53  Mdag(out, *tmp1);
54 
55  deleteTmp(&tmp1, reset);
56  }
57 
60  const QudaSolutionType solType) const
61  {
62  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
63  errorQuda("Preconditioned solution requires a preconditioned solve_type");
64  }
65 
66  src = &b;
67  sol = &x;
68  }
69 
71  const QudaSolutionType solType) const
72  {
73  // do nothing
74  }
75 
77 
79 
81 
83  {
85  return *this;
86  }
87 
89  {
90  double kappa2 = -kappa*kappa;
91 
92  bool reset = newTmp(&tmp1, in);
93 
96  DslashXpay(out, *tmp1, QUDA_EVEN_PARITY, in, kappa2);
97  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
99  DslashXpay(out, *tmp1, QUDA_ODD_PARITY, in, kappa2);
100  } else {
101  errorQuda("MatPCType %d not valid for GaugeLaplacePC", matpcType);
102  }
103 
104  deleteTmp(&tmp1, reset);
105  }
106 
108  {
109  bool reset = newTmp(&tmp2, in);
110  M(*tmp2, in);
111  Mdag(out, *tmp2);
112  deleteTmp(&tmp2, reset);
113  }
114 
117  const QudaSolutionType solType) const
118  {
119  // we desire solution to preconditioned system
120  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
121  src = &b;
122  sol = &x;
123  } else {
124  // we desire solution to full system
126  // src = b_e + k D_eo b_o
127  DslashXpay(x.Odd(), b.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa);
128  src = &(x.Odd());
129  sol = &(x.Even());
130  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
131  // src = b_o + k D_oe b_e
132  DslashXpay(x.Even(), b.Even(), QUDA_ODD_PARITY, b.Odd(), kappa);
133  src = &(x.Even());
134  sol = &(x.Odd());
135  } else {
136  errorQuda("MatPCType %d not valid for GaugeLaplacePC", matpcType);
137  }
138  // here we use final solution to store parity solution and parity source
139  // b is now up for grabs if we want
140  }
141 
142  }
143 
145  const QudaSolutionType solType) const
146  {
147  if (solType == QUDA_MATPC_SOLUTION || solType == QUDA_MATPCDAG_MATPC_SOLUTION) {
148  return;
149  }
150 
151  // create full solution
152 
153  checkFullSpinor(x, b);
155  // x_o = b_o + k D_oe x_e
156  DslashXpay(x.Odd(), x.Even(), QUDA_ODD_PARITY, b.Odd(), kappa);
157  } else if (matpcType == QUDA_MATPC_ODD_ODD) {
158  // x_e = b_e + k D_eo x_o
159  DslashXpay(x.Even(), x.Odd(), QUDA_EVEN_PARITY, b.Even(), kappa);
160  } else {
161  errorQuda("MatPCType %d not valid for GaugeLaplacePC", matpcType);
162  }
163  }
164 
165 } // namespace quda
Even-odd preconditioned Gauge Laplace operator.
Definition: dirac_quda.h:926
unsigned long long flops
Definition: dirac_quda.h:100
GaugeLaplacePC & operator=(const GaugeLaplacePC &laplace)
GaugeLaplacePC(const DiracParam &param)
const void * src
virtual void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) const
#define errorQuda(...)
Definition: util_quda.h:90
cudaGaugeField * gauge
Definition: dirac_quda.h:95
virtual void checkFullSpinor(const ColorSpinorField &, const ColorSpinorField &) const
Definition: dirac.cpp:129
virtual void DslashXpay(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k) const
GaugeLaplace(const DiracParam &param)
void deleteTmp(ColorSpinorField **, const bool &reset) const
Definition: dirac.cpp:64
virtual void M(ColorSpinorField &out, const ColorSpinorField &in) const
__device__ __host__ void laplace(Arg &arg, int x_cb, int parity)
Definition: laplace.cu:113
QudaGaugeParam param
Definition: pack_test.cpp:17
bool newTmp(ColorSpinorField **, const ColorSpinorField &) const
Definition: dirac.cpp:53
void M(ColorSpinorField &out, const ColorSpinorField &in) const
#define b
void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
void checkSpinorAlias(const ColorSpinorField &, const ColorSpinorField &) const
Definition: dirac.cpp:137
cpuColorSpinorField * in
virtual void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
enum QudaSolutionType_s QudaSolutionType
enum QudaParity_s QudaParity
double kappa
Definition: dirac_quda.h:96
QudaMatPCType matpcType
Definition: dirac_quda.h:98
void Mdag(ColorSpinorField &out, const ColorSpinorField &in) const
Definition: dirac.cpp:73
virtual void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
Dirac & operator=(const Dirac &dirac)
Definition: dirac.cpp:32
GaugeCovDev * dirac
Definition: covdev_test.cpp:75
cpuColorSpinorField * out
void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) const
virtual void Dslash(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
Full Gauge Laplace operator. Although not a Dirac operator per se, it&#39;s a linear operator so it&#39;s con...
Definition: dirac_quda.h:901
void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
GaugeLaplace & operator=(const GaugeLaplace &laplace)
void ApplyLaplace(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, double kappa, const ColorSpinorField *x, int parity)
Driver for applying the Laplace stencil.
Definition: laplace.cu:210
QudaParity parity
Definition: covdev_test.cpp:53
ColorSpinorField * tmp2
Definition: dirac_quda.h:102
ColorSpinorField * tmp1
Definition: dirac_quda.h:101