Skip to content

Commit 3285769

Browse files
committed
qphix interface: add support for twisted boundary conditions
1 parent 6075c60 commit 3285769

10 files changed

+172
-97
lines changed

config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,8 @@
209209
/* Using QPHIX */
210210
#undef TM_USE_QPHIX
211211

212+
/* Structure of Array length to use with QPhiX */
213+
#undef QPHIX_SOALEN
214+
212215
#endif
213216

configure.in

+17-9
Original file line numberDiff line numberDiff line change
@@ -985,20 +985,28 @@ AC_ARG_WITH(qphixdir,
985985
QPHIX_AVAILABLE=1
986986
AC_DEFINE(TM_USE_QPHIX,1,Using QPhiX)
987987
qphix_dir=$withval
988-
LDFLAGS="$LDFLAGS -L${qphix_dir}/lib -lqphix_solver"
988+
LDFLAGS="$LDFLAGS -L${qphix_dir}/lib -lqphix_solver -lqphix_codegen"
989989
INCLUDES="$INCLUDES -I${qphix_dir}/include/"
990990
QPHIX_INTERFACE="qphix_interface"
991991
QPHIX_PROGRAMS="qphix_test_Dslash"
992992

993-
# QMP: TODO AC_CHECK_LIB
993+
# QMP: TODO AC_CHECK_LIB
994994
AC_MSG_CHECKING([where to search for QMP libs])
995-
AC_ARG_WITH(qmpdir,
996-
AS_HELP_STRING([--with-qmpdir[=dir]], [if using QPhiX, then set QMP lib dir]),
997-
qmp_dir=$withval
998-
LDFLAGS="$LDFLAGS -L${qmp_dir}/lib -lqmp"
999-
INCLUDES="$INCLUDES -I${qmp_dir}/include/"
1000-
)
1001-
AC_MSG_RESULT($qmp_dir)
995+
AC_ARG_WITH(qmpdir,
996+
AS_HELP_STRING([--with-qmpdir[=dir]], [if using QPhiX, then set QMP lib dir]),
997+
qmp_dir=$withval
998+
LDFLAGS="$LDFLAGS -L${qmp_dir}/lib -lqmp"
999+
INCLUDES="$INCLUDES -I${qmp_dir}/include/"
1000+
)
1001+
AC_MSG_RESULT($qmp_dir)
1002+
1003+
AC_MSG_CHECKING([Setting QPhiX SOALEN])
1004+
AC_ARG_ENABLE(qphix-soalen,
1005+
AS_HELP_STRING([--enable-qphix-soalen], [if using QPhiX, set SOALEN [default=4]]),
1006+
enable_qphix_soalen=$enableval, enable_qphix_soalen=4)
1007+
AC_MSG_RESULT($enable_qphix_soalen)
1008+
AC_DEFINE_UNQUOTED(QPHIX_SOALEN, ${enable_qphix_soalen}, Structure of Array length to use with QPhiX)
1009+
10021010
AC_PROG_CXX
10031011
#QPhiX needs to be linked with C++ linker
10041012
CCLD=${CXX}

invert_eo.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int invert_eo(spinor * const Even_new, spinor * const Odd_new,
166166
solver_flag, rel_prec,
167167
solver_params,
168168
sloppy,
169-
compression, &Qtm_pm_psi);
169+
compression, &Qtm_pm_psi);
170170
// for solver_params.solution_type == TM_SOLUTION_M (the default)
171171
// QPhiX applies M(mu)^dag internally for normal equation solves, no call to tmLQCD operaor required
172172
} else

monomial/det_monomial.c

+2
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,14 @@ void det_heatbath(const int id, hamiltonian_field_t * const hf) {
174174
mnl->energy0 = square_norm(mnl->w_fields[0], VOLUME/2, 1);
175175

176176
mnl->Qp(mnl->pf, mnl->w_fields[0]);
177+
177178
// FIXME: there needs to be a better way to take care of this... this is an ugly
178179
// hack to get the right number of factors of gamma5 in the result of solve_degenerate
179180
// when using QPhiX solvers qhich employ M(mu) and M^dag(mu) directly, rather than Q+ and Q-
180181
if(mnl->external_inverter == QPHIX_INVERTER){
181182
mul_gamma5(mnl->pf, VOLUME/2);
182183
}
184+
183185
chrono_add_solution(mnl->pf, mnl->csg_field, mnl->csg_index_array,
184186
mnl->csg_N, &mnl->csg_n, VOLUME/2);
185187
if(mnl->solver != CG) {

qphix_base_classes.hpp

+19-13
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ class Dslash {
314314
typedef typename Geom::SU3MatrixBlock SU3MatrixBlock;
315315

316316
explicit Dslash(Geom *geom, double const t_boundary_, double const aniso_coeff_S_,
317-
double const aniso_coeff_T_, double const mass_)
317+
double const aniso_coeff_T_, double const mass_, bool use_tbc_[4] = nullptr,
318+
double tbc_phases_[4][2] = nullptr)
318319
: geom(geom),
319320
t_boundary(t_boundary_),
320321
aniso_coeff_S(aniso_coeff_S_),
@@ -446,10 +447,11 @@ class WilsonDslash : public Dslash<FT, veclen, soalen, compress12> {
446447
typedef typename ::QPhiX::Geometry<FT, veclen, soalen, compress12>::SU3MatrixBlock SU3MatrixBlock;
447448

448449
WilsonDslash(::QPhiX::Geometry<FT, veclen, soalen, compress12> *geom_, double const t_boundary_,
449-
double const aniso_coeff_S_, double const aniso_coeff_T_, double const mass_)
450+
double const aniso_coeff_S_, double const aniso_coeff_T_, double const mass_,
451+
bool use_tbc_[4] = nullptr, double tbc_phases_[4][2] = nullptr)
450452
: Dslash<FT, veclen, soalen, compress12>(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_,
451-
mass_),
452-
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_),
453+
mass_, use_tbc_, tbc_phases_),
454+
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_, use_tbc_, tbc_phases_),
453455
mass_factor_alpha(4.0 + mass_),
454456
mass_factor_beta(1.0 / (4.0 * mass_factor_alpha)) {}
455457

@@ -503,10 +505,12 @@ class WilsonTMDslash : public Dslash<FT, veclen, soalen, compress12> {
503505

504506
WilsonTMDslash(::QPhiX::Geometry<FT, veclen, soalen, compress12> *geom_, double const t_boundary_,
505507
double const aniso_coeff_S_, double const aniso_coeff_T_, double const mass_,
506-
double const twisted_mass_)
508+
double const twisted_mass_, bool use_tbc_[4] = nullptr,
509+
double tbc_phases_[4][2] = nullptr)
507510
: Dslash<FT, veclen, soalen, compress12>(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_,
508-
mass_),
509-
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_, mass_, twisted_mass_),
511+
mass_, use_tbc_, tbc_phases_),
512+
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_, mass_, twisted_mass_,
513+
use_tbc_, tbc_phases_),
510514
mass_factor_alpha(4.0 + mass_),
511515
mass_factor_beta(0.25),
512516
derived_mu(twisted_mass_ / mass_factor_alpha),
@@ -556,10 +560,11 @@ class WilsonClovDslash : public Dslash<FT, veclen, soalen, compress12> {
556560
WilsonClovDslash(::QPhiX::Geometry<FT, veclen, soalen, compress12> *geom_,
557561
double const t_boundary_, double const aniso_coeff_S_,
558562
double const aniso_coeff_T_, double const mass_,
559-
CloverBlock *const (&clover_)[2], CloverBlock *const (&inv_clover_)[2])
563+
CloverBlock *const (&clover_)[2], CloverBlock *const (&inv_clover_)[2],
564+
bool use_tbc_[4] = nullptr, double tbc_phases_[4][2] = nullptr)
560565
: Dslash<FT, veclen, soalen, compress12>(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_,
561-
mass_),
562-
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_),
566+
mass_, use_tbc_, tbc_phases_),
567+
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_, use_tbc_, tbc_phases_),
563568
mass_factor_alpha(4.0 + mass_),
564569
mass_factor_beta(1.0 / (4.0 * mass_factor_alpha)) {
565570
for (int cb : {0, 1}) {
@@ -622,10 +627,11 @@ class WilsonClovTMDslash : public Dslash<FT, veclen, soalen, compress12> {
622627
double const t_boundary_, double const aniso_coeff_S_,
623628
double const aniso_coeff_T_, double const mass_, double const twisted_mass_,
624629
FullCloverBlock *const (&clover_)[2][2],
625-
FullCloverBlock *const (&inv_clover_)[2][2])
630+
FullCloverBlock *const (&inv_clover_)[2][2], bool use_tbc_[4] = nullptr,
631+
double tbc_phases_[4][2] = nullptr)
626632
: Dslash<FT, veclen, soalen, compress12>(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_,
627-
mass_),
628-
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_),
633+
mass_, use_tbc_, tbc_phases_),
634+
upstream_dslash(geom_, t_boundary_, aniso_coeff_S_, aniso_coeff_T_, use_tbc_, tbc_phases_),
629635
mass_factor_alpha(4.0 + mass_),
630636
mass_factor_beta(0.25),
631637
derived_mu(twisted_mass_ / mass_factor_alpha),

0 commit comments

Comments
 (0)