QUDA  v1.1.0
A library for QCD on GPUs
Public Member Functions | List of all members
quda::MG Class Reference

#include <multigrid.h>

+ Inheritance diagram for quda::MG:

Public Member Functions

 MG (MGParam &param, TimeProfile &profile)
 
virtual ~MG ()
 
bool hermitian ()
 
void reset (bool refresh=false)
 This method resets the solver, e.g., when a parameter has changed such as the mass. More...
 
void dumpNullVectors () const
 Dump the null-space vectors to disk. Will recurse dumping all levels. More...
 
void createSmoother ()
 Create the smoothers. More...
 
void destroySmoother ()
 Destroy the smoothers. More...
 
void createCoarseDirac ()
 Create the coarse dirac operator. More...
 
void createCoarseSolver ()
 Create the solver wrapper. More...
 
void destroyCoarseSolver ()
 Destroy the solver wrapper. More...
 
void verify (bool recursively=false)
 Verify the correctness of the MG method, optionally recursively starting from the top down. More...
 
void operator() (ColorSpinorField &out, ColorSpinorField &in)
 
void loadVectors (std::vector< ColorSpinorField * > &B)
 Load the null space vectors in from file. More...
 
void saveVectors (const std::vector< ColorSpinorField * > &B) const
 Save the null space vectors in from file. More...
 
void generateNullVectors (std::vector< ColorSpinorField * > &B, bool refresh=false)
 Generate the null-space vectors. More...
 
void generateEigenVectors ()
 Generate lowest eigenvectors. More...
 
void buildFreeVectors (std::vector< ColorSpinorField * > &B)
 Build free-field null-space vectors. More...
 
double flops () const
 Return the total flops done on this and all coarser levels. More...
 
- Public Member Functions inherited from quda::Solver
 Solver (const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, SolverParam &param, TimeProfile &profile)
 
virtual ~Solver ()
 
virtual void blocksolve (ColorSpinorField &out, ColorSpinorField &in)
 
const DiracMatrixM ()
 
const DiracMatrixMsloppy ()
 
const DiracMatrixMprecon ()
 
const DiracMatrixMeig ()
 
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...
 
double precisionEpsilon (QudaPrecision prec=QUDA_INVALID_PRECISION) const
 Returns the epsilon tolerance for a given precision, by default returns the solver precision. More...
 
void constructDeflationSpace (const ColorSpinorField &meta, const DiracMatrix &mat)
 Constructs the deflation space and eigensolver. More...
 
void destroyDeflationSpace ()
 Destroy the allocated deflation space. More...
 
void extendSVDDeflationSpace ()
 Extends the deflation space to twice its size for SVD deflation. More...
 
void injectDeflationSpace (std::vector< ColorSpinorField * > &defl_space)
 Injects a deflation space into the solver from the vector argument. Note the input space is reduced to zero size as a result of calling this function, with responsibility for the space transferred to the solver. More...
 
void extractDeflationSpace (std::vector< ColorSpinorField * > &defl_space)
 Extracts the deflation space from the solver to the vector argument. Note the solver deflation space is reduced to zero size as a result of calling this function, with responsibility for the space transferred to the argument. More...
 
int deflationSpaceSize () const
 Returns the size of deflation space. More...
 
void setDeflateCompute (bool flag)
 Sets the deflation compute boolean. More...
 
void setRecomputeEvals (bool flag)
 Sets the recompute evals boolean. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from quda::Solver
static Solvercreate (SolverParam &param, const DiracMatrix &mat, const DiracMatrix &matSloppy, const DiracMatrix &matPrecon, const DiracMatrix &matEig, TimeProfile &profile)
 Solver factory. More...
 
static double stopping (double tol, double b2, QudaResidualType residual_type)
 Set the solver L2 stopping condition. More...
 
- Protected Attributes inherited from quda::Solver
const DiracMatrixmat
 
const DiracMatrixmatSloppy
 
const DiracMatrixmatPrecon
 
const DiracMatrixmatEig
 
SolverParamparam
 
TimeProfileprofile
 
int node_parity
 
EigenSolvereig_solve
 
bool deflate_init
 
bool deflate_compute
 
bool recompute_evals
 
std::vector< ColorSpinorField * > evecs
 
std::vector< Complexevals
 

Detailed Description

Adaptive Multigrid solver

Definition at line 182 of file multigrid.h.

Constructor & Destructor Documentation

◆ MG()

quda::MG::MG ( MGParam param,
TimeProfile profile 
)

Constructor for MG class

Parameters
paramMGParam struct that defines all meta data
profileTimeprofile instance used to profile

Definition at line 16 of file multigrid.cpp.

◆ ~MG()

quda::MG::~MG ( )
virtual

Destructor for MG class. Frees any existing coarse grid MG instance

Definition at line 681 of file multigrid.cpp.

Member Function Documentation

◆ buildFreeVectors()

void quda::MG::buildFreeVectors ( std::vector< ColorSpinorField * > &  B)

Build free-field null-space vectors.

Parameters
BFree-field null-space vectors

Definition at line 1478 of file multigrid.cpp.

◆ createCoarseDirac()

void quda::MG::createCoarseDirac ( )

Create the coarse dirac operator.

Definition at line 362 of file multigrid.cpp.

◆ createCoarseSolver()

void quda::MG::createCoarseSolver ( )

Create the solver wrapper.

Definition at line 539 of file multigrid.cpp.

◆ createSmoother()

void quda::MG::createSmoother ( )

Create the smoothers.

Definition at line 301 of file multigrid.cpp.

◆ destroyCoarseSolver()

void quda::MG::destroyCoarseSolver ( )

Destroy the solver wrapper.

Definition at line 510 of file multigrid.cpp.

◆ destroySmoother()

void quda::MG::destroySmoother ( )

Destroy the smoothers.

Definition at line 274 of file multigrid.cpp.

◆ dumpNullVectors()

void quda::MG::dumpNullVectors ( ) const

Dump the null-space vectors to disk. Will recurse dumping all levels.

Definition at line 1275 of file multigrid.cpp.

◆ flops()

double quda::MG::flops ( ) const
virtual

Return the total flops done on this and all coarser levels.

Reimplemented from quda::Solver.

Definition at line 734 of file multigrid.cpp.

◆ generateEigenVectors()

void quda::MG::generateEigenVectors ( )

Generate lowest eigenvectors.

Definition at line 1653 of file multigrid.cpp.

◆ generateNullVectors()

void quda::MG::generateNullVectors ( std::vector< ColorSpinorField * > &  B,
bool  refresh = false 
)

Generate the null-space vectors.

Parameters
BGenerated null-space vectors
refreshWhether we refreshing pre-exising vectors or starting afresh

Definition at line 1285 of file multigrid.cpp.

◆ hermitian()

bool quda::MG::hermitian ( )
inlinevirtual
Returns
MG can solve non-Hermitian systems

Implements quda::Solver.

Definition at line 310 of file multigrid.h.

◆ loadVectors()

void quda::MG::loadVectors ( std::vector< ColorSpinorField * > &  B)

Load the null space vectors in from file.

Parameters
BLoaded null-space vectors (pre-allocated)

Definition at line 1231 of file multigrid.cpp.

◆ operator()()

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

This applies the V-cycle to the residual vector returning the residual vector

Parameters
outThe solution vector
inThe residual vector (or equivalently the right hand side vector)

Implements quda::Solver.

Definition at line 1095 of file multigrid.cpp.

◆ reset()

void quda::MG::reset ( bool  refresh = false)

This method resets the solver, e.g., when a parameter has changed such as the mass.

Parameters
Whetherwe are refreshing the null-space components or just updating the operators

Definition at line 126 of file multigrid.cpp.

◆ saveVectors()

void quda::MG::saveVectors ( const std::vector< ColorSpinorField * > &  B) const

Save the null space vectors in from file.

Parameters
BSave null-space vectors from here

Definition at line 1253 of file multigrid.cpp.

◆ verify()

void quda::MG::verify ( bool  recursively = false)

Verify the correctness of the MG method, optionally recursively starting from the top down.

This method verifies the correctness of the MG method. It checks:

  1. Null-space vectors are exactly preserved: v_k = P R v_k
  2. Any coarse vector is exactly preserved on the fine grid: eta_c = R P eta_c
  3. The emulated coarse Dirac operator matches the native one: D_c = R D P
  4. The preconditioned operator was correctly formulated: \hat{D}_c - X^{-1} D_c
  5. The normal operator is indeed normal: im(<x|D^\dag D|x>) < epsilon
    Parameters
    recursively[in]Whether or not to recursively verify coarser levels, default false
    Verification that the constructed multigrid operator is valid

Definition at line 764 of file multigrid.cpp.


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