25 #if defined(QMP_COMMS) 27 #elif defined(MPI_COMMS) 33 #define MAX(a,b) ((a)>(b)?(a):(b)) 38 #define mySpinorSiteSize 6 40 extern void usage(
char** argv);
107 gauge_param.
X[0] =
xdim;
108 gauge_param.
X[1] =
ydim;
109 gauge_param.
X[2] =
zdim;
110 gauge_param.
X[3] =
tdim;
128 gauge_param.
scale = -1.0 / 24.0;
131 gauge_param.
scale = 1.0;
142 int x_face_size = gauge_param.
X[1] * gauge_param.
X[2] * gauge_param.
X[3] / 2;
143 int y_face_size = gauge_param.
X[0] * gauge_param.
X[2] * gauge_param.
X[3] / 2;
144 int z_face_size = gauge_param.
X[0] * gauge_param.
X[1] * gauge_param.
X[3] / 2;
145 int t_face_size = gauge_param.
X[0] * gauge_param.
X[1] * gauge_param.
X[2] / 2;
146 int pad_size =
MAX(x_face_size, y_face_size);
147 pad_size =
MAX(pad_size, z_face_size);
148 pad_size =
MAX(pad_size, t_face_size);
149 gauge_param.
ga_pad = pad_size;
175 errorQuda(
"qudaInvert: requesting zero residual\n");
227 int tmpint =
MAX(
X[1] *
X[2] *
X[3], X[0] * X[2] * X[3]);
228 tmpint =
MAX(tmpint, X[0] * X[1] * X[3]);
229 tmpint =
MAX(tmpint, X[0] * X[1] * X[2]);
231 inv_param.
sp_pad = tmpint;
255 void*
qdp_inlink[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
256 void*
qdp_fatlink[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
257 void*
qdp_longlink[4] = {
nullptr,
nullptr,
nullptr,
nullptr};
258 void* milc_fatlink =
nullptr;
259 void* milc_longlink =
nullptr;
261 for (
int dir = 0; dir < 4; dir++) {
291 printfQuda(
"Computed plaquette is %e (spatial = %e, temporal = %e)\n", plaq[0], plaq[1], plaq[2]);
296 for (
int dir = 0; dir < 4; dir++) {
297 memcpy(qdp_fatlink[dir], qdp_inlink[dir],
V *
gaugeSiteSize * gSize);
305 for (
int dir = 0; dir < 4; dir++) {
313 printfQuda(
"Computed fat link plaquette is %e (spatial = %e, temporal = %e)\n", plaq[0], plaq[1], plaq[2]);
325 for (
int d = 0; d < 4; d++) csParam.
x[d] = gauge_param.
X[d];
327 if (pc) csParam.
x[0] /= 2;
356 int fat_pad = tmp_value;
357 int link_pad = 3*tmp_value;
383 gauge_param.
ga_pad = fat_pad;
396 gauge_param.
ga_pad = link_pad;
405 double time0 = -((double)clock());
425 time0 /= CLOCKS_PER_SEC;
475 time0 /= CLOCKS_PER_SEC;
481 printfQuda(
"%f %f\n", ((
float *)in->
V())[12], ((
float *)ref->
V())[12]);
483 printfQuda(
"%f %f\n", ((
double *)in->
V())[12], ((
double *)ref->
V())[12]);
495 #define NUM_OFFSETS 12 498 double masses[
NUM_OFFSETS] ={0.06, 0.061, 0.064, 0.070, 0.077, 0.081, 0.1, 0.11, 0.12, 0.13, 0.14, 0.205};
501 for (
int i = 0; i < inv_param.
num_offset; i++) {
508 spinorOutArray[0] =
out;
511 for (
int i = 0; i < inv_param.
num_offset; i++) {
512 outArray[i] = spinorOutArray[i]->
V();
513 inv_param.
offset[i] = 4*masses[i]*masses[i];
518 cudaDeviceSynchronize();
520 time0 /= CLOCKS_PER_SEC;
522 printfQuda(
"done: total time = %g secs, compute time = %g, %i iter / %g secs = %g gflops\n", time0,
529 errorQuda(
"full parity not supported\n");
535 errorQuda(
"ERROR: invalid spinor parity \n");
538 printfQuda(
"%dth solution: mass=%f, ", i, masses[i]);
546 double l2r =
sqrt(nrm2/src2);
548 printfQuda(
"Shift %d residuals: (L2 relative) tol %g, QUDA = %g, host = %g; (heavy-quark) tol %g, QUDA = %g, " 559 for(
int i=1; i < inv_param.
num_offset;i++)
delete spinorOutArray[i];
570 double l2r =
sqrt(nrm2/src2);
572 printfQuda(
"Residuals: (L2 relative) tol %g, QUDA = %g, host = %g; (heavy-quark) tol %g, QUDA = %g, host = %g\n",
575 printfQuda(
"done: total time = %g secs, compute time = %g secs, %i iter / %g secs = %g gflops, \n", time0,
580 for (
int dir = 0; dir < 4; dir++) {
581 if (qdp_inlink[dir] !=
nullptr) { free(qdp_inlink[dir]); qdp_inlink[dir] =
nullptr; }
582 if (qdp_fatlink[dir] !=
nullptr) { free(qdp_fatlink[dir]); qdp_fatlink[dir] =
nullptr; }
583 if (qdp_longlink[dir] !=
nullptr) { free(qdp_longlink[dir]); qdp_longlink[dir] =
nullptr; }
585 if (milc_fatlink !=
nullptr) { free(milc_fatlink); milc_fatlink =
nullptr; }
586 if (milc_longlink !=
nullptr) { free(milc_longlink); milc_longlink =
nullptr; }
589 if (cpuFat !=
nullptr) {
delete cpuFat; cpuFat =
nullptr; }
590 if (cpuLong !=
nullptr) {
delete cpuLong; cpuLong =
nullptr; }
611 printfQuda(
"prec sloppy_prec link_recon sloppy_link_recon test_type S_dimension T_dimension\n");
628 printfQuda(
" --test <0/1/2/3/4/5/6> # Test method\n");
630 printfQuda(
" 1: Even even spinor CG inverter, reconstruct to full parity\n");
631 printfQuda(
" 2: Odd odd spinor CG inverter, reconstruct to full parity\n");
632 printfQuda(
" 3: Even even spinor CG inverter\n");
633 printfQuda(
" 4: Odd odd spinor CG inverter\n");
634 printfQuda(
" 5: Even even spinor multishift CG inverter\n");
635 printfQuda(
" 6: Odd odd spinor multishift CG inverter\n");
636 printfQuda(
" --cpu-prec <double/single/half> # Set CPU precision\n");
640 int main(
int argc,
char **argv)
646 for (
int i = 1; i < argc; i++) {
650 if (strcmp(argv[i],
"--cpu-prec") == 0) {
659 printf(
"ERROR: Invalid option:%s\n", argv[i]);
666 if (test_type < 0 || test_type > 6) {
673 warningQuda(
"The dslash_type %d isn't staggered, asqtad, or laplace. Defaulting to asqtad.\n",
dslash_type);
690 warningQuda(
"The full spinor staggered operator (test 0) can't be inverted with (P)CG. Switching to BiCGstab.\n");
729 errorQuda(
"Preconditioning is currently not supported in multi-shift solver solvers");
738 printfQuda(
"Note: epsilon-naik != 0, testing epsilon correction links.\n");
741 printfQuda(
"Not computing fat-long, ignoring epsilon correction.\n");
744 printfQuda(
"Note: epsilon-naik = 0, testing original HISQ links.\n");
int dimPartitioned(int dim)
void ax(double a, ColorSpinorField &x)
QudaDiracFieldOrder dirac_order
void applyGaugeFieldScaling_long(Float **gauge, int Vh, QudaGaugeParam *param, QudaDslashType dslash_type)
QudaMassNormalization mass_normalization
double tol_hq_offset[QUDA_MAX_MULTI_SHIFT]
QudaReconstructType reconstruct_sloppy
QudaGhostExchange ghostExchange
void setPrecision(QudaPrecision precision, QudaPrecision ghost_precision=QUDA_INVALID_PRECISION, bool force_native=false)
void invertMultiShiftQuda(void **_hp_x, void *_hp_b, QudaInvertParam *param)
void construct_gauge_field(void **gauge, int type, QudaPrecision precision, QudaGaugeParam *param)
QudaVerbosity verbosity_precondition
enum QudaPrecision_s QudaPrecision
void dw_setDims(int *X, const int L5)
QudaPrecision prec_sloppy
QudaInverterType inv_type_precondition
void invertQuda(void *h_x, void *h_b, QudaInvertParam *param)
void usage_extra(char **argv)
QudaDslashType dslash_type
QudaReconstructType reconstruct_precondition
QudaInverterType inv_type
QudaReconstructType link_recon_sloppy
enum QudaSolveType_s QudaSolveType
__host__ __device__ ValueType sqrt(ValueType x)
void loadGaugeQuda(void *h_gauge, QudaGaugeParam *param)
int process_command_line_option(int argc, char **argv, int *idx)
const ColorSpinorField & Even() const
const ColorSpinorField & Odd() const
QudaStaggeredPhase staggered_phase_type
int solution_accumulator_pipeline
QudaGaugeParam gauge_param
QudaPrecision cuda_prec_refinement_sloppy
QudaReconstructType link_recon
QudaGaugeFieldOrder gauge_order
const char * get_staggered_test_type(int t)
const char * get_prec_str(QudaPrecision prec)
void construct_spinor_source(void *v, int nSpin, int nColor, QudaPrecision precision, const int *const x, quda::RNG &rng)
QudaInverterType inv_type
QudaSiteSubset siteSubset
QudaFieldLocation input_location
double true_res_hq_offset[QUDA_MAX_MULTI_SHIFT]
void xpay(ColorSpinorField &x, double a, ColorSpinorField &y)
int solution_accumulator_pipeline
QudaPrecision prec_refinement_sloppy
QudaSolutionType solution_type
int use_alternative_reliable
void computeStaggeredPlaquetteQDPOrder(void **qdp_link, double plaq[3], const QudaGaugeParam &gauge_param_in, const QudaDslashType dslash_type)
void initQuda(int device)
QudaFieldLocation output_location
QudaInvertParam inv_param
QudaFieldOrder fieldOrder
QudaPrecision cuda_prec_sloppy
void reorderQDPtoMILC(Out *milc_out, In **qdp_in, int V, int siteSize)
void setSpinorSiteSize(int n)
double tol_offset[QUDA_MAX_MULTI_SHIFT]
double true_res_offset[QUDA_MAX_MULTI_SHIFT]
void axpy(double a, ColorSpinorField &x, ColorSpinorField &y)
QudaInvertParam newQudaInvertParam(void)
const char * get_recon_str(QudaReconstructType recon)
cpuColorSpinorField * tmp
QudaPrecision cuda_prec_precondition
Class declaration to initialize and hold CURAND RNG states.
enum QudaMatPCType_s QudaMatPCType
QudaGammaBasis gammaBasis
enum QudaSolutionType_s QudaSolutionType
void matdagmat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision, void *tmp, QudaParity parity)
QudaGammaBasis gamma_basis
void staggered_dslash(cpuColorSpinorField *out, void **fatlink, void **longlink, void **ghost_fatlink, void **ghost_longlink, cpuColorSpinorField *in, int oddBit, int daggerBit, QudaPrecision sPrecision, QudaPrecision gPrecision, QudaDslashType dslash_type)
QudaPrecision cuda_prec_sloppy
const void ** Ghost() const
double3 HeavyQuarkResidualNorm(ColorSpinorField &x, ColorSpinorField &r)
double offset[QUDA_MAX_MULTI_SHIFT]
int use_sloppy_partial_accumulator
enum QudaParity_s QudaParity
QudaReconstructType reconstruct
QudaPrecision cuda_prec_refinement_sloppy
double norm_2(void *v, int len, QudaPrecision precision)
void computeFatLongGPU(void **qdp_fatlink, void **qdp_longlink, void **qdp_inlink, QudaGaugeParam &gauge_param, size_t gSize, int n_naiks, double eps_naik)
void * memset(void *s, int c, size_t n)
int main(int argc, char **argv)
void construct_fat_long_gauge_field(void **fatlink, void **longlink, int type, QudaPrecision precision, QudaGaugeParam *param, QudaDslashType dslash_type)
QudaDslashType dslash_type
cpuColorSpinorField * out
QudaPrecision cuda_prec_precondition
cpuColorSpinorField * ref
bool alternative_reliable
void setGaugeParam(QudaGaugeParam &gauge_param)
enum QudaReconstructType_s QudaReconstructType
Main header file for the QUDA library.
enum QudaCABasis_s QudaCABasis
enum QudaDslashType_s QudaDslashType
void setInvertParam(QudaInvertParam &inv_param)
void mxpy(ColorSpinorField &x, ColorSpinorField &y)
QudaResidualType residual_type
int gridsize_from_cmdline[]
void initComms(int argc, char **argv, int *const commDims)
void read_gauge_field(const char *filename, void *gauge[], QudaPrecision prec, const int *X, int argc, char *argv[])
QudaSolutionType solution_type
enum QudaInverterType_s QudaInverterType
QudaPrecision get_prec(QIO_Reader *infile)
QudaGaugeParam newQudaGaugeParam(void)
QudaPreserveSource preserve_source