su2hmc
Loading...
Searching...
No Matches
Clover Multiplication routines
Collaboration diagram for Clover Multiplication routines:

Functions

void ByClover (Complex *phi, Complex *r, Complex *clover[2], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
 Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.
void ByClover_f (Complex_f *phi, Complex_f *r, Complex_f *clover[2], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
 Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.
void HbyClover (Complex *phi, Complex *r, Complex *clover[2], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
 Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.
void HbyClover_f (Complex_f *phi, Complex_f *r, Complex_f *clover[2], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
 Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.
void cuByClover (Complex *phi, Complex *r, Complex *clover[nc], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
 CUDA wrapper for ByClover.
void cuHbyClover (Complex *phi, Complex *r, Complex *clover[nc], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
 CUDA wrapper for HbyClover.
void cuByClover_f (Complex_f *phi, Complex_f *r, Complex_f *clover[nc], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
 CUDA wrapper for ByClover_f.
void cuHbyClover_f (Complex_f *phi, Complex_f *r, Complex_f *clover[nc], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
 CUDA wrapper for HbyClover_f.
template<typename T>
__global__ void Kernels::ByClover (complex< T > *phi, const complex< T > *r, const complex< T > *clover1, const complex< T > *clover2, const __grid_constant__ complex< T > sigval_G[24], const __grid_constant__ float akappa, const __grid_constant__ unsigned short sigin_G[24], const __grid_constant__ bool dag)
 Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.
template<typename T>
__global__ void Kernels::HbyClover (complex< T > *phi, const complex< T > *r, const complex< T > *clover1, const complex< T > *clover2, const __grid_constant__ complex< T > sigval[24], const __grid_constant__ float akappa, const __grid_constant__ unsigned short sigin[24], const __grid_constant__ bool dag)
 Clover analogue of the Hdslash operation. The H in front is for half, as we only act on the fermions of flavour 1.

Detailed Description

Function Documentation

◆ ByClover() [1/2]

void ByClover ( Complex * phi,
Complex * r,
Complex * clover[2],
Complex * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered output has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 243 of file clover.c.

243 {
244#ifdef USE_GPU
245 cuByClover(phi,r,clover,sigval,akappa,sigin,dag);
246#else
247#pragma omp parallel for simd
248 for(unsigned int i=0;i<kvol;i++){
249 //Prefetched r and Phi array
250 Complex phi_s[ngorkov][nc];
251#pragma unroll
252 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
253 for(unsigned short c=0; c<nc; c++){
254 phi_s[igorkov][c]=0;
255 }
256 Complex r_s[nc];
257 Complex clov_s[nc];
258#pragma unroll
259 for(unsigned short clov=0;clov<6;clov++){
260 clov_s[0]=clover[0][clov*kvol+i]; clov_s[1]=clover[1][clov*kvol+i];
261 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++){
262 //Mod 4 done bitwise. In general n mod 2^m = n & (2^m-1)
263 const unsigned short idirac = igorkov&3;
264 const unsigned short sind = (igorkov<4) ? sigin[clov*ndirac+idirac] : sigin[clov*ndirac+idirac]+4;
265#pragma unroll
266 for(unsigned short c=0; c<nc; c++)
267 r_s[c]= r[i+kvolHalo*(sind*nc+c)];
269 phi_s[igorkov][0]+=sigval[clov*ndirac+idirac]*(creal(clov_s[0])*r_s[0]+clov_s[1]*r_s[1]);
270 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
271 phi_s[igorkov][1]+=sigval[clov*ndirac+idirac]*(conj(clov_s[1])*r_s[0]-creal(clov_s[0])*r_s[1]);
272 }
273 }
274#pragma unroll
275 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
276 for(unsigned short c=0; c<nc; c++){
277 //dag is just to do with the output layout and if it has a halo
278 if(dag)
279 phi[i+kvol*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
280 else
281 phi[i+kvolHalo*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
282 }
283 }
284#endif
285 return;
286}
void cuByClover(Complex *phi, Complex *r, Complex *clover[nc], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
CUDA wrapper for ByClover.
Definition cuclover.cu:744
__device__ __forceinline__ T conj(const T &z)
Complex Conjugation.
Definition cusu2hmc.cu:33
#define nc
Colours.
Definition sizes.h:186
#define ngorkov
Gor'kov indices.
Definition sizes.h:194
#define kvol
Sublattice volume.
Definition sizes.h:167
#define Complex
Double precision complex number.
Definition sizes.h:68
#define ndirac
Dirac indices.
Definition sizes.h:190
#define kvolHalo
Subvolume + halo size.
Definition sizes.h:238
#define creal(z)
Extract Real Component using C standard notation.

References ByClover(), Complex, conj(), creal, cuByClover(), kvol, kvolHalo, nc, ndirac, and ngorkov.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ByClover() [2/2]

template<typename T>
__global__ void Kernels::ByClover ( complex< T > * phi,
const complex< T > * r,
const complex< T > * clover1,
const complex< T > * clover2,
const __grid_constant__ complex< T > sigval_G[24],
const __grid_constant__ float akappa,
const __grid_constant__ unsigned short sigin_G[24],
const __grid_constant__ bool dag )

Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.

Parameters
[out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]clover1,clover2Array of clovers
[in]sigval_G\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]sigin_GWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered output has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Note that \(\sigma_{\mu\nu}\) was scaled by \(\frac{c_\text{SW}}{2}\) when we defined it.

Definition at line 600 of file cuclover.cu.

604 {
605 const unsigned int gsize = gridDim.x*gridDim.y*gridDim.z;
606 const unsigned int bsize = blockDim.x*blockDim.y*blockDim.z;
607 const unsigned int blockId = blockIdx.x+ blockIdx.y * gridDim.x+ gridDim.x * gridDim.y * blockIdx.z;
608 const unsigned int bthreadId= (threadIdx.z * blockDim.y+ threadIdx.y)* blockDim.x+ threadIdx.x;
609 const unsigned int gthreadId= blockId * bsize+bthreadId;
610 __shared__ complex<T> sigval[24]; __shared__ unsigned short sigin[24];
611#pragma unroll
612 for(unsigned short i=gthreadId%__BSIZE__;i<24;i+=bsize){
613 sigval[i]=sigval_G[i];
614 sigin[i]=sigin_G[i];
615 }
616 __syncthreads();
617
618 for(unsigned int i=gthreadId;i<kvol;i+=bsize*gsize){
619 //Prefetched r and Phi array
620 complex<T> phi_s[ngorkov][nc];
621#pragma unroll
622 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
623 for(unsigned short c=0; c<nc; c++){
624 phi_s[igorkov][c]=0;
625 }
626 complex<T> r_s[nc];
627 complex<T> clov_s[nc];
628 for(unsigned short clov=0;clov<6;clov++){
629 clov_s[0]=clover1[clov*kvol+i]; clov_s[1]=clover2[clov*kvol+i];
630#pragma unroll
631 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++){
632 //Mod 4 done bitwise. In general n mod 2^m = n & (2^m-1)
633 const unsigned short idirac = igorkov&3;
634 const unsigned short sind = (igorkov<4) ? sigin[clov*ndirac+idirac] : sigin[clov*ndirac+idirac]+4;
635#pragma unroll
636 for(unsigned short c=0; c<nc; c++)
637 r_s[c]= r[i+kvolHalo*(sind*nc+c)];
639 phi_s[igorkov][0]+=sigval[clov*ndirac+idirac]*(creal(clov_s[0])*r_s[0]+clov_s[1]*r_s[1]);
640 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
641 phi_s[igorkov][1]+=sigval[clov*ndirac+idirac]*(conj(clov_s[1])*r_s[0]-creal(clov_s[0])*r_s[1]);
642 }
643 }
644#pragma unroll
645 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
646 for(unsigned short c=0; c<nc; c++){
647 //dag is just to do with the output layout and if it has a halo
648 if(dag)
649 phi[i+kvol*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
650 else
651 phi[i+kvolHalo*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
652 }
653 }
654 return;
655 }
#define __BSIZE__
Default block size.
Definition sizes.h:48

References __BSIZE__, ByClover(), conj(), creal, kvol, kvolHalo, nc, ndirac, and ngorkov.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ByClover_f()

void ByClover_f ( Complex_f * phi,
Complex_f * r,
Complex_f * clover[2],
Complex_f * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered output has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 329 of file clover.c.

329 {
330#ifdef USE_GPU
331 cuByClover_f(phi,r,clover,sigval,akappa,sigin,dag);
332#else
333#pragma omp parallel for simd
334 for(unsigned int i=0;i<kvol;i++){
335 //Prefetched r and Phi array
336 Complex_f phi_s[ngorkov][nc];
337#pragma unroll
338 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
339 for(unsigned short c=0; c<nc; c++){
340 phi_s[igorkov][c]=0;
341 }
342 Complex_f r_s[nc];
343 Complex_f clov_s[nc];
344#pragma unroll
345 for(unsigned short clov=0;clov<6;clov++){
346 clov_s[0]=clover[0][clov*kvol+i]; clov_s[1]=clover[1][clov*kvol+i];
347 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++){
348 //Mod 4 done bitwise. In general n mod 2^m = n & (2^m-1)
349 const unsigned short idirac = igorkov&3;
350 const unsigned short sind = (igorkov<4) ? sigin[clov*ndirac+idirac] : sigin[clov*ndirac+idirac]+4;
351#pragma unroll
352 for(unsigned short c=0; c<nc; c++)
353 r_s[c]= r[i+kvolHalo*(sind*nc+c)];
355 phi_s[igorkov][0]+=sigval[clov*ndirac+idirac]*(crealf(clov_s[0])*r_s[0]+clov_s[1]*r_s[1]);
356 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
357 phi_s[igorkov][1]+=sigval[clov*ndirac+idirac]*(conjf(clov_s[1])*r_s[0]-crealf(clov_s[0])*r_s[1]);
358 }
359 }
360#pragma unroll
361 for(unsigned short igorkov=0; igorkov<ngorkov; igorkov++)
362 for(unsigned short c=0; c<nc; c++){
363 //dag is just to do with the output layout and if it has a halo
364 if(dag)
365 phi[i+kvol*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
366 else
367 phi[i+kvolHalo*(nc*igorkov+c)]+=akappa*phi_s[igorkov][c];
368 }
369 }
370#endif
371 return;
372}
void cuByClover_f(Complex_f *phi, Complex_f *r, Complex_f *clover[nc], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
CUDA wrapper for ByClover_f.
Definition cuclover.cu:750
#define Complex_f
Single precision complex number.
Definition sizes.h:66

References ByClover_f(), Complex_f, cuByClover_f(), kvol, kvolHalo, nc, ndirac, and ngorkov.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cuByClover()

void cuByClover ( Complex * phi,
Complex * r,
Complex * clover[nc],
Complex * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

CUDA wrapper for ByClover.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 744 of file cuclover.cu.

744 {
745 Kernels::ByClover<<<dimGrid,dimBlock>>>(phi,r,clover[0],clover[1],sigval,akappa,sigin,dag);
746}
__global__ void ByClover(complex< T > *phi, const complex< T > *r, const complex< T > *clover1, const complex< T > *clover2, const __grid_constant__ complex< T > sigval_G[24], const __grid_constant__ float akappa, const __grid_constant__ unsigned short sigin_G[24], const __grid_constant__ bool dag)
Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dsla...
Definition cuclover.cu:600

References Kernels::ByClover(), Complex, cuByClover(), and nc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cuByClover_f()

void cuByClover_f ( Complex_f * phi,
Complex_f * r,
Complex_f * clover[nc],
Complex_f * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

CUDA wrapper for ByClover_f.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 750 of file cuclover.cu.

750 {
751 Kernels::ByClover<<<dimGrid,dimBlock>>>(phi,r,clover[0],clover[1],sigval,akappa,sigin,dag);
752}

References Kernels::ByClover(), Complex_f, cuByClover_f(), and nc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cuHbyClover()

void cuHbyClover ( Complex * phi,
Complex * r,
Complex * clover[nc],
Complex * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

CUDA wrapper for HbyClover.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 747 of file cuclover.cu.

747 {
748 Kernels::HbyClover<<<dimGrid,dimBlock>>>(phi,r,clover[0],clover[1],sigval,akappa,sigin,dag);
749}
__global__ void HbyClover(complex< T > *phi, const complex< T > *r, const complex< T > *clover1, const complex< T > *clover2, const __grid_constant__ complex< T > sigval[24], const __grid_constant__ float akappa, const __grid_constant__ unsigned short sigin[24], const __grid_constant__ bool dag)
Clover analogue of the Hdslash operation. The H in front is for half, as we only act on the fermions ...
Definition cuclover.cu:672

References Complex, cuHbyClover(), Kernels::HbyClover(), and nc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cuHbyClover_f()

void cuHbyClover_f ( Complex_f * phi,
Complex_f * r,
Complex_f * clover[nc],
Complex_f * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

CUDA wrapper for HbyClover_f.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 753 of file cuclover.cu.

753 {
754 Kernels::HbyClover<<<dimGrid,dimBlock>>>(phi,r,clover[0],clover[1],sigval,akappa,sigin,dag);
755}

References Complex_f, cuHbyClover_f(), Kernels::HbyClover(), and nc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HbyClover() [1/2]

void HbyClover ( Complex * phi,
Complex * r,
Complex * clover[2],
Complex * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered output has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 287 of file clover.c.

287 {
288 const char funcname[] = "HbyClover";
289#ifdef USE_GPU
290 cuHbyClover(phi,r,clover,sigval,akappa,sigin,dag);
291#else
292#pragma omp parallel for simd
293 for(unsigned int i=0;i<kvol;i++){
294 //Prefetched r and Phi array
295 Complex phi_s[ndirac*nc];
296#pragma unroll
297 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc)
298 for(unsigned short c=0; c<nc; c++){
299 phi_s[idirac+c]=0;
300 }
301#pragma unroll
302 for(unsigned short clov=0;clov<6;clov++){
303 const double clov_a=creal(clover[0][clov*kvol+i]);
304 const Complex clov_b=clover[1][clov*kvol+i];
305 // clov_s[0]=; clov_s[1]=k$;
306#pragma unroll
307 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc){
308 const unsigned int sind = i+kvolHalo*(sigin[clov*ndirac+(idirac>>1)] << (nc-1));
309 const Complex r_s[nc]={r[sind],r[sind+kvolHalo]};
311 const Complex sig=sigval[clov*ndirac+(idirac>>1)];
312 phi_s[idirac+0]+=sig*(clov_a*r_s[0]+clov_b*r_s[1]);
313 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
314 phi_s[idirac+1]+=sig*(conj(clov_b)*r_s[0]-clov_a*r_s[1]);
315 }
316 }
317#pragma unroll
318 for(unsigned short idirac=0; idirac<ndirac*nc; idirac++)
319 //dag is just to do with the output layout and if it has a halo
320 if(dag)
321 phi[i+kvol*(idirac)]+=akappa*phi_s[idirac];
322 else
323 phi[i+kvolHalo*(idirac)]+=akappa*phi_s[idirac];
324 }
325#endif
326 return;
327}
void cuHbyClover(Complex *phi, Complex *r, Complex *clover[nc], Complex *sigval, const float akappa, unsigned short *sigin, bool dag)
CUDA wrapper for HbyClover.
Definition cuclover.cu:747

References Complex, conj(), creal, cuHbyClover(), HbyClover(), kvol, kvolHalo, nc, and ndirac.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HbyClover() [2/2]

template<typename T>
__global__ void Kernels::HbyClover ( complex< T > * phi,
const complex< T > * r,
const complex< T > * clover1,
const complex< T > * clover2,
const __grid_constant__ complex< T > sigval[24],
const __grid_constant__ float akappa,
const __grid_constant__ unsigned short sigin[24],
const __grid_constant__ bool dag )

Clover analogue of the Hdslash operation. The H in front is for half, as we only act on the fermions of flavour 1.

Parameters
[out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]clover1,clover2Array of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered has no MPI halo, but undaggered does.
Postcondition
Result added to phi.

Note that \(\sigma_{\mu\nu}\) was scaled by \(\frac{c_\text{SW}}{2}\) when we defined it.

Definition at line 672 of file cuclover.cu.

675 {
676 const unsigned int gsize = gridDim.x*gridDim.y*gridDim.z;
677 const unsigned int bsize = blockDim.x*blockDim.y*blockDim.z;
678 const unsigned int blockId = blockIdx.x+ blockIdx.y * gridDim.x+ gridDim.x * gridDim.y * blockIdx.z;
679 const unsigned int bthreadId= (threadIdx.z * blockDim.y+ threadIdx.y)* blockDim.x+ threadIdx.x;
680 const unsigned int gthreadId= blockId * bsize+bthreadId;
681
682 for(unsigned int i=gthreadId;i<kvol;i+=bsize*gsize){
683 //Prefetched r and Phi array
684 complex<T> phi_s[ndirac*nc];
685#pragma unroll
686 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc)
687#pragma unroll
688 for(unsigned short c=0; c<nc; c++){
689 phi_s[idirac+c]=0;
690 }
691#pragma unroll
692 for(unsigned short clov=0;clov<6;clov++){
693 const T clov_a=creal(clover1[clov*kvol+i]);
694 const complex<T> clov_b=clover2[clov*kvol+i];
695 // clov_s[0]=; clov_s[1]=k$;
696#pragma unroll
697 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc){
698 const complex<T> sig=sigval[clov*ndirac+(idirac>>1)];
699 const unsigned int sind = i+kvolHalo*(sigin[clov*ndirac+(idirac>>1)] << (nc-1));
700 const complex<T> r_s[nc]={r[sind],r[sind+kvolHalo]};
702 phi_s[idirac+0]+=sig*(clov_a*r_s[0]+clov_b*r_s[1]);
703 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
704 phi_s[idirac+1]+=sig*(conj(clov_b)*r_s[0]-clov_a*r_s[1]);
705 }
706 }
707#pragma unroll
708 for(unsigned short idirac=0; idirac<ndirac*nc; idirac++)
709 //dag is just to do with the output layout and if it has a halo
710 if(dag)
711 phi[i+kvol*(idirac)]+=akappa*phi_s[idirac];
712 else
713 phi[i+kvolHalo*(idirac)]+=akappa*phi_s[idirac];
714 }
715 return;
716 }

References __BSIZE__, conj(), creal, HbyClover(), kvol, kvolHalo, nc, and ndirac.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HbyClover_f()

void HbyClover_f ( Complex_f * phi,
Complex_f * r,
Complex_f * clover[2],
Complex_f * sigval,
const float akappa,
unsigned short * sigin,
bool dag )

Clover analogue of the Dslash operation. This version acts on all flavours similar to Dslash and Dslash_d.

Parameters
[in,out]phiFinal pseudofermion field. This is almost always multiplied by Dslash before calling this function
[in]rPseudofermion field before multiplication. The thing we want to multiply by the clover
[in]cloverArray of clovers
[in]sigval\( \sigma_{\mu\nu}\) entries scaled by \( c_{sw}\)
[in]akappaHopping Parameter
[in]siginWhat element of the spinor is multiplied by row idirac each sigma matrix?
[in]dagDaggered output has no MPI halo, but undaggered does.
Postcondition
Result added to phi

Definition at line 373 of file clover.c.

373 {
374 const char funcname[] = "HbyClover_f";
375#ifdef USE_GPU
376 cuHbyClover_f(phi,r,clover,sigval,akappa,sigin,dag);
377#else
378#pragma omp parallel for
379 for(unsigned int i=0;i<kvol;i+=16){
380 //Prefetched r and Phi array
381 Complex_f phi_s[ndirac*nc][16];
382#pragma omp simd
383 for(unsigned short j=0;j<16;j++){
384#pragma unroll(4)
385 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc)
386#pragma unroll(2)
387 for(unsigned short c=0; c<nc; c++){
388 phi_s[idirac+c][j]=0;
389 }
390#pragma unroll(6)
391 for(unsigned short clov=0;clov<6;clov++){
392 const float clov_a=crealf(clover[0][clov*kvol+(i+j)]);
393 const Complex_f clov_b=clover[1][clov*kvol+(i+j)];
394 // clov_s[0]=; clov_s[1]=k$;
395#pragma unroll(4)
396 for(unsigned short idirac=0; idirac<ndirac*nc; idirac+=nc){
397 const unsigned int sind = (i+j)+kvolHalo*(sigin[clov*ndirac+(idirac>>1)] << (nc-1));
398 const Complex_f r_s[nc]={r[sind],r[sind+kvolHalo]};
400 const Complex_f sig=sigval[clov*ndirac+(idirac>>1)];
401 phi_s[idirac+0][j]+=sig*(clov_a*r_s[0]+clov_b*r_s[1]);
402 //Clover is in the Lie Algebra, not Lie group. So signs are correct here.
403 phi_s[idirac+1][j]+=sig*(conjf(clov_b)*r_s[0]-clov_a*r_s[1]);
404 }
405 }
406#pragma unroll(4)
407 for(unsigned short idirac=0; idirac<ndirac*nc; idirac++)
408 //dag is just to do with the output layout and if it has a halo
409 if(dag)
410 phi[(i+j)+kvol*(idirac)]+=akappa*phi_s[idirac][j];
411 else
412 phi[(i+j)+kvolHalo*(idirac)]+=akappa*phi_s[idirac][j];
413 }
414 }
415#endif
416 return;
417}
void cuHbyClover_f(Complex_f *phi, Complex_f *r, Complex_f *clover[nc], Complex_f *sigval, const float akappa, unsigned short *sigin, bool dag)
CUDA wrapper for HbyClover_f.
Definition cuclover.cu:753

References Complex_f, cuHbyClover_f(), HbyClover_f(), kvol, kvolHalo, nc, and ndirac.

Here is the call graph for this function:
Here is the caller graph for this function: