10 static void report(
const char *type) {
25 deflate_compute(true),
26 recompute_evals(!
param.eig_param.preserve_evals)
102 errorQuda(
"Extended Steepest Descent is multi-gpu only");
114 report(
"MPBICGSTAB");
190 if (space && space->
evecs.size() != 0) {
195 errorQuda(
"Preserved deflation space size %lu does not match expected %d", space->
evecs.size(),
199 for (
auto &vec : space->
evecs)
evecs.push_back(vec);
202 errorQuda(
"Preserved eigenvalues %lu does not match expected %lu", space->
evals.size(),
evals.size());
205 for (
auto &val : space->
evals)
evals.push_back(val);
207 space->
evecs.resize(0);
208 space->
evals.resize(0);
238 for (
auto &vec : space->
evecs)
240 space->
evecs.resize(0);
247 space->
svd = (
evecs.size() == 2 *
evals.size()) ?
true :
false;
250 for (
auto &vec :
evecs) space->
evecs.push_back(vec);
253 for (
auto &val :
evals) space->
evals.push_back(val);
257 for (
auto &vec :
evecs)
268 if (!
evecs.empty())
errorQuda(
"Solver deflation space should be empty, instead size=%lu\n", defl_space.size());
270 evals.resize(defl_space.size());
272 for (
auto &e : defl_space) {
evecs.push_back(e); }
273 defl_space.resize(0);
278 if (!defl_space.empty())
279 errorQuda(
"Container deflation space should be empty, instead size=%lu\n", defl_space.size());
283 for (
auto &e :
evecs) { defl_space.push_back(e); }
317 double lowest = (b2 < 1.0) ? b2 : 1.0;
332 if (std::isnan(hq2) || std::isinf(hq2))
333 errorQuda(
"Solver appears to have diverged with heavy quark residual %9.6e", hq2);
335 if (hq2 > hq_tol)
return false;
340 if (std::isnan(r2) || std::isinf(r2))
errorQuda(
"Solver appears to have diverged with residual %9.6e", r2);
342 if (r2 > r2_tol)
return false;
352 if (std::isnan(hq2) || std::isinf(hq2))
353 errorQuda(
"Solver appears to have diverged with heavy quark residual %9.6e", hq2);
355 if (hq2 > hq_tol)
return false;
365 if (std::isnan(r2) || std::isinf(r2))
errorQuda(
"Solver appears to have diverged with residual %9.6e", r2);
367 if (r2 > r2_tol)
return false;
376 printfQuda(
"%s: %5d iterations, <r,r> = %9.6e, |r|/|b| = %9.6e, heavy-quark residual = %9.6e\n", name, k, r2,
379 printfQuda(
"%s: %5d iterations, <r,r> = %9.6e, |r|/|b| = %9.6e\n", name, k, r2,
sqrt(r2 / b2));
383 if (std::isnan(r2) || std::isinf(r2))
errorQuda(
"Solver appears to have diverged");
387 double r2_tol,
double hq_tol) {
391 printfQuda(
"%s: Convergence at %d iterations, L2 relative residual: iterated = %9.6e, true = %9.6e "
392 "(requested = %9.6e), heavy-quark residual = %9.6e (requested = %9.6e)\n",
395 printfQuda(
"%s: Convergence at %d iterations, L2 relative residual: iterated = %9.6e, true = %9.6e "
396 "(requested = %9.6e)\n",
401 printfQuda(
"%s: Convergence at %d iterations, L2 relative residual: iterated = %9.6e "
402 "(requested = %9.6e), heavy-quark residual = %9.6e (requested = %9.6e)\n",
405 printfQuda(
"%s: Convergence at %d iterations, L2 relative residual: iterated = %9.6e (requested = %9.6e)\n",
406 name, k,
sqrt(r2 / b2),
sqrt(r2_tol / b2));
431 for (
int i = 0; i < n; i++) {
432 if (std::isnan(r2[i]) || std::isinf(r2[i]))
433 errorQuda(
"Multishift solver appears to have diverged on shift %d with residual %9.6e", i, r2[i]);
435 if (r2[i] > r2_tol[i] && r2_tol[i] != 0.0)
return false;
Communication-avoiding CG solver. This solver does un-preconditioned CG, running in steps of n_krylov...
Communication-avoiding GCR solver. This solver does un-preconditioned GCR, first building up a polyno...
Conjugate-Gradient Solver.
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
ColorSpinorField & Component(const int idx) const
virtual bool hermitian() const
static EigenSolver * create(QudaEigParam *eig_param, const DiracMatrix &mat, TimeProfile &profile)
Creates the eigensolver using the parameters given and the matrix.
bool convergence(const double *r2, const double *r2_tol, int n) const
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 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.
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 extendSVDDeflationSpace()
Extends the deflation space to twice its size for SVD deflation.
std::vector< Complex > evals
virtual bool hermitian()=0
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 & matSloppy
bool isRunning(QudaProfileType idx)
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
enum QudaPrecision_s QudaPrecision
@ QUDA_HEAVY_QUARK_RESIDUAL
@ QUDA_L2_ABSOLUTE_RESIDUAL
@ QUDA_L2_RELATIVE_RESIDUAL
enum QudaResidualType_s QudaResidualType
@ QUDA_INC_EIGCG_INVERTER
@ QUDA_BICGSTABL_INVERTER
@ QUDA_MPBICGSTAB_INVERTER
void stop()
Stop profiling.
__host__ __device__ ValueType sqrt(ValueType x)
__host__ __device__ ValueType pow(ValueType x, ExponentType e)
void * preserve_deflation_space
QudaBoolean preserve_deflation
bool is_preconditioner
verbosity to use for preconditioner
QudaResidualType residual_type
QudaPrecision precision_precondition
QudaPrecision precision_sloppy
bool mg_instance
whether to use a global or local (node) reduction for this solver
double true_res_offset[QUDA_MAX_MULTI_SHIFT]
QudaPrecision precision_eigensolver
QudaInverterType inv_type
double true_res_hq_offset[QUDA_MAX_MULTI_SHIFT]
QudaInverterType inv_type_precondition
This is an object that captures the state required for a deflated solver.
std::vector< ColorSpinorField * > evecs
std::vector< Complex > evals
QudaVerbosity getVerbosity()