Skip to content

Commit

Permalink
Use dir_ignore < 0 to represent the default situation.
Browse files Browse the repository at this point in the history
3D for APE/STOUT and 4D for OVRIMP_STOUT/HYP.
  • Loading branch information
SaltyChiang committed Feb 6, 2024
1 parent 74f9a23 commit 2b5a7c2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
3 changes: 2 additions & 1 deletion include/quda.h
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,8 @@ extern "C" {
QudaGaugeSmearType smear_type; /**< The smearing type to perform */
QudaBoolean restart; /**< Used to restart the smearing from existing gaugeSmeared */
double t0; /**< Starting flow time for Wilson flow */
int dir_ignore; /**< The direction to be ignored by the smearing algorithm */
int dir_ignore; /**< The direction to be ignored by the smearing algorithm
A negative value means 3D for APE/STOUT and 4D for OVRIMP_STOUT/HYP */
} QudaGaugeSmearParam;

typedef struct QudaBLASParam_s {
Expand Down
2 changes: 1 addition & 1 deletion lib/check_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ void printQudaGaugeSmearParam(QudaGaugeSmearParam *param)
P(alpha1, 0.0);
P(alpha2, 0.0);
P(alpha3, 0.0);
P(dir_ignore, 4);
P(dir_ignore, -1);
#else
P(n_steps, (unsigned int)INVALID_INT);
P(meas_interval, (unsigned int)INVALID_INT);
Expand Down
15 changes: 11 additions & 4 deletions lib/interface_quda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5086,15 +5086,22 @@ void performGaugeSmearQuda(QudaGaugeSmearParam *smear_param, QudaGaugeObservable
gaugeObservablesQuda(&obs_param[measurement_n]);
logQuda(QUDA_SUMMARIZE, "Q charge at step %03d = %+.16e\n", 0, obs_param[measurement_n].qcharge);

// set default dir_ignore = 3 for APE and STOUT for compatibility
int dir_ignore = smear_param->dir_ignore;
if (dir_ignore < 0
&& (smear_param->smear_type == QUDA_GAUGE_SMEAR_APE || smear_param->smear_type == QUDA_GAUGE_SMEAR_STOUT)) {
dir_ignore = 3;
}

for (unsigned int i = 0; i < smear_param->n_steps; i++) {
switch (smear_param->smear_type) {
case QUDA_GAUGE_SMEAR_APE: APEStep(*gaugeSmeared, tmp, smear_param->alpha, smear_param->dir_ignore); break;
case QUDA_GAUGE_SMEAR_STOUT: STOUTStep(*gaugeSmeared, tmp, smear_param->rho, smear_param->dir_ignore); break;
case QUDA_GAUGE_SMEAR_APE: APEStep(*gaugeSmeared, tmp, smear_param->alpha, dir_ignore); break;
case QUDA_GAUGE_SMEAR_STOUT: STOUTStep(*gaugeSmeared, tmp, smear_param->rho, dir_ignore); break;
case QUDA_GAUGE_SMEAR_OVRIMP_STOUT:
OvrImpSTOUTStep(*gaugeSmeared, tmp, smear_param->rho, smear_param->epsilon, smear_param->dir_ignore);
OvrImpSTOUTStep(*gaugeSmeared, tmp, smear_param->rho, smear_param->epsilon, dir_ignore);
break;
case QUDA_GAUGE_SMEAR_HYP:
HYPStep(*gaugeSmeared, tmp, smear_param->alpha1, smear_param->alpha2, smear_param->alpha3, smear_param->dir_ignore);
HYPStep(*gaugeSmeared, tmp, smear_param->alpha1, smear_param->alpha2, smear_param->alpha3, dir_ignore);
break;
default: errorQuda("Unkown gauge smear type %d", smear_param->smear_type);
}
Expand Down
7 changes: 4 additions & 3 deletions tests/su3_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ double gauge_smear_alpha2 = 0.6;
double gauge_smear_alpha3 = 0.3;
int gauge_smear_steps = 50;
QudaGaugeSmearType gauge_smear_type = QUDA_GAUGE_SMEAR_STOUT;
int gauge_smear_dir_ignore = 4;
int gauge_smear_dir_ignore = -1;
int measurement_interval = 5;
bool su_project = true;

Expand Down Expand Up @@ -98,8 +98,9 @@ void add_su3_option_group(std::shared_ptr<QUDAApp> quda_app)
opgroup->add_option("--su3-smear-alpha2", gauge_smear_alpha2, "alpha2 coefficient for HYP smearing (default 0.6)");
opgroup->add_option("--su3-smear-alpha3", gauge_smear_alpha3, "alpha3 coefficient for HYP smearing (default 0.3)");

opgroup->add_option("--su3-smear-dir-ignore", gauge_smear_dir_ignore,
"direction to be ignored by the smearing (default 4)");
opgroup->add_option(
"--su3-smear-dir-ignore", gauge_smear_dir_ignore,
"Direction to be ignored by the smearing, negative value means decided by --su3-smear-type (default -1)");

opgroup->add_option("--su3-smear-steps", gauge_smear_steps, "The number of smearing steps to perform (default 50)");

Expand Down

0 comments on commit 2b5a7c2

Please sign in to comment.