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

MdagM solver from mg_proto #56

Open
wants to merge 7 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2121,13 +2121,15 @@ nobase_include_HEADERS += \
actions/ferm/invert/mg_proto/mg_proto_qphix_helpers.h \
meas/inline/io/inline_erase_mg_proto_qphix_space.h \
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix.h \
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix_eo.h
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix_eo.h \
actions/ferm/invert/mg_proto/syssolver_mdagm_clover_mg_proto_qphix_eo.h

libchroma_a_SOURCES += \
actions/ferm/invert/mg_proto/mg_proto_qphix_helpers.cc \
meas/inline/io/inline_erase_mg_proto_qphix_space.cc \
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix.cc \
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix_eo.cc
actions/ferm/invert/mg_proto/syssolver_linop_clover_mg_proto_qphix_eo.cc \
actions/ferm/invert/mg_proto/syssolver_mdagm_clover_mg_proto_qphix_eo.cc
endif

endif
Expand Down
5 changes: 5 additions & 0 deletions lib/actions/ferm/invert/mg_proto/mg_proto_qphix_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ using MGPreconditionerEO = MGPreconditionerT<MG::QPhiXMultigridLevelsEO, MG::VCy


// for testing
template<typename QPhiXLinOpT>
std::shared_ptr<QPhiXLinOpT>
createFineLinOpT( const MGProtoSolverParams& params, const multi1d<LatticeColorMatrix>& u,
const MG::LatticeInfo& info);

std::shared_ptr<MG::QPhiXWilsonCloverLinearOperator>
createFineLinOp( const MGProtoSolverParams& params, const multi1d<LatticeColorMatrix>& u,
const MG::LatticeInfo& info);
Expand Down
11 changes: 11 additions & 0 deletions lib/actions/ferm/invert/mg_proto/mgproto_solver_params.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ MGProtoSolverParams::MGProtoSolverParams(XMLReader& xml, const std::string& path
read( paramtop, "OuterSolverRsdTarget", OuterSolverRsdTarget);
read( paramtop, "OuterSolverMaxIters", OuterSolverMaxIters);
read( paramtop, "OuterSolverVerboseP", OuterSolverVerboseP);
if( paramtop.count("RsdToleranceFactor") > 0 ) {
read(paramtop, "RsdToleranceFactor", RsdToleranceFactor);
} else {
RsdToleranceFactor = 10;
}

if( paramtop.count("ThresholdCount") > 0 ) {
read(paramtop, "ThresholdCount", ThresholdCount);
} else {
ThresholdCount = 50; // current setup for test
}

read( paramtop, "VCyclePreSmootherMaxIters", VCyclePreSmootherMaxIters, MGLevels-1);
read( paramtop, "VCyclePreSmootherRsdTarget", VCyclePreSmootherRsdTarget, MGLevels-1);
Expand Down
2 changes: 2 additions & 0 deletions lib/actions/ferm/invert/mg_proto/mgproto_solver_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ struct MGProtoSolverParams {
// Details of Outer Solver
int OuterSolverNKrylov;
Double OuterSolverRsdTarget;
Double RsdToleranceFactor;
int OuterSolverMaxIters;
bool OuterSolverVerboseP;
int ThresholdCount;

// VCycle Details (MGLevels - 1 of these)
// Presmoother
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace Chroma
LinOpSysSolverMGProtoQPhiXEOClover::operator()(T& psi, const T& chi) const
{
QDPIO::cout << "Jolly Greetings from Even-Odd Multigridland" << std::endl;
const Subset& s = A->subset();
const Subset& s = A->subset();
StopWatch swatch;
StopWatch swatch2;

Expand Down Expand Up @@ -146,10 +146,10 @@ namespace Chroma
MG::LinearSolverResults res=(*eo_solver)(qphix_out,qphix_in, RELATIVE);

swatch2.stop();

double qphix_out_norm_cb0 = MG::Norm2Vec(qphix_out, SUBSET_EVEN);
double qphix_out_norm_cb1 = MG::Norm2Vec(qphix_out, SUBSET_ODD);

psi = zero;
QPhiXSpinorToQDPSpinor(qphix_out,psi);
Double psi_norm_cb0 = norm2(psi,rb[0]);
Expand All @@ -170,8 +170,9 @@ namespace Chroma
Double n2 = norm2(tmp,s);
Double n2rel = n2 / norm2(chi,s);
QDPIO::cout << "MG_PROTO_QPHIX_EO_CLOVER_INVERTER: iters = "<< res.n_count << " rel resid = " << sqrt(n2rel) << std::endl;
if( toBool( sqrt(n2rel) > invParam.OuterSolverRsdTarget ) ) {
MGSolverException convergence_fail(invParam.CloverParams.Mass,
if( toBool( sqrt(n2rel) > invParam.OuterSolverRsdTarget * invParam.RsdToleranceFactor) ) {
QDPIO::cout<<"MG_PROTO Solver Not Converged!"<<std::endl;
MGSolverException convergence_fail(invParam.CloverParams.Mass,
subspaceId,
res.n_count,
Real(sqrt(n2rel)),
Expand Down
Loading