From 3cef4b57eda6a98415c9d7ab38eeaaee638edd4c Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Tue, 30 Jan 2024 16:36:01 +0100 Subject: [PATCH 1/3] output the values of mubar, epsbar, kappa and csw passed to invert_doublet_eo_quda --- quda_interface.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quda_interface.c b/quda_interface.c index 9789c1b7a..039d12c87 100644 --- a/quda_interface.c +++ b/quda_interface.c @@ -1147,7 +1147,6 @@ int invert_doublet_eo_quda(spinor * const Even_new_s, spinor * const Odd_new_s, // IMPORTANT: use opposite TM mu-flavor since gamma5 -> -gamma5 inv_param.mu = -g_mubar /2./g_kappa; inv_param.epsilon = g_epsbar/2./g_kappa; - // FIXME: in principle, there is also QUDA_TWIST_DEG_DOUBLET inv_param.twist_flavor = QUDA_TWIST_NONDEG_DOUBLET; inv_param.Ls = 2; @@ -1178,18 +1177,22 @@ int invert_doublet_eo_quda(spinor * const Even_new_s, spinor * const Odd_new_s, // choose solver if(solver_flag == BICGSTAB) { - if(g_proc_id == 0) {printf("# TM_QUDA: Using BiCGstab!\n"); fflush(stdout);} inv_param.inv_type = QUDA_BICGSTAB_INVERTER; + if(g_proc_id == 0) {printf("# TM_QUDA: Using BiCGstab!\n"); fflush(stdout);} } else { /* Here we invert the hermitean operator squared */ inv_param.inv_type = QUDA_CG_INVERTER; if(g_proc_id == 0) { printf("# TM_QUDA: Using mixed precision CG!\n"); - printf("# TM_QUDA: mu = %.12f, kappa = %.12f\n", g_mu/2./g_kappa, g_kappa); fflush(stdout); } } + if(g_proc_id == 0) { + printf("# TM_QUDA: mubar = %.12f, epsbar = %.12f, kappa = %.12f, csw = %.12f\n", + -inv_param.mu, inv_param.epsilon, inv_param.kappa, inv_param.clover_coeff/inv_param.kappa); + fflush(stdout); + } if( even_odd_flag ) { inv_param.solve_type = QUDA_NORMERR_PC_SOLVE; From 9697d85b9c923e18492f0a1630762b1c26867bed Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Fri, 2 Feb 2024 12:02:44 +0100 Subject: [PATCH 2/3] use _setTwoFlavourSolverParam in invert_doublet_eo_quda to set solver params for ND doublet inversions --- quda_interface.c | 73 ++++++++---------------------------------------- 1 file changed, 11 insertions(+), 62 deletions(-) diff --git a/quda_interface.c b/quda_interface.c index 039d12c87..240f2118b 100644 --- a/quda_interface.c +++ b/quda_interface.c @@ -1142,14 +1142,6 @@ int invert_doublet_eo_quda(spinor * const Even_new_s, spinor * const Odd_new_s, else inv_param.residual_type = QUDA_L2_ABSOLUTE_RESIDUAL; - inv_param.kappa = g_kappa; - - // IMPORTANT: use opposite TM mu-flavor since gamma5 -> -gamma5 - inv_param.mu = -g_mubar /2./g_kappa; - inv_param.epsilon = g_epsbar/2./g_kappa; - inv_param.twist_flavor = QUDA_TWIST_NONDEG_DOUBLET; - inv_param.Ls = 2; - // figure out which BC to use (theta, trivial...) set_boundary_conditions(&compression, &gauge_param); @@ -1159,60 +1151,17 @@ int invert_doublet_eo_quda(spinor * const Even_new_s, spinor * const Odd_new_s, // load gauge after setting precision _loadGaugeQuda(compression); - // choose dslash type - if( g_c_sw > 0.0 ) { - inv_param.dslash_type = QUDA_TWISTED_CLOVER_DSLASH; - inv_param.matpc_type = QUDA_MATPC_EVEN_EVEN; // FIXME: note sure if this is the correct PC type - inv_param.solution_type = QUDA_MAT_SOLUTION; - inv_param.clover_order = QUDA_PACKED_CLOVER_ORDER; - inv_param.clover_coeff = g_c_sw*g_kappa; - inv_param.compute_clover = 1; - inv_param.compute_clover_inverse = 1; - } - else { - inv_param.dslash_type = QUDA_TWISTED_MASS_DSLASH; - inv_param.matpc_type = QUDA_MATPC_EVEN_EVEN_ASYMMETRIC; - inv_param.solution_type = QUDA_MAT_SOLUTION; - } - - // choose solver - if(solver_flag == BICGSTAB) { - inv_param.inv_type = QUDA_BICGSTAB_INVERTER; - if(g_proc_id == 0) {printf("# TM_QUDA: Using BiCGstab!\n"); fflush(stdout);} - } - else { - /* Here we invert the hermitean operator squared */ - inv_param.inv_type = QUDA_CG_INVERTER; - if(g_proc_id == 0) { - printf("# TM_QUDA: Using mixed precision CG!\n"); - fflush(stdout); - } - } - if(g_proc_id == 0) { - printf("# TM_QUDA: mubar = %.12f, epsbar = %.12f, kappa = %.12f, csw = %.12f\n", - -inv_param.mu, inv_param.epsilon, inv_param.kappa, inv_param.clover_coeff/inv_param.kappa); - fflush(stdout); - } - - if( even_odd_flag ) { - inv_param.solve_type = QUDA_NORMERR_PC_SOLVE; - if(g_proc_id == 0) printf("# TM_QUDA: Using EO preconditioning!\n"); - } - else { - inv_param.solve_type = QUDA_NORMERR_SOLVE; - if(g_proc_id == 0) printf("# TM_QUDA: Not using EO preconditioning!\n"); - } - - inv_param.tol = sqrt(precision); - inv_param.maxiter = max_iter; - - if( g_c_sw > 0.0 ){ - _loadCloverQuda(&inv_param); - } - - // while the other solver interfaces may need to set this to QUDA_DAG_YES, we - // always want to set it to QUDA_DAG_NO - inv_param.dagger = QUDA_DAG_NO; + _setTwoFlavourSolverParam(g_kappa, + g_c_sw, + g_mubar, + g_epsbar, + solver_flag, + even_odd_flag, + precision, + max_iter, + 0 /* not a single parity solve */, + 1); + inv_param.dagger = QUDA_DAG_YES; // reorder spinor reorder_spinor_toQuda( (double*)spinorIn, inv_param.cpu_prec, 1 ); From a4f0d00657c292ada46e2068147412823e4c7528 Mon Sep 17 00:00:00 2001 From: Bartosz Kostrzewa Date: Fri, 2 Feb 2024 12:49:23 +0100 Subject: [PATCH 3/3] need to also reset inv_param.preconditioner in _setTwoFlavourSolverParam --- quda_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quda_interface.c b/quda_interface.c index 240f2118b..786346218 100644 --- a/quda_interface.c +++ b/quda_interface.c @@ -1160,8 +1160,9 @@ int invert_doublet_eo_quda(spinor * const Even_new_s, spinor * const Odd_new_s, precision, max_iter, 0 /* not a single parity solve */, - 1); - inv_param.dagger = QUDA_DAG_YES; + 0 /* not a QpQm solve */); + // in contrast to the HMC we always want QUDA_DAG_NO here + inv_param.dagger = QUDA_DAG_NO; // reorder spinor reorder_spinor_toQuda( (double*)spinorIn, inv_param.cpu_prec, 1 ); @@ -1680,6 +1681,7 @@ void _setTwoFlavourSolverParam(const double kappa, const double c_sw, const doub // solver (for example in the HMC or when doing light and heavy inversions) if( solver_type != MG ){ inv_param.inv_type_precondition = QUDA_INVALID_INVERTER; + inv_param.preconditioner = NULL; } // direct or norm-op. solve