QUDA  v1.1.0
A library for QCD on GPUs
dslash_wilson.cu
Go to the documentation of this file.
1 #include <gauge_field.h>
2 #include <color_spinor_field.h>
3 #include <dslash.h>
4 #include <worker.h>
5 
6 #include <dslash_policy.cuh>
7 #include <kernels/dslash_wilson.cuh>
8 
9 /**
10  This is the basic gauged Wilson operator
11  TODO
12  - gauge fix support
13 */
14 
15 namespace quda
16 {
17 
18  template <typename Arg> class Wilson : public Dslash<wilson, Arg>
19  {
20  using Dslash = Dslash<wilson, Arg>;
21 
22  public:
23  Wilson(Arg &arg, const ColorSpinorField &out, const ColorSpinorField &in) : Dslash(arg, out, in) {}
24 
25  void apply(const qudaStream_t &stream)
26  {
27  TuneParam tp = tuneLaunch(*this, getTuning(), getVerbosity());
28  Dslash::setParam(tp);
29  Dslash::template instantiate<packShmem>(tp, stream);
30  }
31  };
32 
33  template <typename Float, int nColor, QudaReconstructType recon> struct WilsonApply {
34 
35  inline WilsonApply(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, double a,
36  const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
37  {
38  constexpr int nDim = 4;
39  WilsonArg<Float, nColor, nDim, recon> arg(out, in, U, a, x, parity, dagger, comm_override);
40  Wilson<decltype(arg)> wilson(arg, out, in);
41 
42  dslash::DslashPolicyTune<decltype(wilson)> policy(
43  wilson, const_cast<cudaColorSpinorField *>(static_cast<const cudaColorSpinorField *>(&in)), in.VolumeCB(),
44  in.GhostFaceCB(), profile);
45  policy.apply(0);
46  }
47  };
48 
49  // Apply the Wilson operator
50  // out(x) = M*in = - a*\sum_mu U_{-\mu}(x)in(x+mu) + U^\dagger_mu(x-mu)in(x-mu)
51  // Uses the a normalization for the Wilson operator.
52  void ApplyWilson(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, double a,
53  const ColorSpinorField &x, int parity, bool dagger, const int *comm_override, TimeProfile &profile)
54  {
55 #ifdef GPU_WILSON_DIRAC
56  instantiate<WilsonApply, WilsonReconstruct>(out, in, U, a, x, parity, dagger, comm_override, profile);
57 #else
58  errorQuda("Wilson dslash has not been built");
59 #endif // GPU_WILSON_DIRAC
60  }
61 
62 } // namespace quda