4
6
8
10
12
14 {
18 }
19 return *this;
20 }
21
23 {
25
28 }
29 }
30
34 const double &k) const
35 {
38
41 }
42
43 // Public method to apply the clover term only
45 {
47
50 }
51
53 {
56 }
57
59 {
61
64
67
69 }
70
74 {
76 errorQuda(
"Preconditioned solution requires a preconditioned solve_type");
77 }
78
79 src = &b;
80 sol = &x;
81 }
82
85 {
86 // do nothing
87 }
88
92 errorQuda(
"Wilson-type operators only support aggregation coarsening");
93
95 CoarseOp(Y, X, T, *
gauge,
clover,
kappa,
mass, a,
mu_factor,
QUDA_CLOVER_DIRAC,
QUDA_MATPC_INVALID);
96 }
97
99 {
102 }
103
104 /*******
105 * DiracCloverPC Starts here
106 *******/
109 {
110 // For the preconditioned operator, we need to check that the inverse of the clover term is present
112 }
113
115
117
119 {
120 if (&
dirac !=
this) {
122 }
123 return *this;
124 }
125
126 // Public method
129 {
131
134 }
135
136 // apply hopping term, then clover: (A_ee^-1 D_eo) or (A_oo^-1 D_oe),
137 // and likewise for dagger: (A_ee^-1 D^dagger_eo) or (A_oo^-1 D^dagger_oe)
138 // NOTE - this isn't Dslash dagger since order should be reversed!
141 {
144
147 }
148
149 // xpay version of the above
152 const double &k) const
153 {
156
159 }
160
161 // Apply the even-odd preconditioned clover-improved Dirac operator
163 {
166
170
171 if (!symmetric) {
172
173 // No need to change order of calls for dagger
174 // because the asymmetric operator is actually symmetric
175 // A_oo -D_oe A^{-1}_ee D_eo -> A_oo -D^\dag_oe A^{-1}_ee D^\dag_eo
176 // the pieces in Dslash and DslashXPay respect the dagger
177
178 // DiracCloverPC::Dslash applies A^{-1}Dslash
180 // DiracClover::DslashXpay applies (A - kappa^2 D)
182 }
else if (!
dagger) {
// symmetric preconditioning
183 // We need two cases because M = 1-ADAD and M^\dag = 1-D^\dag A D^dag A
184 // where A is actually a clover inverse.
185
186 // This is the non-dag case: AD
188
189 // Then x + AD (AD)
191 } else { // symmetric preconditioning, dagger
192
193 // This is the dagger: 1 - DADA
194 // i) Apply A
196 // ii) Apply A D => ADA
198 // iii) Apply x + D(ADA)
200 }
201
203 }
204
206 {
207 // need extra temporary because of symmetric preconditioning dagger
208 // and for multi-gpu the input and output fields cannot alias
213 }
214
218 {
219 // we desire solution to preconditioned system
221 src = &b;
222 sol = &x;
223 return;
224 }
225
227
228 // we desire solution to full system
230 // src = A_ee^-1 (b_e + k D_eo A_oo^-1 b_o)
237 // src = A_oo^-1 (b_o + k D_oe A_ee^-1 b_e)
244 // src = b_e + k D_eo A_oo^-1 b_o
250 // src = b_o + k D_oe A_ee^-1 b_e
255 } else {
257 }
258
259 // here we use final solution to store parity solution and parity source
260 // b is now up for grabs if we want
261
263
264 }
265
268 {
270 return;
271 }
272
274
276
277 // create full solution
278
281 // x_o = A_oo^-1 (b_o + k D_oe x_e)
286 // x_e = A_ee^-1 (b_e + k D_eo x_o)
289 } else {
291 }
292
294
295 }
296
300 errorQuda(
"Wilson-type operators only support aggregation coarsening");
301
303 CoarseOp(Y, X, T, *
gauge,
clover,
kappa,
mass, a, -
mu_factor,
QUDA_CLOVERPC_DIRAC,
matpcType);
304 }
305
307 {
309
313
314 if (symmetric) {
316 } else {
319 }
320 }
321
322 } // namespace quda
const ColorSpinorField & Odd() const
QudaTwistFlavorType TwistFlavor() const
const ColorSpinorField & Even() const
virtual void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
Apply MdagM operator which may be optimized.
DiracClover & operator=(const DiracClover &dirac)
virtual void DslashXpay(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k) const
DiracClover(const DiracParam ¶m)
virtual void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
virtual void M(ColorSpinorField &out, const ColorSpinorField &in) const
Apply M for the dirac op. E.g. the Schur Complement operator.
void checkParitySpinor(const ColorSpinorField &, const ColorSpinorField &) const
Check parity spinors are usable (check geometry ?)
void Clover(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) 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 prefetch(QudaFieldLocation mem_space, qudaStream_t stream=0) const
If managed memory and prefetch is enabled, prefetch all relevant memory fields (gauge,...
virtual void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) const
void MdagM(ColorSpinorField &out, const ColorSpinorField &in) const
Apply MdagM operator which may be optimized.
void Dslash(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
apply 'dslash' operator for the DiracOp. This may be e.g. AD
void DslashXpay(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k) const
void M(ColorSpinorField &out, const ColorSpinorField &in) const
Apply M for the dirac op. E.g. the Schur Complement operator.
void prepare(ColorSpinorField *&src, ColorSpinorField *&sol, ColorSpinorField &x, ColorSpinorField &b, const QudaSolutionType) 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,...
DiracCloverPC & operator=(const DiracCloverPC &dirac)
void CloverInv(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity) const
virtual void prefetch(QudaFieldLocation mem_space, qudaStream_t stream=0) const
If managed memory and prefetch is enabled, prefetch all relevant memory fields (gauge,...
void reconstruct(ColorSpinorField &x, const ColorSpinorField &b, const QudaSolutionType) const
DiracCloverPC(const DiracParam ¶m)
bool newTmp(ColorSpinorField **, const ColorSpinorField &) const
virtual void prefetch(QudaFieldLocation mem_space, qudaStream_t stream=0) const
If managed memory and prefetch is enabled, prefetch the gauge field and temporary spinors to the CPU ...
void deleteTmp(ColorSpinorField **, const bool &reset) const
virtual void checkParitySpinor(const ColorSpinorField &, const ColorSpinorField &) const
Check parity spinors are usable (check geometry ?)
void checkSpinorAlias(const ColorSpinorField &, const ColorSpinorField &) const
check spinors do not alias
virtual void checkFullSpinor(const ColorSpinorField &, const ColorSpinorField &) const
check full spinors are compatible (check geometry ?)
int commDim[QUDA_MAX_DIM]
void Mdag(ColorSpinorField &out, const ColorSpinorField &in) const
Apply Mdag (daggered operator of M.
DiracWilson & operator=(const DiracWilson &dirac)
virtual void DslashXpay(ColorSpinorField &out, const ColorSpinorField &in, const QudaParity parity, const ColorSpinorField &x, const double &k) const
Xpay version of Dslash.
QudaTransferType getTransferType() const
const ColorSpinorField & Vectors(QudaFieldLocation location=QUDA_INVALID_FIELD_LOCATION) const
void prefetch(QudaFieldLocation mem_space, qudaStream_t stream=0) const
If managed memory and prefetch is enabled, prefetch the clover, the norm field (as appropriate),...
quda::mgarray< double > mu_factor
@ QUDA_TRANSFER_AGGREGATE
enum QudaSolutionType_s QudaSolutionType
enum QudaFieldLocation_s QudaFieldLocation
@ QUDA_MATPC_ODD_ODD_ASYMMETRIC
@ QUDA_MATPC_EVEN_EVEN_ASYMMETRIC
@ QUDA_MATPCDAG_MATPC_SOLUTION
enum QudaParity_s QudaParity
void ApplyClover(ColorSpinorField &out, const ColorSpinorField &in, const CloverField &clover, bool inverse, int parity)
Apply clover-matrix field to a color-spinor field.
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.
@ INVERSE_CLOVER_PREFETCH_TYPE
@ CLOVER_CLOVER_PREFETCH_TYPE
void ApplyWilsonCloverPreconditioned(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 preconditioned Wilson-clover stencil.
void CoarseOp(GaugeField &Y, GaugeField &X, const Transfer &T, const cudaGaugeField &gauge, const cudaCloverField *clover, double kappa, double mass, double mu, double mu_factor, QudaDiracType dirac, QudaMatPCType matpc)
Coarse operator construction from a fine-grid operator (Wilson / Clover)
cudaStream_t qudaStream_t