Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/twisted hasen #49

Open
wants to merge 7 commits into
base: feature/twisted-hasen
Choose a base branch
from
Open
27 changes: 16 additions & 11 deletions lib/actions/ferm/invert/quda_solvers/quda_mg_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ namespace Chroma {

QDPIO::cout<<"Creating MG subspace."<<std::endl;
//Taken from various places in the old constructor.

mg_inv_param.dslash_type = QUDA_CLOVER_WILSON_DSLASH;
if(invParam.CloverParams.twisted_m_usedP == true){
mg_inv_param.dslash_type = QUDA_CLOVER_HASENBUSCH_TWIST_DSLASH;
mg_inv_param.mu = toDouble(invParam.twist);
}else{
mg_inv_param.dslash_type = QUDA_CLOVER_WILSON_DSLASH;
}
mg_inv_param.inv_type = QUDA_GCR_INVERTER;
mg_inv_param.tol = 1e-10;
mg_inv_param.maxiter = 10000;
Expand All @@ -132,7 +136,7 @@ namespace Chroma {
mg_inv_param.clover_cuda_prec_sloppy = gpu_half_prec;
mg_inv_param.clover_cuda_prec_precondition = gpu_half_prec;
mg_inv_param.clover_order = QUDA_PACKED_CLOVER_ORDER;
//
//
//Done...
// Autotuning
if( invParam.tuneDslashP ) {
Expand Down Expand Up @@ -219,9 +223,13 @@ namespace Chroma {

if (ip.check_multigrid_setup == true ) {
mg_param.run_verify = QUDA_BOOLEAN_YES;
mg_param.run_low_mode_check = QUDA_BOOLEAN_NO;
mg_param.run_oblique_proj_check = QUDA_BOOLEAN_NO;
}
else {
mg_param.run_verify = QUDA_BOOLEAN_NO;
mg_param.run_low_mode_check = QUDA_BOOLEAN_NO;
mg_param.run_oblique_proj_check = QUDA_BOOLEAN_NO;
}

for (int i=0; i<mg_param.n_level-1; ++i) {
Expand Down Expand Up @@ -258,9 +266,8 @@ namespace Chroma {
mg_param.nu_pre[i] = ip.nu_pre[i];
mg_param.nu_post[i] = ip.nu_post[i];
}

mg_param.mu_factor[i] = 1.0; // default is one in QUDA test program

//mg_param.mu_factor[i] = 1.0; // default is one in QUDA test program
mg_param.mu_factor[i] = toDouble(ip.mu_factor[i]);
// Hardwire setup solver now
if ( i < mg_param.n_level-1) {
mg_param.setup_inv_type[i] = theChromaToQudaSolverTypeMap::Instance()[ ip.subspaceSolver[i]];
Expand Down Expand Up @@ -383,6 +390,9 @@ namespace Chroma {
QDP_abort(1);
break;
}

mg_param.vec_infile[i][0] = '\0';
mg_param.vec_outfile[i][0] = '\0';
}
mg_param.setup_type = QUDA_NULL_VECTOR_SETUP;
mg_param.pre_orthonormalize = QUDA_BOOLEAN_NO;
Expand All @@ -398,11 +408,6 @@ namespace Chroma {
: QUDA_COMPUTE_NULL_VECTOR_NO;
mg_param.generate_all_levels = ip.generate_all_levels ? QUDA_BOOLEAN_YES
: QUDA_BOOLEAN_NO;

for(int l=0; l < ip.mg_levels; l++) {
mg_param.vec_infile[l][0] = '\0';
mg_param.vec_outfile[l][0] = '\0';
}
QDPIO::cout<<"Basic MULTIGRID params copied."<<std::endl;
}
// setup the multigrid solver
Expand Down
3 changes: 3 additions & 0 deletions lib/actions/ferm/invert/quda_solvers/quda_multigrid_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ namespace Chroma {
maxIterations.resize(mg_levels);
readArray<int>(paramtop, "MaxCoarseIterations", maxIterations, 12 );

mu_factor.resize(mg_levels);
readArray<Real>(paramtop, "MuFactor", mu_factor, 1.0);

smootherType.resize(mg_levels);
readArray<QudaSolverType>(paramtop, "SmootherType", smootherType, MR);

Expand Down
7 changes: 5 additions & 2 deletions lib/actions/ferm/invert/quda_solvers/quda_multigrid_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ namespace Chroma
multi1d<int> maxIterSubspaceCreate;
multi1d<Real> rsdTargetSubspaceCreate;
multi1d<int> maxIterSubspaceRefresh;

multi1d<Real> mu_factor;

MULTIGRIDSolverParams(XMLReader& xml, const std::string& path);
MULTIGRIDSolverParams() {

Expand Down Expand Up @@ -73,12 +74,13 @@ namespace Chroma
tol.resize(mg_levels);
maxIterations.resize(mg_levels);
coarseSolverType.resize(mg_levels);

smootherType.resize(mg_levels);
smootherTol.resize(mg_levels);
relaxationOmegaMG.resize(mg_levels);
smootherSchwarzType.resize(mg_levels);
smootherSchwarzCycle.resize(mg_levels);
mu_factor.resize(mg_levels);
generate_nullspace = true;
for(int l = 0; l < mg_levels - 1; l++)
{
Expand All @@ -103,6 +105,7 @@ namespace Chroma
relaxationOmegaMG[l] = 0.85;
smootherSchwarzType[l] = INVALID_SCHWARZ;
smootherSchwarzCycle[l] = 1;
mu_factor[l] = 1.0;
}
outer_gcr_nkrylov = 12;
precond_gcr_nkrylov = 12;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,9 @@ class LinOpSysSolverQUDAMULTIGRIDWilson : public LinOpSystemSolver<LatticeFermio
mg_param.location[i] = QUDA_CUDA_FIELD_LOCATION;
mg_param.smoother_solve_type[i] = QUDA_DIRECT_PC_SOLVE;
mg_param.coarse_grid_solution_type[i] = QUDA_MATPC_SOLUTION;

mg_param.vec_infile[i][0] = '\0';
mg_param.vec_outfile[i][0] = '\0';
}

// only coarsen the spin on the first restriction
Expand All @@ -557,10 +560,6 @@ class LinOpSysSolverQUDAMULTIGRIDWilson : public LinOpSystemSolver<LatticeFermio
mg_param.compute_null_vector = ip.generate_nullspace ? QUDA_COMPUTE_NULL_VECTOR_YES
: QUDA_COMPUTE_NULL_VECTOR_NO;

for(int l=0; l < ip.mg_levels; ++l) {
mg_param.vec_infile[l][0] = '\0';
mg_param.vec_outfile[l][0] = '\0';
}
QDPIO::cout<<"Basic MULTIGRID params copied."<<std::endl;
quda_inv_param.verbosity = QUDA_VERBOSE;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace Chroma
//
// So M x = b => A_oo (M_symm) x = b
// => M_symm x = A^{-1}_oo b = chi_mod
invclov.apply(mod_chi, chi_s, PLUS, 1);
invclov.apply(mod_chi, chi_s, PLUS, 1);
}
else {
// If we work with symmetric preconditioning nothing else needs done
Expand Down
Loading