339 if (
param.rhs_idx != 0
414 m = (
m / 16) * 16 + 16;
415 warningQuda(
"\nSwitched eigenvector search dimension to %d\n",
m);
477 std::vector<ColorSpinorField *>
evecs;
522 bool convergence(
double r2,
double hq2,
double r2_tol,
double hq_tol);
532 bool convergenceHQ(
double r2,
double hq2,
double r2_tol,
double hq_tol);
541 bool convergenceL2(
double r2,
double hq2,
double r2_tol,
double hq_tol);
551 void PrintStats(
const char *name,
int k,
double r2,
double b2,
double hq2);
564 void PrintSummary(
const char *name,
int k,
double r2,
double b2,
double r2_tol,
double hq_tol);
633 virtual double flops()
const {
return 0; }
643 ColorSpinorField *yp, *rp, *rnewp, *pp, *App, *tmpp, *tmp2p, *tmp3p, *rSloppyp, *xSloppyp;
644 std::vector<ColorSpinorField*> p;
657 (*this)(out, in,
nullptr, 0.0);
723 ColorSpinorField *yp, *rp, *tmpp, *ArSp, *rSp, *xSp, *xS_oldp, *tmpSp, *rS_oldp, *tmp2Sp;
780 void computeMatrixPowers(std::vector<cudaColorSpinorField>& out, std::vector<cudaColorSpinorField>& in,
int nsteps);
864 Complex rho0, rho1, alpha, omega, beta;
865 Complex *gamma, *gamma_prime, *gamma_prime_prime;
875 std::vector<ColorSpinorField*> r;
876 std::vector<ColorSpinorField*> u;
886 int reliable(
double &rNorm,
double &maxrx,
double &maxrr,
const double &r2,
const double &delta);
891 void computeTau(
Complex **tau,
double *sigma, std::vector<ColorSpinorField*> r,
int begin,
int size,
int j);
892 void updateR(
Complex **tau, std::vector<ColorSpinorField*> r,
int begin,
int size,
int j);
893 void orthoDir(
Complex **tau,
double* sigma, std::vector<ColorSpinorField*> r,
int j,
int pipeline);
895 void updateUend(
Complex *gamma, std::vector<ColorSpinorField *> u,
int n_krylov);
942 std::vector<ColorSpinorField*> p;
943 std::vector<ColorSpinorField*> Ap;
1008 std::vector<ColorSpinorField*> S;
1009 std::vector<ColorSpinorField*> AS;
1010 std::vector<ColorSpinorField*> Q;
1011 std::vector<ColorSpinorField*> Qtmp;
1012 std::vector<ColorSpinorField*> AQ;
1029 void compute_alpha();
1034 void compute_beta();
1039 int reliable(
double &rNorm,
double &maxrr,
int &rUpdate,
const double &r2,
const double &delta);
1104 const bool use_source;
1116 std::vector<ColorSpinorField*> p;
1117 std::vector<ColorSpinorField*> q;
1208 if (
dirac.hasSpecialMG()) {
1213 (*solver)(*out, *in);
1214 if (
dirac.hasSpecialMG()) {
1252 bool convergence(
const double *r2,
const double *r2_tol,
int n)
const;
1271 void operator()(std::vector<ColorSpinorField*>x,
ColorSpinorField &b, std::vector<ColorSpinorField*> &p,
double* r2_old_array );
1281 std::vector<ColorSpinorField*> p;
1283 (*this)(out, in, p, r2_old.get());
1285 for (
auto &pp : p)
delete pp;
1320 void solve(
Complex *psi_, std::vector<ColorSpinorField*> &p,
1339 std::vector<std::pair<ColorSpinorField*,ColorSpinorField*> > basis);
1348 std::vector<ColorSpinorField*> p,
1349 std::vector<ColorSpinorField*> q);
1393 void RestartVT(
const double beta,
const double rho);
BiCGstab(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
BiCGstabL(const DiracMatrix &mat, const DiracMatrix &matSloppy, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
Communication-avoiding CG solver. This solver does un-preconditioned CG, running in steps of n_krylov...
CACG(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
CACGNE(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
CACGNR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
Communication-avoiding GCR solver. This solver does un-preconditioned GCR, first building up a polyno...
CAGCR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
CG3(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
CG3NE(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
CG3NR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
Conjugate-Gradient Solver.
void operator()(ColorSpinorField &out, ColorSpinorField &in)
Run CG.
void blocksolve(ColorSpinorField &out, ColorSpinorField &in)
CG(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
Run CG.
CGNE(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
Run CG.
CGNR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
QudaSiteSubset SiteSubset() const
GCR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
GMResDR(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
void UpdateSolution(ColorSpinorField *x, ColorSpinorField *r, bool do_gels)
int FlexArnoldiProcedure(const int start_idx, const bool do_givens)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
void RunDeflatedCycles(ColorSpinorField *out, ColorSpinorField *in, const double tol_threshold)
void increment(ColorSpinorField &V, int n_ev)
Expands deflation space.
void operator()(ColorSpinorField &out, ColorSpinorField &in)
int eigCGsolve(ColorSpinorField &out, ColorSpinorField &in)
void UpdateVm(ColorSpinorField &res, double beta, double sqrtr2)
int initCGsolve(ColorSpinorField &out, ColorSpinorField &in)
IncEigCG(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
void RestartVT(const double beta, const double rho)
MPBiCGstab(const DiracMatrix &mat, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
MPCG(const DiracMatrix &mat, SolverParam ¶m, TimeProfile &profile)
MR(const DiracMatrix &mat, const DiracMatrix &matSloppy, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
This computes the optimum guess for the system Ax=b in the L2 residual norm. For use in the HMD force...
TimeProfile & profile
whether A is hermitian ot not
bool apply_mat
Whether to construct an orthogonal basis or not.
void operator()(ColorSpinorField &x, ColorSpinorField &b, std::vector< std::pair< ColorSpinorField *, ColorSpinorField * > > basis)
bool hermitian
Whether to compute q = Ap or assume it is provided.
MinResExt(const DiracMatrix &mat, bool orthogonal, bool apply_mat, bool hermitian, TimeProfile &profile)
void solve(Complex *psi_, std::vector< ColorSpinorField * > &p, std::vector< ColorSpinorField * > &q, ColorSpinorField &b, bool hermitian)
Solve the equation A p_k psi_k = q_k psi_k = b by minimizing the residual and using Eigen's SVD algor...
Multi-Shift Conjugate Gradient Solver.
MultiShiftCG(const DiracMatrix &mat, const DiracMatrix &matSloppy, SolverParam ¶m, TimeProfile &profile)
void operator()(std::vector< ColorSpinorField * > out, ColorSpinorField &in)
Run multi-shift and return Krylov-space at the end of the solve in p and r2_old_arry.
void operator()(std::vector< ColorSpinorField * >x, ColorSpinorField &b, std::vector< ColorSpinorField * > &p, double *r2_old_array)
Run multi-shift and return Krylov-space at the end of the solve in p and r2_old_arry.
const DiracMatrix & matSloppy
virtual void operator()(std::vector< ColorSpinorField * > out, ColorSpinorField &in)=0
MultiShiftSolver(const DiracMatrix &mat, const DiracMatrix &matSloppy, SolverParam ¶m, TimeProfile &profile)
bool convergence(const double *r2, const double *r2_tol, int n) const
virtual ~MultiShiftSolver()
void operator()(ColorSpinorField &out, ColorSpinorField &in)
PreconCG(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
Solver & ExposeSolver() const
Return reference to the solver. Used when mass/mu rescaling an MG instance.
PreconditionedSolver(Solver &solver, const Dirac &dirac, SolverParam ¶m, TimeProfile &profile, const char *prefix)
virtual ~PreconditionedSolver()
void operator()(ColorSpinorField &x, ColorSpinorField &b)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
SD(const DiracMatrix &mat, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
virtual ~SimpleBiCGstab()
SimpleBiCGstab(const DiracMatrix &mat, SolverParam ¶m, TimeProfile &profile)
const DiracMatrix & Msloppy()
double precisionEpsilon(QudaPrecision prec=QUDA_INVALID_PRECISION) const
Returns the epsilon tolerance for a given precision, by default returns the solver precision.
void extractDeflationSpace(std::vector< ColorSpinorField * > &defl_space)
Extracts the deflation space from the solver to the vector argument. Note the solver deflation space ...
Solver(const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam ¶m, TimeProfile &profile)
bool convergenceL2(double r2, double hq2, double r2_tol, double hq_tol)
Test for L2 solver convergence – ignore HQ residual.
virtual void operator()(ColorSpinorField &out, ColorSpinorField &in)=0
const DiracMatrix & Meig()
virtual void blocksolve(ColorSpinorField &out, ColorSpinorField &in)
bool convergence(double r2, double hq2, double r2_tol, double hq_tol)
std::vector< ColorSpinorField * > evecs
bool convergenceHQ(double r2, double hq2, double r2_tol, double hq_tol)
Test for HQ solver convergence – ignore L2 residual.
virtual double flops() const
Return flops.
int deflationSpaceSize() const
Returns the size of deflation space.
void destroyDeflationSpace()
Destroy the allocated deflation space.
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)....
const DiracMatrix & matEig
void injectDeflationSpace(std::vector< ColorSpinorField * > &defl_space)
Injects a deflation space into the solver from the vector argument. Note the input space is reduced t...
static double stopping(double tol, double b2, QudaResidualType residual_type)
Set the solver L2 stopping condition.
void setDeflateCompute(bool flag)
Sets the deflation compute boolean.
void extendSVDDeflationSpace()
Extends the deflation space to twice its size for SVD deflation.
std::vector< Complex > evals
virtual bool hermitian()=0
void setRecomputeEvals(bool flag)
Sets the recompute evals boolean.
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)
void constructDeflationSpace(const ColorSpinorField &meta, const DiracMatrix &mat)
Constructs the deflation space and eigensolver.
const DiracMatrix & matPrecon
static Solver * create(SolverParam ¶m, const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, TimeProfile &profile)
Solver factory.
const DiracMatrix & Mprecon()
const DiracMatrix & matSloppy
XSD(const DiracMatrix &mat, SolverParam ¶m, TimeProfile &profile)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
void reduceDouble(double &)
quda::mgarray< int > nvec
QudaSolutionType solution_type
enum QudaPrecision_s QudaPrecision
enum QudaUseInitGuess_s QudaUseInitGuess
enum QudaPreserveSource_s QudaPreserveSource
enum QudaSolutionType_s QudaSolutionType
enum QudaInverterType_s QudaInverterType
enum QudaExtLibType_s QudaExtLibType
enum QudaComputeNullVector_s QudaComputeNullVector
enum QudaResidualType_s QudaResidualType
@ QUDA_GMRESDR_PROJ_INVERTER
@ QUDA_INC_EIGCG_INVERTER
@ QUDA_PRESERVE_SOURCE_NO
enum QudaCABasis_s QudaCABasis
enum QudaSchwarzType_s QudaSchwarzType
enum QudaVerbosity_s QudaVerbosity
@ QUDA_COMPUTE_NULL_VECTOR_NO
QudaPrecision & cuda_prec
QudaPrecision & cuda_prec_sloppy
QudaPrecision & cuda_prec_eigensolver
QudaPrecision & cuda_prec_precondition
QudaPrecision & cuda_prec_refinement_sloppy
QudaPrecision & cuda_prec_ritz
std::complex< double > Complex
Main header file for the QUDA library.
#define QUDA_MAX_MULTI_SHIFT
Maximum number of shifts supported by the multi-shift solver. This number may be changed if need be.
QudaPreserveSource preserve_source
void updateRhsIndex(QudaInvertParam ¶m)
QudaComputeNullVector compute_null_vector
double iter_res_offset[QUDA_MAX_MULTI_SHIFT]
bool is_preconditioner
verbosity to use for preconditioner
bool use_sloppy_partial_accumulator
QudaSchwarzType schwarz_type
int max_res_increase_total
QudaResidualType residual_type
bool use_alternative_reliable
QudaExtLibType extlib_type
QudaPrecision precision_refinement_sloppy
double offset[QUDA_MAX_MULTI_SHIFT]
SolverParam(const SolverParam ¶m)
double tol_hq_offset[QUDA_MAX_MULTI_SHIFT]
QudaPrecision precision_precondition
QudaPrecision precision_sloppy
bool mg_instance
whether to use a global or local (node) reduction for this solver
double tol_offset[QUDA_MAX_MULTI_SHIFT]
double true_res_offset[QUDA_MAX_MULTI_SHIFT]
int solution_accumulator_pipeline
QudaPrecision precision_eigensolver
QudaInverterType inv_type
QudaPrecision precision_ritz
QudaVerbosity verbosity_precondition
double true_res_hq_offset[QUDA_MAX_MULTI_SHIFT]
QudaUseInitGuess use_init_guess
int max_hq_res_restart_total
QudaInverterType inv_type_precondition
void updateInvertParam(QudaInvertParam ¶m, int offset=-1)
bool global_reduction
whether the solver acting as a preconditioner for another solver
SolverParam(const QudaInvertParam ¶m)
This is an object that captures the state required for a deflated solver.
std::vector< ColorSpinorField * > evecs
std::vector< Complex > evals
void popOutputPrefix()
Pop the output prefix restoring the prior one on the stack.
void pushOutputPrefix(const char *prefix)
Push a new output prefix onto the stack.