16 template <
typename Float,
int nColor, QudaReconstructType reconstruct_>
struct LaplaceArg :
DslashArg<Float> {
39 DslashArg<Float>(in, U, parity, dagger, a != 0.0 ? true : false, 1, false, comm_override),
49 if (dir < 3 || dir > 4)
errorQuda(
"Unsupported laplace direction %d (must be 3 or 4)", dir);
70 int thread_dim,
bool &active)
75 const int their_spinor_parity = (arg.
nParity == 2) ? 1 - parity : 0;
78 for (
int d = 0; d < nDim; d++) {
82 const bool ghost = (coord[d] + 1 >= arg.dim[d]) && isActive<kernel_type>(active, thread_dim, d, coord, arg);
84 if (doHalo<kernel_type>(d) &&
ghost) {
87 const int ghost_idx = ghostFaceIndex<1>(coord, arg.dim, d, arg.nFace);
88 const Link
U = arg.U(d, x_cb, parity);
89 const Vector in = arg.in.Ghost(d, 1, ghost_idx, their_spinor_parity);
92 }
else if (doBulk<kernel_type>() && !ghost) {
95 const Link
U = arg.U(d, x_cb, parity);
96 const Vector in = arg.in(fwd_idx, their_spinor_parity);
104 const int back_idx =
linkIndexM1(coord, arg.dim, d);
105 const int gauge_idx = back_idx;
107 const bool ghost = (coord[d] - 1 < 0) && isActive<kernel_type>(active, thread_dim, d, coord, arg);
109 if (doHalo<kernel_type>(d) &&
ghost) {
112 const int ghost_idx = ghostFaceIndex<0>(coord, arg.dim, d, arg.nFace);
114 const Link
U = arg.U.Ghost(d, ghost_idx, 1 - parity);
115 const Vector in = arg.in.Ghost(d, 0, ghost_idx, their_spinor_parity);
118 }
else if (doBulk<kernel_type>() && !ghost) {
120 const Link
U = arg.U(d, gauge_idx, 1 - parity);
121 const Vector in = arg.in(back_idx, their_spinor_parity);
131 template <
typename Float,
int nDim,
int nColor,
int nParity,
bool dagger,
bool xpay, KernelType kernel_type,
typename Arg>
145 int x_cb = getCoords<nDim, QUDA_4D_PC, kernel_type, Arg>(coord,
arg, idx,
parity, thread_dim);
147 const int my_spinor_parity = nParity == 2 ?
parity : 0;
155 applyLaplace<Float, nDim, nColor, nParity, dagger, kernel_type, 3>(
out,
arg, coord, x_cb,
parity, idx, thread_dim,
160 applyLaplace<Float, nDim,
nColor,
nParity,
dagger,
kernel_type, -1>(
out,
arg, coord, x_cb,
parity, idx,
166 Vector x = arg.x(x_cb, my_spinor_parity);
167 out = x + arg.a *
out;
169 Vector x = arg.out(x_cb, my_spinor_parity);
177 template <
typename Float,
int nDim,
int nColor,
int nParity,
bool dagger,
bool xpay, KernelType kernel_type,
typename Arg>
181 int x_cb = blockIdx.x * blockDim.x + threadIdx.x;
182 if (x_cb >= arg.threads)
return;
185 int parity = nParity == 2 ? blockDim.z * blockIdx.z + threadIdx.z : arg.parity;
188 case 0: laplace<Float, nDim, nColor, nParity, dagger, xpay, kernel_type>(
arg, x_cb, 0);
break;
189 case 1: laplace<Float, nDim, nColor, nParity, dagger, xpay, kernel_type>(
arg, x_cb, 1);
break;
LaplaceArg(ColorSpinorField &out, const ColorSpinorField &in, const GaugeField &U, int dir, double a, const ColorSpinorField &x, int parity, bool dagger, const int *comm_override)
QudaGaugeFieldOrder FieldOrder() const
gauge_mapper< Float, reconstruct, 18, QUDA_STAGGERED_PHASE_NO, gauge_direct_load, ghost >::type G
mapper< Float >::type real
Parameter structure for driving the covariatnt derivative operator.
static __device__ __host__ int linkIndexM1(const int x[], const I X[4], const int mu)
colorspinor_mapper< Float, nSpin, nColor, spin_project, spinor_direct_load >::type F
enum QudaGhostExchange_s QudaGhostExchange
Main header file for host and device accessors to GaugeFields.
static constexpr int nSpin
static constexpr QudaGhostExchange ghost
static constexpr bool spin_project
enum QudaReconstructType_s QudaReconstructType
__device__ __host__ void applyLaplace(Vector &out, Arg &arg, int coord[nDim], int x_cb, int parity, int idx, int thread_dim, bool &active)
__host__ __device__ ValueType arg(const complex< ValueType > &z)
Returns the phase angle of z.
static constexpr bool spinor_direct_load
__device__ __host__ void laplace(Arg &arg, int idx, int parity)
__global__ void laplaceGPU(Arg arg)
__host__ __device__ ValueType conj(ValueType x)
static __device__ __host__ int linkIndexP1(const int x[], const I X[4], const int mu)
QudaFieldOrder FieldOrder() const
static constexpr QudaReconstructType reconstruct
static constexpr bool gauge_direct_load