18 Solver(param, profile), mat(mat), matSloppy(matSloppy), matPrecon(matPrecon),
init(false) {
37 int reliable(
double &rNorm,
double &maxrx,
double &maxrr,
const double &r2,
const double &delta) {
40 if (rNorm > maxrx) maxrx = rNorm;
41 if (rNorm > maxrr) maxrr = rNorm;
44 int updateR = (rNorm < delta*maxrr) ? 1 : 0;
104 errorQuda(
"Null vector computing requires non-zero guess!");
156 const bool use_heavy_quark_res =
175 double rNorm =
sqrt(r2);
177 double maxrr = rNorm;
178 double maxrx = rNorm;
180 PrintStats(
"BiCGstab", k, r2, b2, heavy_quark_res);
193 printfQuda(
"BiCGstab debug: x2=%e, r2=%e, v2=%e, p2=%e, tmp2=%e r0=%e t2=%e\n",
209 if (
abs(rho) == 0.0) alpha = 0.0;
210 else alpha = rho / r0v;
222 double t2 = omega_t2.z;
227 r2 = s2 - real(omega *
conj(tr)) ;
230 updateR =
reliable(rNorm, maxrx, maxrr, r2, delta);
234 omega =
Complex(omega_t2.x / omega_t2.z, omega_t2.y / omega_t2.z);
246 rho =
Complex(rho_r2.x, rho_r2.y);
250 if (use_heavy_quark_res && k%heavy_quark_check==0) {
251 if (&x != &xSloppy) {
282 PrintStats(
"BiCGstab", k, r2, b2, heavy_quark_res);
284 printfQuda(
"BiCGstab debug: x2=%e, r2=%e, v2=%e, p2=%e, tmp2=%e r0=%e t2=%e\n",
290 if (
abs(rho*alpha) == 0.0) beta = 0.0;
291 else beta = (rho/rho0) * (alpha/omega);
343 if (&x != &xSloppy)
delete x_sloppy;
void setPrecision(QudaPrecision precision, QudaPrecision ghost_precision=QUDA_INVALID_PRECISION, bool force_native=false)
double3 cDotProductNormA(ColorSpinorField &a, ColorSpinorField &b)
QudaVerbosity getVerbosity()
double norm2(const ColorSpinorField &a)
__host__ __device__ ValueType sqrt(ValueType x)
Complex cDotProduct(ColorSpinorField &, ColorSpinorField &)
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) ...
cudaColorSpinorField * tmp
double3 xpyHeavyQuarkResidualNorm(ColorSpinorField &x, ColorSpinorField &y, ColorSpinorField &r)
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
bool convergence(double r2, double hq2, double r2_tol, double hq_tol)
void copy(ColorSpinorField &dst, const ColorSpinorField &src)
BiCGstab(DiracMatrix &mat, DiracMatrix &matSloppy, DiracMatrix &matPrecon, SolverParam ¶m, TimeProfile &profile)
double xmyNorm(ColorSpinorField &x, ColorSpinorField &y)
QudaPreserveSource preserve_source
void fillInnerSolveParam(SolverParam &inner, const SolverParam &outer)
QudaComputeNullVector compute_null_vector
double Last(QudaProfileType idx)
QudaResidualType residual_type
static double stopping(double tol, double b2, QudaResidualType residual_type)
Set the solver L2 stopping condition.
const DiracMatrix & matSloppy
void caxpbypzYmbw(const Complex &, ColorSpinorField &, const Complex &, ColorSpinorField &, ColorSpinorField &, ColorSpinorField &)
void operator()(ColorSpinorField &out, ColorSpinorField &in)
bool is_preconditioner
verbosity to use for preconditioner
double3 HeavyQuarkResidualNorm(ColorSpinorField &x, ColorSpinorField &r)
std::complex< double > Complex
void init()
Create the CUBLAS context.
void caxpy(const Complex &a, ColorSpinorField &x, ColorSpinorField &y)
void zero(ColorSpinorField &a)
double3 caxpbypzYmbwcDotProductUYNormY(const Complex &a, ColorSpinorField &x, const Complex &b, ColorSpinorField &y, ColorSpinorField &z, ColorSpinorField &w, ColorSpinorField &u)
unsigned long long flops() const
int reliable(double &rNorm, double &maxrx, double &maxrr, const double &r2, const double &delta)
void xpy(ColorSpinorField &x, ColorSpinorField &y)
const DiracMatrix & matPrecon
QudaUseInitGuess use_init_guess
__host__ __device__ ValueType abs(ValueType x)
void cxpaypbz(ColorSpinorField &, const Complex &b, ColorSpinorField &y, const Complex &c, ColorSpinorField &z)
QudaPrecision precision_sloppy
bool use_sloppy_partial_accumulator
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.
__host__ __device__ ValueType conj(ValueType x)
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
QudaPrecision Precision() const
void updateR()
update the radius for halos.