24 const char funcname[] =
"Q_allocate";
29 cudaMallocManaged((
void **)x2_f,
kferm2*
sizeof(
Complex_f),cudaMemAttachGlobal);
31 cudaMallocManaged((
void **)r_f,
kferm2*
sizeof(
Complex_f),cudaMemAttachGlobal);
32 cudaMallocManaged((
void **)X1_f,
kferm2*
sizeof(
Complex_f),cudaMemAttachGlobal);
65 const char funcname[] =
"Q_allocate";
68 cudaMallocManaged((
void **)&clover[0], 6*
kvol*
sizeof(
Complex),cudaMemAttachGlobal);
69 cudaMallocManaged((
void **)&clover[1], 6*
kvol*
sizeof(
Complex),cudaMemAttachGlobal);
72 cudaMallocManaged((
void **)x2,
kferm2*
sizeof(
Complex),cudaMemAttachGlobal);
107 cudaMallocManaged((
void **)r_f,
kferm*
sizeof(
Complex_f),cudaMemAttachGlobal);
109 cudaMallocManaged((
void **)x2_f,
kferm*
sizeof(
Complex_f),cudaMemAttachGlobal);
110 cudaMallocManaged((
void **)xi_f,
kferm*
sizeof(
Complex_f),cudaMemAttachGlobal);
143 cudaMallocManaged((
void **)&clover[0], 6*
kvol*
sizeof(
Complex),cudaMemAttachGlobal);
144 cudaMallocManaged((
void **)&clover[1], 6*
kvol*
sizeof(
Complex),cudaMemAttachGlobal);
145 cudaMallocManaged((
void **)p,
kfermHalo*
sizeof(
Complex), cudaMemAttachGlobal);
146 cudaMallocManaged((
void **)r,
kferm*
sizeof(
Complex), cudaMemAttachGlobal);
147 cudaMallocManaged((
void **)x1,
kfermHalo*
sizeof(
Complex), cudaMemAttachGlobal);
148 cudaMallocManaged((
void **)x2,
kferm*
sizeof(
Complex), cudaMemAttachGlobal);
182 const char funcname[] =
"Q_free";
186 cudaFree(*x1_f);cudaFree(*x2_f); cudaFree(*p_f);
187 cudaFree(*r_f); cudaFree(*X1_f);
195 free(*x1_f); free(*x2_f); free(*p_f); free(*r_f);free(*X1_f);
212 const char funcname[] =
"Qree";
216 cudaFree(*x1);cudaFree(*x2); cudaFree(*p);
217 cudaFree(clover[0]); cudaFree(clover[1]);
220 cudaFreeAsync(clover[0],
streams[0]); cudaFreeAsync(clover[1],
streams[1]);
225 free(*x1);free(*x2); free(*p);
226 free(clover[0]); free(clover[1]);
245 cudaFree(*p_f); cudaFree(*r_f);cudaFree(*x1_f); cudaFree(*x2_f); cudaFree(*xi_f);
247 free(*p_f); free(*r_f); free(*x1_f); free(*x2_f); free(*xi_f);
266 cudaFree(clover[0]); cudaFree(clover[1]);
267 cudaFree(*p);cudaFree(*r);cudaFree(*x1); cudaFree(*x2);
269 cudaFreeAsync(clover[0],
streams[0]); cudaFreeAsync(clover[1],
streams[1]);
273 free(*p); free(*r); free(*x1); free(*x2);
274 free(clover[0]); free(clover[1]);
279 unsigned int *iu,
unsigned int *
id,
Complex gamval[20],
Complex_f gamval_f[20],
const unsigned short gamin[16],
280 Complex *sigval,
Complex_f *sigval_f,
unsigned short *sigin,
double *dk[2],
float *dk_f[2],
281 Complex_f jqq,
float akappa,
float c_sw,
int *itercg){
282 const char funcname[] =
"Congradq";
284 const double resid = res*res;
286#warning "CG Debugging"
287 char *endline =
"\n";
289 char *endline =
"\r";
294 const float d_prec=1.0f/128.0f;
300 alignas(16)
double alphan=1;
305 alignas(16)
double betad = 1.0;
alignas(8)
Complex_f alphad=0;
alignas(16)
Complex alpha = 1;
308 Complex_f *p_f, *x1_f, *x2_f, *r_f, *X1_f;
309 Complex *p, *x1, *x2, *clover[2];
317 for(
unsigned short j=0;j<
nc*
ndirac;j++)
333 for(
unsigned int j=0;j<
nc*
ndirac;j++)
340#pragma omp parallel for simd aligned(X1_f,r_f,X1,r:AVX)
341 for(
unsigned int j=0;j<
nc*
ndirac;j++)
345 alignas(16)
double betan=1;
double beta_max=FLT_MAX;
bool do_dp=
true;
346 for(*itercg=0; *itercg<
niterc; (*itercg)++){
350 printf(
"Going to double precision on iteration %d. betan %e\talpha %e.\n",
351 *itercg,betan,
creal(alpha));
354 printf(
"\nGoing to double precision on iteration %d. betan %e\talpha %e.\n",
355 *itercg,betan,
creal(alpha));
370#pragma omp parallel for simd collapse(2) aligned(X1,X1_f:AVX)
371 for(
unsigned short j=0;j<
nc*
ndirac;j++)
372 for(
unsigned int i=0;i<
kvol;i++){
379 Hdslash(x1,p,ud,iu,
id,gamval,gamin,dk,akappa);
382 HbyClover(x1,p,clover,sigval,akappa,sigin,
false);
383 Hdslashd(x2,x1,ud,iu,
id,gamval,gamin,dk,akappa);
386 HbyClover(x2,x1,clover,sigval,akappa,sigin,
true);
391 alignas(16)
const double fac=(
double)fac_f;
395 for(
unsigned short j=0;j<
nc*
ndirac;j++)
399 cublasZaxpy(
cublas_handle,
kferm2,(cuDoubleComplex *)&fac,(cuDoubleComplex *)p,1,(cuDoubleComplex *)x2,1);
401#elif defined USE_BLAS
402 for(
unsigned short j=0;j<
nc*
ndirac;j++)
405#pragma omp parallel for simd collapse(2) aligned(p,x2:AVX)
406 for(
unsigned short j=0;j<
nc*
ndirac;j++)
407 for(
unsigned int i=0; i<
kvol; i++)
417 for(
unsigned short j=0;j<
nc*
ndirac;j++){
423 cublasZdotc(
cublas_handle,
kferm2,(cuDoubleComplex *)p,1,(cuDoubleComplex *)x2,1,(cuDoubleComplex *)&alpha);
425#elif defined USE_BLAS
426 for(
unsigned short j=0;j<
nc*
ndirac;j++){
429 alpha+=
creal(alpha_t);
432#pragma omp parallel for simd collapse(2) aligned(p,x2:AVX) reduction(+:alpha)
433 for(
unsigned short j=0;j<
nc*
ndirac;j++)
434 for(
unsigned int i=0; i<
kvol; i++)
443 alpha=alphan/
creal(alpha);
447 for(
unsigned short j=0;j<
nc*
ndirac;j++)
450 cublasZaxpy(
cublas_handle,
kferm2,(cuDoubleComplex *)&alpha,(cuDoubleComplex *)p,1,(cuDoubleComplex *)X1,1);
452#elif defined USE_BLAS
453 for(
unsigned short j=0;j<
nc*
ndirac;j++)
456#pragma omp parallel for simd collapse(2) aligned(p,X1:AVX)
457 for(
unsigned short j=0;j<
nc*
ndirac;j++)
458 for(
unsigned int i=0; i<
kvol; i++)
465 cublasZaxpy(
cublas_handle,
kferm2,(cuDoubleComplex *)&alpha_m,(cuDoubleComplex *)x2,1,(cuDoubleComplex *)r,1);
466 alignas(16)
double betan_d;
468 betan=betan_d*betan_d;
469#elif defined USE_BLAS
471 cblas_zaxpy(
kferm2, &alpha_m, x2, 1, r, 1);
473 double betan_d = cblas_dznrm2(
kferm2, r,1);
475 betan = betan_d*betan_d;
478#pragma omp parallel for simd aligned(r_f,x2_f:AVX) reduction(+:betan)
479 for(
unsigned int i=0; i<
kferm2; i++){
481 betan +=
conj(r[i])*r[i];
483 alignas(16)
double betan_d=sqrt(betan);
493 if(!
rank) printf(
"DP Iter(CG)=%i\tbeta_n=%e\talpha=%e\n", *itercg, betan,
creal(alpha));
496 alignas(16)
const Complex beta = (*itercg) ? betan/betad : 0;
497 betad=betan; alphan=betan;
502 for(
unsigned short j=0;j<
nc*
ndirac;j++){
509 cublasZaxpy(
cublas_handle,
kferm2,(cuDoubleComplex *)&alpha_m,(cuDoubleComplex *)r,1,(cuDoubleComplex *)p,1);
511#elif (defined __USE_MKL__||defined OPENBLAS||defined AMD_BLAS)
515 for(
unsigned short j=0;j<
nc*
ndirac;j++)
519 for(
unsigned short j=0;j<
nc*
ndirac;j++){
524#pragma omp parallel for simd collapse(2) aligned(r,p:AVX)
525 for(
unsigned short j=0;j<
nc*
ndirac;j++)
526 for(
unsigned int i=0; i<
kvol; i++)
532 if(!
rank) printf(
"Double precision. Iter(CG)=%i\tbeta_n=%e\talpha=%e\n", *itercg, betan,
creal(alpha));
538 if(!
rank) printf(
"\nIter(CG)=%i\tResidue: %e\tTolerance: %e\n", *itercg, betan, resid);
548 Hdslash_f(x1_f,p_f,ut,iu,
id,gamval_f,gamin,dk_f,akappa);
551 HbyClover_f(x1_f,p_f,clover_f,sigval_f,akappa,sigin,
false);
552 Hdslashd_f(x2_f,x1_f,ut,iu,
id,gamval_f,gamin,dk_f,akappa);
555 HbyClover_f(x2_f,x1_f,clover_f,sigval_f,akappa,sigin,
true);
565 for(
unsigned short j=0;j<
nc*
ndirac;j++)
569 cublasCaxpy(
cublas_handle,
kferm2,(cuComplex *)&fac_f,(cuComplex *)p_f,1,(cuComplex *)x2_f,1);
571#elif defined USE_BLAS
572 for(
unsigned short j=0;j<
nc*
ndirac;j++)
575#pragma omp parallel for simd collapse(2) aligned(p_f,x2_f:AVX)
576 for(
unsigned short j=0;j<
nc*
ndirac;j++)
577 for(
unsigned int i=0; i<
kvol; i++)
587 for(
unsigned short j=0;j<
nc*
ndirac;j++){
593 cublasCdotc(
cublas_handle,
kferm2,(cuComplex *)p_f,1,(cuComplex *)x2_f,1,(cuComplex *)&alphad);
595#elif defined USE_BLAS
596 for(
unsigned short j=0;j<
nc*
ndirac;j++){
599 alphad+=
creal(alpha_t);
602#pragma omp parallel for simd aligned(p_f,x2_f:AVX) reduction(alphad:+)
603 for(
unsigned short j=0;j<
nc*
ndirac;j++)
604 for(
unsigned int i=0; i<
kvol; i++)
613 alpha=alphan/
creal(alphad);
618 for(
unsigned short j=0;j<
nc*
ndirac;j++)
621 cublasCaxpy(
cublas_handle,
kferm2,(cuComplex *)&alpha_f,(cuComplex *)p_f,1,(cuComplex *)X1_f,1);
623#elif defined USE_BLAS
625 for(
unsigned short j=0;j<
nc*
ndirac;j++)
628#pragma omp parallel for simd collapse(2) aligned(X1_f,p_f:AVX)
629 for(
unsigned short j=0;j<
nc*
ndirac;j++)
630 for(
unsigned int i=0; i<
kvol; i++)
638 cublasCaxpy(
cublas_handle,
kferm2,(cuComplex *)&alpha_m,(cuComplex *)x2_f,1,(cuComplex *)r_f,1);
639 alignas(8)
float betan_f;
641 betan = betan_f*betan_f;
642#elif defined USE_BLAS
644 cblas_caxpy(
kferm2, &alpha_m, x2_f, 1, r_f, 1);
646 float betan_f = cblas_scnrm2(
kferm2, r_f,1);
648 betan = betan_f*betan_f;
651#pragma omp parallel for simd aligned(r_f,x2_f:AVX) reduction(+:betan)
652 for(
unsigned int i=0; i<
kferm2; i++){
653 r_f[i]-=alpha*x2_f[i];
654 betan +=
conj(r_f[i])*r_f[i];
656 alignas(8)
float betan_f=sqrt(betan);
664 beta_max = (betan_f>beta_max) ?betan_f : beta_max;
667 if(!
rank) printf(
"Iter(CG)=%i\tbeta_n=%e\talpha=%e%s", *itercg, betan,
creal(alpha),endline);
670 if(betan_f<beta_max*d_prec){
673 printf(
"\nResidue %e is less than %e times %e.%s",betan_f,d_prec,beta_max,endline);
677 else if(betan<resid){
680 printf(
"\nBetan %e is less than target residue %e.\n",betan,resid);
685 else if(*itercg==
niterc-1){
686 if(!
rank) fprintf(stderr,
"\nWarning %i in %s: Exceeded iteration limit %i beta_n=%e\n",\
687 ITERLIM, funcname, *itercg, betan);
693 Complex beta = (*itercg) ? betan/betad : 0;
694 betad=betan; alphan=betan;
701 for(
unsigned short j=0;j<
nc*
ndirac;j++){
707 cublasCaxpy(
cublas_handle,
kferm2,(cuComplex *)&alpha_m,(cuComplex *)r_f,1,(cuComplex *)p_f,1);
709#elif (defined __USE_MKL__||defined OPENBLAS||defined AMD_BLAS)
714 for(
unsigned short j=0;j<
nc*
ndirac;j++)
716#elif defined USE_BLAS
719 for(
unsigned short j=0;j<
nc*
ndirac;j++){
724#pragma omp parallel for simd collapse(2) aligned(p_f,r_f:AVX)
725 for(
unsigned short j=0;j<
nc*
ndirac;j++)
726 for(
unsigned int i=0; i<
kvol; i++)
731 Q_free_f(&p_f,&x1_f,&x2_f,&r_f,&X1_f);
732 Q_free(&p,&x1,&x2,clover);
736 unsigned int *iu,
unsigned int *
id,
Complex gamval[20],
Complex_f gamval_f[20],
const unsigned short gamin[16],
737 Complex *sigval,
Complex_f *sigval_f,
unsigned short *sigin,
double *dk[2],
float *dk_f[2],
738 Complex_f jqq,
float akappa,
float c_sw,
int *itercg){
739 const char funcname[] =
"Congradp";
742 const double resid = res*res;
744#warning "CG Debugging"
745 char *endline =
"\n";
747 char *endline =
"\r";
752 const float d_prec=1.0f/128.0f;
755 alignas(8)
double alphan=1.0;
759 alignas(8)
double betad = 1.0;
alignas(8)
Complex_f alphad=0;
alignas(16)
Complex alpha = 1;
761 Complex_f *p_f, *r_f, *x1_f, *x2_f, *xi_f;
778 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
790 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
796 double betan=1;
double beta_max=FLT_MAX;
bool do_dp=
true;
797 for((*itercg)=0; (*itercg)<
niterc; (*itercg)++){
802 printf(
"Going to double precision on iteration %d. %sbetan %e\talpha %e. %s",
803 *itercg,endline,betan,
creal(alpha),endline);
806 printf(
"\nGoing to double precision on iteration %d. %sbetan %e\talpha %e.\n",
807 *itercg,endline,betan,
creal(alpha));
823#pragma omp parallel for simd aligned(xi,xi_f:AVX)
824 for(
unsigned int i=0;i<
kferm;i++)
830 Dslash(x1,p,ud,iu,
id,gamval,gamin,dk,jqq,akappa);
832 ByClover(x1,p,clover,sigval,akappa,sigin,
false);
833 Dslashd(x2,x1,ud,iu,
id,gamval,gamin,dk,jqq,akappa);
835 ByClover(x2,x1,clover,sigval,akappa,sigin,
true);
845 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
851 cublasZdotc(
cublas_handle,
kferm,(cuDoubleComplex *)p,1,(cuDoubleComplex *)x2,1,(cuDoubleComplex *)&alpha);
853#elif defined USE_BLAS
854 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
860#pragma omp parallel for simd collapse(2) aligned(p,x2:AVX) reduction(+:alpha)
862 for(
unsigned int i=0; i<
kvol; i++)
871 alpha=alphan/
creal(alpha);
878 cublasZaxpy(
cublas_handle,
kferm,(cuDoubleComplex *)&alpha,(cuDoubleComplex *)p,1,(cuDoubleComplex *)xi,1);
880#elif defined USE_BLAS
884#pragma omp parallel for simd collapse(2) aligned(p,xi:AVX)
886 for(
unsigned int i=0; i<
kvol; i++)
893 cublasZaxpy(
cublas_handle,
kferm,(cuDoubleComplex *)&alpha_m,(cuDoubleComplex *)x2,1,(cuDoubleComplex *)r,1);
896 betan=betan_d*betan_d;
897#elif defined USE_BLAS
899 cblas_zaxpy(
kferm, &alpha_m, x2, 1, r, 1);
901 double betan_d = cblas_dznrm2(
kferm, r,1);
903 betan = betan_d*betan_d;
906#pragma omp parallel for simd aligned(r,x2:AVX) reduction(+:betan)
907 for(
unsigned int i=0; i<
kferm; i++){
909 betan +=
conj(r[i])*r[i];
911 double betan_d=sqrt(betan);
921 if(!
rank) printf(
"DP Iter(CG)=%i\tbeta_n=%e\talpha=%e\n", *itercg, betan,
creal(alpha));
924 alignas(16)
const Complex beta = (*itercg) ? betan/betad : 0;
925 betad=betan; alphan=betan;
929 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
935 cublasZaxpy(
cublas_handle,
kferm,(cuDoubleComplex *)&alpha_m,(cuDoubleComplex *)r,1,(cuDoubleComplex *)p,1);
937#elif (defined __USE_MKL__||defined OPENBLAS||defined AMD_BLAS)
943#elif defined USE_BLAS
945 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
950#pragma omp parallel for simd collapse(2) aligned(r,p:AVX)
952 for(
unsigned int i=0; i<
kvol; i++)
958 if(!
rank) printf(
"Double precision. Iter(CG)=%i\tbeta_n=%e\talpha=%e\n", *itercg, betan,
creal(alpha));
964 if(!
rank) printf(
"\nIter(CG)=%i\tResidue: %e\tTolerance: %e\n", *itercg, betan, resid);
973 Dslash_f(x1_f,p_f,ut,iu,
id,gamval_f,gamin,dk_f,jqq,akappa);
975 ByClover_f(x1_f,p_f,clover_f,sigval_f,akappa,sigin,
false);
976 Dslashd_f(x2_f,x1_f,ut,iu,
id,gamval_f,gamin,dk_f,jqq,akappa);
978 ByClover_f(x2_f,x1_f,clover_f,sigval_f,akappa,sigin,
true);
988 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
994 cublasCdotc(
cublas_handle,
kferm,(cuComplex *)p_f,1,(cuComplex *)x2_f,1,(cuComplex *)&alphad);
997 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
1003#pragma omp parallel for simd collapse(2) aligned(p_f,x2_f:AVX) reduction(+:alphad)
1004 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1005 for(
unsigned int i = 0; i<
kvol; i++)
1012 alpha=alphan/
creal(alphad);
1016 alignas(8)
Complex_f alpha_f=(
float)alpha;
1019 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1022 cublasCaxpy(
cublas_handle,
kferm,(cuComplex*) &alpha_f,(cuComplex*) p_f,1,(cuComplex*) xi_f,1);
1025 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1029#pragma omp parallel for simd collapse(2) aligned(xi_f,p_f:AVX)
1030 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1031 for(
unsigned int i = 0; i<
kvol; i++)
1037 alignas(8)
float betan_f=0;
1041 cublasCaxpy(
cublas_handle,
kferm, (cuComplex *)&alpha_m,(cuComplex *) x2_f, 1,(cuComplex *) r_f, 1);
1051 betan=betan_f*betan_f;
1057#pragma omp parallel for simd aligned(x2_f,r_f:AVX) reduction(+:betan)
1058 for(
unsigned int i = 0; i<
kferm;i++){
1059 r_f[i]-=alpha*x2_f[i];
1060 betan+=
conj(r_f[i])*r_f[i];
1062 betan_f=sqrt(betan);
1069 betan_f=sqrt(betan);
1070 beta_max = (betan_f>beta_max) ?betan_f : beta_max;
1072 if(!
rank) printf(
"Iter (CG) = %i beta_n= %e alpha= %e%s", *itercg, betan,
creal(alpha),endline);
1074 if(betan_f<beta_max*d_prec){
1077 printf(
"Residue %e is less than %e times %e. %s",betan_f,d_prec,beta_max,endline);
1081 else if(betan<resid){
1085 if(!
rank) printf(
"\nIter (CG) = %i resid = %e toler = %e\n", *itercg, betan, resid);
1090 else if(*itercg==
niterc-1){
1091 if(!
rank) fprintf(stderr,
"Warning %i in %s: Exceeded iteration limit %i beta_n=%e\n",
1096 alignas(8)
Complex beta = (*itercg) ? betan/betad : 0;
1097 betad=betan; alphan=betan;
1106 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
1112 cublasCaxpy(
cublas_handle,
kferm,(cuComplex *)&a,(cuComplex *)r_f,1,(cuComplex *)p_f,1);
1115#elif (defined __USE_MKL__||defined OPENBLAS||defined AMD_BLAS)
1116 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1119 for(
unsigned short j=0;j<
nc*
ngorkov;j++){
1125#pragma omp parallel for simd aligned(r_f,p_f:AVX)
1126 for(
unsigned short j=0;j<
nc*
ngorkov;j++)
1127 for(
unsigned int i=0; i<
kvol; i++)
1135 P_free_f(&p_f,&r_f,&x1_f,&x2_f,&xi_f);
1136 P_free(&p,&r,&x1,&x2,clover);
Routines needed for Clover improved wilson fermions.
#define ITERLIM
Exceeded max number of iterations.
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 Dsla...
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 Dsla...
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 Dsla...
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 Dsla...
int Dslash_f(Complex_f *phi, Complex_f *r, Complex_f *ut[nc], unsigned int *iu, unsigned int *id, Complex_f gamval[20], const unsigned short gamin[16], float *dk[nc], Complex_f jqq, float akappa)
Evaluates in single precision.
int Dslashd_f(Complex_f *phi, Complex_f *r, Complex_f *ut[nc], unsigned int *iu, unsigned int *id, Complex_f gamval[20], const unsigned short gamin[16], float *dk[nc], Complex_f jqq, float akappa)
Evaluates in single precision.
int Hdslashd_f(Complex_f *phi, Complex_f *r, Complex_f *ut[nc], unsigned int *iu, unsigned int *id, Complex_f gamval[20], const unsigned short gamin[16], float *dk[nc], float akappa)
Evaluates in single precision.
int Hdslashd(Complex *phi, Complex *r, Complex *ut[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], const unsigned short gamin[16], double *dk[nc], float akappa)
Evaluates in double precision.
int Hdslash(Complex *phi, Complex *r, Complex *ut[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], const unsigned short gamin[16], double *dk[nc], float akappa)
Evaluates in double precision.
int Dslashd(Complex *phi, Complex *r, Complex *ut[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], const unsigned short gamin[16], double *dk[nc], Complex_f jqq, float akappa)
Evaluates in double precision.
int Hdslash_f(Complex_f *phi, Complex_f *r, Complex_f *ut[nc], unsigned int *iu, unsigned int *id, Complex_f gamval[20], const unsigned short gamin[16], float *dk[nc], float akappa)
Evaluates in single precision.
int Dslash(Complex *phi, Complex *r, Complex *ut[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], const unsigned short gamin[16], double *dk[nc], Complex_f jqq, float akappa)
Evaluates in double precision.
void Q_allocate_f(Complex_f **p_f, Complex_f **x1_f, Complex_f **x2_f, Complex_f **r_f, Complex_f **X1_f)
Allocates memory needed for Congradq. Just to improve readability Note that since C does not modify i...
void Q_allocate(Complex **p, Complex **x1, Complex **x2, Complex *clover[2])
Allocates double precision memory needed for Congradq. Just to improve readability Note that since C ...
void P_allocate(Complex **p, Complex **r, Complex **x1, Complex **x2, Complex *clover[2])
Allocates double precision memory needed for Congradp. Just to improve readability Note that since C ...
void Q_free(Complex **p, Complex **x1, Complex **x2, Complex *clover[2])
Frees double precision memory needed for Congradq. Just to improve readability Note that since C does...
void P_free(Complex **p, Complex **r, Complex **x1, Complex **x2, Complex *clover[2])
Frees memory needed for Congradp. Just to improve readability Note that since C does not modify it's ...
void Q_free_f(Complex_f **p_f, Complex_f **x1_f, Complex_f **x2_f, Complex_f **r_f, Complex_f **X1_f)
Frees memory needed for Congradq. Just to improve readability Note that since C does not modify it's ...
void P_allocate_f(Complex_f **p_f, Complex_f **r_f, Complex_f **x1_f, Complex_f **x2_f, Complex_f **xi_f)
Allocates memory needed for Congradp. Just to improve readability Note that since C does not modify i...
int ComplexConvert(Complex_f *a, Complex *b, const unsigned int len, const bool dtof, const unsigned short stride)
takes an array of complex float and double precision numbers and converts the precision
__device__ __forceinline__ T conj(const T &z)
Complex Conjugation.
void cuMixed_Sumto(double *d, float *f, const unsigned int n, const dim3 dimGrid, const dim3 dimBlock)
Add a single to a double value, and save the output in the double array For complex valued arrays,...
void P_free_f(Complex_f **p_f, Complex_f **r_f, Complex_f **x1_f, Complex_f **x2_f, Complex_f **xi_f)
Frees memory needed for Congradp. Just to improve readability Note that since C does not modify it's ...
int Congradp(int na, double res, Complex *Phi, Complex *xi, Complex *ud[2], Complex_f *ut[2], Complex_f *clover_f[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], Complex_f gamval_f[20], const unsigned short gamin[16], Complex *sigval, Complex_f *sigval_f, unsigned short *sigin, double *dk[2], float *dk_f[2], Complex_f jqq, float akappa, float c_sw, int *itercg)
Matrix Inversion via Conjugate Gradient (no up/down flavour partitioning). Solves The matrix multipl...
int Congradq(int na, double res, Complex *X1, Complex *r, Complex *ud[2], Complex_f *ut[2], Complex_f *clover_f[nc], unsigned int *iu, unsigned int *id, Complex gamval[20], Complex_f gamval_f[20], const unsigned short gamin[16], Complex *sigval, Complex_f *sigval_f, unsigned short *sigin, double *dk[2], float *dk_f[2], Complex_f jqq, float akappa, float c_sw, int *itercg)
Matrix Inversion via Conjugate Gradient (up/down flavour partitioning). Solves Implements up/down pa...
int Par_fsum(float *dval)
Performs a reduction on a float dval to get a sum which is then distributed to all ranks.
int Par_dsum(double *dval)
Performs a reduction on a double dval to get a sum which is then distributed to all ranks.
Matrix multiplication and related declarations.
#define AVX
Alignment of arrays. 64 for AVX-512, 32 for AVX/AVX2. 16 for SSE. Since AVX is standard on modern x86...
#define ngorkov
Gor'kov indices.
#define kferm2Halo
Dirac lattice and halo.
#define niterc
Hard limit for runaway trajectories in Conjugate gradient.
#define kvol
Sublattice volume.
#define Complex
Double precision complex number.
#define kferm
sublattice size including Gor'kov indices
#define ndirac
Dirac indices.
#define cudaDeviceSynchronise()
Get rid of that bastardised yankee English.
cublasHandle_t cublas_handle
Handle for cuBLAS.
#define Complex_f
Single precision complex number.
dim3 dimGrid
Default grid size. First component is normally nt. Second and third depend whatever is needed to get ...
#define kferm2
sublattice size including Dirac indices
#define kvolHalo
Subvolume + halo size.
#define kfermHalo
Gor'kov lattice and halo.
dim3 dimBlock
Default block size. Usually 128.
cudaStream_t streams[ndirac *ndim *nadj]
An array of concurrent GPU streams to keep it busy.
#define creal(z)
Extract Real Component using C standard notation.