QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Private Member Functions | Private Attributes | List of all members
quda::CACG Class Reference

Communication-avoiding CG solver. This solver does un-preconditioned CG, running in steps of nKrylov, build up a polynomial in the linear operator of length nKrylov, and then performs a steepest descent minimization on the resulting basis vectors. For now only implemented using the power basis so is only useful as a preconditioner. More...

#include <invert_quda.h>

Inheritance diagram for quda::CACG:
Inheritance graph
[legend]
Collaboration diagram for quda::CACG:
Collaboration graph
[legend]

Public Member Functions

 CACG (DiracMatrix &mat, DiracMatrix &matSloppy, SolverParam &param, TimeProfile &profile)
 
virtual ~CACG ()
 
void operator() (ColorSpinorField &out, ColorSpinorField &in)
 
- Public Member Functions inherited from quda::Solver
 Solver (SolverParam &param, TimeProfile &profile)
 
virtual ~Solver ()
 
virtual void blocksolve (ColorSpinorField &out, ColorSpinorField &in)
 
bool convergence (double r2, double hq2, double r2_tol, double hq_tol)
 
bool convergenceHQ (double r2, double hq2, double r2_tol, double hq_tol)
 Test for HQ solver convergence – ignore L2 residual. More...
 
bool convergenceL2 (double r2, double hq2, double r2_tol, double hq_tol)
 Test for L2 solver convergence – ignore HQ residual. More...
 
void PrintStats (const char *name, int k, double r2, double b2, double hq2)
 Prints out the running statistics of the solver (requires a verbosity of QUDA_VERBOSE) More...
 
void PrintSummary (const char *name, int k, double r2, double b2, double r2_tol, double hq_tol)
 Prints out the summary of the solver convergence (requires a verbosity of QUDA_SUMMARIZE). Assumes SolverParam.true_res and SolverParam.true_res_hq has been set. More...
 
void constructDeflationSpace (const ColorSpinorField &meta, const DiracMatrix &mat, bool svd)
 Constructs the deflation space. More...
 
virtual double flops () const
 

Private Member Functions

void create (ColorSpinorField &b)
 Initiate the fields needed by the solver. More...
 
void compute_alpha ()
 Compute the alpha coefficients. More...
 
void compute_beta ()
 Compute the beta coefficients. More...
 
int reliable (double &rNorm, double &maxrr, int &rUpdate, const double &r2, const double &delta)
 

Private Attributes

const DiracMatrixmat
 
const DiracMatrixmatSloppy
 
bool init
 
bool lambda_init
 
QudaCABasis basis
 
ComplexQ_AQandg
 
ComplexQ_AS
 
Complexalpha
 
Complexbeta
 
ColorSpinorFieldrp
 
ColorSpinorFieldtmpp
 
ColorSpinorFieldtmpp2
 
ColorSpinorFieldtmp_sloppy
 
ColorSpinorFieldtmp_sloppy2
 
std::vector< ColorSpinorField * > S
 
std::vector< ColorSpinorField * > AS
 
std::vector< ColorSpinorField * > Q
 
std::vector< ColorSpinorField * > Qtmp
 
std::vector< ColorSpinorField * > AQ
 

Additional Inherited Members

- Static Public Member Functions inherited from quda::Solver
static Solvercreate (SolverParam &param, DiracMatrix &mat, DiracMatrix &matSloppy, DiracMatrix &matPrecon, TimeProfile &profile)
 
static double stopping (double tol, double b2, QudaResidualType residual_type)
 Set the solver L2 stopping condition. More...
 
- Public Attributes inherited from quda::Solver
EigenSolvereig_solve
 
bool deflate_init = false
 
std::vector< ColorSpinorField * > defl_tmp1
 
std::vector< ColorSpinorField * > defl_tmp2
 
- Protected Attributes inherited from quda::Solver
SolverParamparam
 
TimeProfileprofile
 
int node_parity
 

Detailed Description

Communication-avoiding CG solver. This solver does un-preconditioned CG, running in steps of nKrylov, build up a polynomial in the linear operator of length nKrylov, and then performs a steepest descent minimization on the resulting basis vectors. For now only implemented using the power basis so is only useful as a preconditioner.

Definition at line 891 of file invert_quda.h.

Constructor & Destructor Documentation

◆ CACG()

quda::CACG::CACG ( DiracMatrix mat,
DiracMatrix matSloppy,
SolverParam param,
TimeProfile profile 
)

Definition at line 15 of file inv_ca_cg.cpp.

◆ ~CACG()

quda::CACG::~CACG ( )
virtual

Member Function Documentation

◆ compute_alpha()

void quda::CACG::compute_alpha ( )
private

Compute the alpha coefficients.

Definition at line 302 of file inv_ca_cg.cpp.

References alpha, quda::SolverParam::is_preconditioner, quda::TimeProfile::Last(), quda::Solver::param, quda::Solver::profile, Q, Q_AQandg, quda::QUDA_PROFILE_COMPUTE, quda::QUDA_PROFILE_EIGEN, and quda::SolverParam::secs.

Referenced by operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_beta()

void quda::CACG::compute_beta ( )
private

Compute the beta coefficients.

Definition at line 376 of file inv_ca_cg.cpp.

References beta, quda::SolverParam::is_preconditioner, quda::TimeProfile::Last(), quda::Solver::param, quda::Solver::profile, Q, Q_AQandg, Q_AS, quda::QUDA_PROFILE_COMPUTE, quda::QUDA_PROFILE_EIGEN, and quda::SolverParam::secs.

Referenced by operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create()

void quda::CACG::create ( ColorSpinorField b)
private

Initiate the fields needed by the solver.

Parameters
[in]bSource vector used for solver meta data. If we're not preserving the source vector and we have a uni-precision solver, we set p[0] = b to save memory and memory copying.

Definition at line 208 of file inv_ca_cg.cpp.

References alpha, AQ, AS, basis, beta, quda::Solver::constructDeflationSpace(), quda::ColorSpinorParam::create, quda::ColorSpinorField::Create(), csParam, quda::SolverParam::deflate, quda::Solver::deflate_init, quda::blas::flops, quda::CACGNR::init, quda::SolverParam::is_preconditioner, mat, quda::SolverParam::Nkrylov, quda::Solver::param, quda::SolverParam::precision, quda::SolverParam::precision_sloppy, quda::Solver::profile, Q, Q_AQandg, Q_AS, Qtmp, QUDA_NULL_FIELD_CREATE, QUDA_POWER_BASIS, quda::QUDA_PROFILE_INIT, rp, quda::ColorSpinorParam::setPrecision(), tmp_sloppy, tmp_sloppy2, tmpp, and tmpp2.

Referenced by operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator()()

void quda::CACG::operator() ( ColorSpinorField out,
ColorSpinorField in 
)
virtual

Implements quda::Solver.

Reimplemented in quda::CACGNR, and quda::CACGNE.

Definition at line 450 of file inv_ca_cg.cpp.

References alpha, AQ, AS, quda::blas::ax(), quda::blas::axpy(), basis, beta, quda::SolverParam::ca_lambda_max, quda::SolverParam::ca_lambda_min, quda::blas::caxpy(), quda::blas::caxpyz(), quda::blas::cDotProduct(), checkPrecision, compute_alpha(), compute_beta(), quda::SolverParam::compute_null_vector, quda::SolverParam::compute_true_res, quda::Solver::convergence(), quda::blas::copy(), create(), quda::Solver::defl_tmp1, quda::Solver::defl_tmp2, quda::SolverParam::deflate, quda::EigenSolver::deflate(), quda::SolverParam::delta, quda::Solver::eig_solve, errorQuda, quda::SolverParam::evals, quda::SolverParam::evecs, quda::blas::flops, quda::DiracMatrix::flops(), getVerbosity(), quda::SolverParam::gflops, quda::blas::HeavyQuarkResidualNorm(), quda::SolverParam::is_preconditioner, quda::SolverParam::iter, lambda_init, quda::TimeProfile::Last(), mat, matSloppy, quda::SolverParam::max_res_increase, quda::SolverParam::max_res_increase_total, quda::SolverParam::maxiter, quda::SolverParam::Nkrylov, quda::blas::norm2(), quda::Solver::param, quda::SolverParam::precision, quda::SolverParam::preserve_source, printfQuda, quda::Solver::PrintStats(), quda::Solver::PrintSummary(), quda::Solver::profile, Q, Q_AQandg, Q_AS, Qtmp, QUDA_CHEBYSHEV_BASIS, QUDA_COMPUTE_NULL_VECTOR_NO, QUDA_HEAVY_QUARK_RESIDUAL, QUDA_POWER_BASIS, QUDA_PRESERVE_SOURCE_YES, quda::QUDA_PROFILE_COMPUTE, quda::QUDA_PROFILE_EPILOGUE, quda::QUDA_PROFILE_INIT, quda::QUDA_PROFILE_PREAMBLE, QUDA_SUMMARIZE, QUDA_USE_INIT_GUESS_NO, QUDA_USE_INIT_GUESS_YES, QUDA_VERBOSE, qudaDeviceSynchronize, R, reliable(), quda::SolverParam::residual_type, quda::SolverParam::return_residual, rp, quda::SolverParam::secs, quda::SolverParam::sloppy_converge, quda::sqrt(), quda::Solver::stopping(), swap(), tmp, tmp2, tmp_sloppy, tmp_sloppy2, tmpp, tmpp2, quda::SolverParam::tol, quda::SolverParam::tol_hq, quda::SolverParam::true_res, quda::SolverParam::true_res_hq, quda::SolverParam::use_init_guess, warningQuda, X, quda::blas::xmyNorm(), quda::blas::xpay(), and quda::blas::zero().

Referenced by quda::CACGNE::operator()(), and quda::CACGNR::operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reliable()

int quda::CACG::reliable ( double &  rNorm,
double &  maxrr,
int &  rUpdate,
const double &  r2,
const double &  delta 
)
private

@ brief Check if it's time for a reliable update

Definition at line 426 of file inv_ca_cg.cpp.

References quda::sqrt(), and updateR().

Referenced by operator()().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ alpha

Complex* quda::CACG::alpha
private

Definition at line 903 of file invert_quda.h.

Referenced by compute_alpha(), create(), operator()(), and ~CACG().

◆ AQ

std::vector<ColorSpinorField*> quda::CACG::AQ
private

Definition at line 916 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ AS

std::vector<ColorSpinorField*> quda::CACG::AS
private

Definition at line 913 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ basis

QudaCABasis quda::CACG::basis
private

Definition at line 899 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ beta

Complex* quda::CACG::beta
private

Definition at line 904 of file invert_quda.h.

Referenced by compute_beta(), create(), operator()(), and ~CACG().

◆ init

bool quda::CACG::init
private

Definition at line 896 of file invert_quda.h.

Referenced by ~CACG().

◆ lambda_init

bool quda::CACG::lambda_init
private

Definition at line 898 of file invert_quda.h.

Referenced by operator()().

◆ mat

const DiracMatrix& quda::CACG::mat
private

Definition at line 894 of file invert_quda.h.

Referenced by create(), and operator()().

◆ matSloppy

const DiracMatrix& quda::CACG::matSloppy
private

Definition at line 895 of file invert_quda.h.

Referenced by operator()().

◆ Q

std::vector<ColorSpinorField*> quda::CACG::Q
private

Definition at line 914 of file invert_quda.h.

Referenced by compute_alpha(), compute_beta(), create(), operator()(), and ~CACG().

◆ Q_AQandg

Complex* quda::CACG::Q_AQandg
private

Definition at line 901 of file invert_quda.h.

Referenced by compute_alpha(), compute_beta(), create(), operator()(), and ~CACG().

◆ Q_AS

Complex* quda::CACG::Q_AS
private

Definition at line 902 of file invert_quda.h.

Referenced by compute_beta(), create(), operator()(), and ~CACG().

◆ Qtmp

std::vector<ColorSpinorField*> quda::CACG::Qtmp
private

Definition at line 915 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ rp

ColorSpinorField* quda::CACG::rp
private

Definition at line 906 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ S

std::vector<ColorSpinorField*> quda::CACG::S
private

Definition at line 912 of file invert_quda.h.

◆ tmp_sloppy

ColorSpinorField* quda::CACG::tmp_sloppy
private

Definition at line 909 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ tmp_sloppy2

ColorSpinorField* quda::CACG::tmp_sloppy2
private

Definition at line 910 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ tmpp

ColorSpinorField* quda::CACG::tmpp
private

Definition at line 907 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().

◆ tmpp2

ColorSpinorField* quda::CACG::tmpp2
private

Definition at line 908 of file invert_quda.h.

Referenced by create(), operator()(), and ~CACG().


The documentation for this class was generated from the following files: