|
QUDA
0.9.0
|
#include <multigrid.h>


Public Member Functions | |
| MG (MGParam ¶m, TimeProfile &profile) | |
| virtual | ~MG () |
| void | createSmoother () |
| Create the smoothers. More... | |
| void | destroySmoother () |
| Free the smoothers. More... | |
| void | reset () |
| void | verify () |
| void | operator() (ColorSpinorField &out, ColorSpinorField &in) |
| void | loadVectors (std::vector< ColorSpinorField *> &B) |
| Load the null space vectors in from file. More... | |
| void | saveVectors (std::vector< ColorSpinorField *> &B) |
| Save the null space vectors in from file. More... | |
| void | generateNullVectors (std::vector< ColorSpinorField *> B) |
| Generate the 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 (SolverParam ¶m, TimeProfile &profile) | |
| virtual | ~Solver () |
| virtual void | solve (ColorSpinorField &out, ColorSpinorField &in) |
| bool | convergence (const double &r2, const double &hq2, const double &r2_tol, const double &hq_tol) |
| bool | convergenceHQ (const double &r2, const double &hq2, const double &r2_tol, const double &hq_tol) |
| bool | convergenceL2 (const double &r2, const double &hq2, const double &r2_tol, const double &hq_tol) |
| void | PrintStats (const char *, int k, const double &r2, const double &b2, const double &hq2) |
| void | PrintSummary (const char *name, int k, const double &r2, const double &b2) |
Private Attributes | |
| MGParam & | param |
| Transfer * | transfer |
| Solver * | presmoother |
| Solver * | postsmoother |
| TimeProfile & | profile_global |
| TimeProfile | profile |
| char | prefix [128] |
| char | coarse_prefix [128] |
| MG * | coarse |
| MG * | fine |
| Solver * | coarse_solver |
| MGParam * | param_coarse |
| SolverParam * | param_presmooth |
| SolverParam * | param_postsmooth |
| SolverParam * | param_coarse_solver |
| std::vector< ColorSpinorField * > * | B |
| std::vector< ColorSpinorField * > * | B_coarse |
| ColorSpinorField * | r |
| ColorSpinorField * | b_tilde |
| ColorSpinorField * | r_coarse |
| ColorSpinorField * | x_coarse |
| ColorSpinorField * | tmp_coarse |
| Dirac * | diracCoarseResidual |
| Dirac * | diracCoarseSmoother |
| Dirac * | diracCoarseSmootherSloppy |
| DiracMatrix * | matCoarseResidual |
| DiracMatrix * | matCoarseSmoother |
| DiracMatrix * | matCoarseSmootherSloppy |
Additional Inherited Members | |
Static Public Member Functions inherited from quda::Solver | |
| static Solver * | create (SolverParam ¶m, DiracMatrix &mat, DiracMatrix &matSloppy, DiracMatrix &matPrecon, TimeProfile &profile) |
| static double | stopping (const double &tol, const double &b2, QudaResidualType residual_type) |
Protected Attributes inherited from quda::Solver | |
| SolverParam & | param |
| TimeProfile & | profile |
Adaptive Multigrid solver
Definition at line 172 of file multigrid.h.
| quda::MG::MG | ( | MGParam & | param, |
| TimeProfile & | profile | ||
| ) |
Constructor for MG class
| param | MGParam struct that defines all meta data |
| profile | Timeprofile instance used to profile |
Definition at line 13 of file multigrid.cpp.
References quda::MGParam::B, B_coarse, b_tilde, coarse, quda::MGParam::coarse_grid_solution_type, QudaMultigridParam_s::coarse_grid_solution_type, coarse_prefix, coarse_solver, QudaMultigridParam_s::compute_null_vector, quda::SolverParam::compute_true_res, quda::Solver::create(), quda::ColorSpinorField::Create(), createSmoother(), csParam, quda::MGParam::cycle_type, quda::DiracParam::dagger, quda::SolverParam::delta, quda::DiracParam::dirac, diracCoarseResidual, diracCoarseSmoother, diracCoarseSmootherSloppy, e, errorQuda, quda::ColorSpinorField::Even(), quda::DiracMatrix::Expose(), quda::MGParam::fine, QudaMultigridParam_s::generate_all_levels, generateNullVectors(), QudaMultigridParam_s::geo_block_size, quda::MGParam::geoBlockSize, getVerbosity(), quda::SolverParam::global_reduction, fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::SolverParam::inv_type, quda::SolverParam::inv_type_precondition, QudaMultigridParam_s::invert_param, quda::SolverParam::is_preconditioner, quda::DiracParam::kappa, quda::Dirac::Kappa(), quda::MGParam::level, loadVectors(), quda::MGParam::location, QudaMultigridParam_s::location, matCoarseResidual, matCoarseSmoother, matCoarseSmootherSloppy, matpc_type, QudaInvertParam_s::matpc_type, quda::DiracParam::matpcType, quda::MGParam::matResidual, quda::MGParam::matSmooth, quda::SolverParam::maxiter, quda::MGParam::mg_global, quda::DiracParam::mu, quda::Dirac::Mu(), quda::DiracParam::mu_factor, QudaMultigridParam_s::mu_factor, QudaMultigridParam_s::n_vec, quda::SolverParam::Nkrylov, quda::MGParam::Nlevel, quda::MGParam::Nvec, param, param_coarse, param_coarse_solver, quda::SolverParam::pipeline, quda::SolverParam::precision_precondition, quda::SolverParam::precision_sloppy, quda::SolverParam::preconditioner, prefix, quda::SolverParam::preserve_source, quda::TimeProfile::Print(), printfQuda, profile, profile_global, QUDA_BOOLEAN_NO, QUDA_BOOLEAN_YES, QUDA_COARSE_DIRAC, QUDA_COARSEPC_DIRAC, QUDA_COMPUTE_NULL_VECTOR_YES, QUDA_CUDA_FIELD_LOCATION, QUDA_DAG_NO, QUDA_DEGRAND_ROSSI_GAMMA_BASIS, QUDA_DIRECT_PC_SOLVE, QUDA_DOUBLE_PRECISION, QUDA_FLOAT2_FIELD_ORDER, QUDA_FLOAT4_FIELD_ORDER, QUDA_GCR_INVERTER, QUDA_MATPC_SOLUTION, QUDA_MAX_MG_LEVEL, QUDA_MG_CYCLE_RECURSIVE, QUDA_MG_CYCLE_VCYCLE, QUDA_MG_INVERTER, QUDA_NULL_FIELD_CREATE, QUDA_PARITY_SITE_SUBSET, QUDA_PRESERVE_SOURCE_YES, QUDA_SUMMARIZE, QUDA_UKQCD_GAMMA_BASIS, QUDA_USE_INIT_GUESS_NO, quda::Transfer::R(), r, r_coarse, reset(), QudaMultigridParam_s::run_verify, setOutputPrefix(), quda::MGParam::smoother_solve_type, QudaMultigridParam_s::smoother_solve_type, QudaMultigridParam_s::smoother_tol, quda::MGParam::spinBlockSize, sprintf(), strcmp(), quda::DiracParam::tmp1, tmp_coarse, quda::SolverParam::tol, quda::DiracParam::transfer, transfer, quda::DiracParam::type, quda::SolverParam::use_init_guess, QudaMultigridParam_s::vec_infile, QudaMultigridParam_s::verbosity, quda::SolverParam::verbosity_precondition, verify(), x_coarse, and quda::zero().

|
virtual |
Destructor for MG class. Frees any existing coarse grid MG instance
Definition at line 268 of file multigrid.cpp.
References B_coarse, b_tilde, coarse, coarse_solver, quda::MGParam::cycle_type, destroySmoother(), diracCoarseResidual, diracCoarseSmoother, diracCoarseSmootherSloppy, getVerbosity(), fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::MGParam::level, matCoarseResidual, matCoarseSmoother, matCoarseSmootherSloppy, quda::MGParam::mg_global, QudaMultigridParam_s::n_vec, quda::MGParam::Nlevel, quda::MGParam::Nvec, param, param_coarse, param_coarse_solver, quda::TimeProfile::Print(), profile, QUDA_DIRECT_PC_SOLVE, QUDA_MG_CYCLE_RECURSIVE, QUDA_SUMMARIZE, r, r_coarse, quda::MGParam::smoother_solve_type, tmp_coarse, transfer, and x_coarse.

| void quda::MG::createSmoother | ( | ) |
Create the smoothers.
Definition at line 213 of file multigrid.cpp.
References quda::SolverParam::compute_true_res, quda::Solver::create(), QudaInvertParam_s::cuda_prec_precondition, quda::SolverParam::delta, e, quda::MGParam::global_reduction, quda::SolverParam::global_reduction, quda::SolverParam::inv_type, quda::SolverParam::inv_type_precondition, QudaMultigridParam_s::invert_param, quda::SolverParam::is_preconditioner, quda::MGParam::level, quda::MGParam::matSmooth, quda::MGParam::matSmoothSloppy, quda::SolverParam::maxiter, quda::MGParam::mg_global, quda::SolverParam::Nkrylov, quda::MGParam::Nlevel, quda::MGParam::nu_post, quda::MGParam::nu_pre, param, param_postsmooth, param_presmooth, quda::SolverParam::pipeline, postsmoother, quda::SolverParam::precision_precondition, quda::SolverParam::precision_sloppy, quda::SolverParam::preserve_source, presmoother, printfQuda, profile, QUDA_INVALID_INVERTER, QUDA_PRESERVE_SOURCE_NO, QUDA_USE_INIT_GUESS_NO, QUDA_USE_INIT_GUESS_YES, quda::MGParam::smoother, quda::MGParam::smoother_tol, quda::SolverParam::tol, and quda::SolverParam::use_init_guess.
Referenced by MG(), and updateMultigridQuda().


| void quda::MG::destroySmoother | ( | ) |
Free the smoothers.
Definition at line 254 of file multigrid.cpp.
References quda::MGParam::level, quda::MGParam::Nlevel, param, param_postsmooth, param_presmooth, postsmoother, and presmoother.
Referenced by updateMultigridQuda(), and ~MG().

|
virtual |
Return the total flops done on this and all coarser levels.
Reimplemented from quda::Solver.
Definition at line 303 of file multigrid.cpp.
References coarse, quda::Transfer::flops(), flops(), quda::SolverParam::gflops, quda::MGParam::level, quda::MGParam::Nlevel, param, param_postsmooth, param_presmooth, and transfer.
Referenced by flops().


| void quda::MG::generateNullVectors | ( | std::vector< ColorSpinorField *> | B | ) |
Generate the null-space vectors.
| B | Generated null-space vectors |
Definition at line 744 of file multigrid.cpp.
References quda::ax(), b, B, quda::blas::caxpy(), quda::blas::cDotProduct(), quda::SolverParam::compute_null_vector, quda::Solver::create(), quda::ColorSpinorField::Create(), csParam, QudaInvertParam_s::cuda_prec_precondition, quda::SolverParam::delta, dirac, e, errorQuda, quda::DiracMatrix::Expose(), getVerbosity(), fused_exterior_ndeg_tm_dslash_cuda_gen::i, in, int, quda::SolverParam::inv_type, quda::SolverParam::inv_type_precondition, QudaMultigridParam_s::invert_param, quda::MGParam::level, quda::MGParam::matSmooth, quda::MGParam::matSmoothSloppy, quda::SolverParam::maxiter, quda::SolverParam::maxiter_precondition, quda::MGParam::mg_global, quda::SolverParam::Nkrylov, quda::norm2(), QudaMultigridParam_s::nu_post, QudaMultigridParam_s::nu_pre, out, param, quda::SolverParam::pipeline, quda::SolverParam::precision_precondition, quda::SolverParam::precision_sloppy, quda::SolverParam::precondition_cycle, printfQuda, profile, QUDA_BICGSTABL_INVERTER, QUDA_CG_INVERTER, QUDA_COMPUTE_NULL_VECTOR_YES, QUDA_CUDA_FIELD_LOCATION, QUDA_DOUBLE_PRECISION, QUDA_FLOAT2_FIELD_ORDER, QUDA_GCR_INVERTER, QUDA_HALF_PRECISION, QUDA_L2_RELATIVE_RESIDUAL, QUDA_MAT_SOLUTION, QUDA_NULL_FIELD_CREATE, QUDA_RANDOM_SOURCE, QUDA_UKQCD_GAMMA_BASIS, QUDA_USE_INIT_GUESS_YES, QUDA_VERBOSE, QUDA_ZERO_FIELD_CREATE, quda::SolverParam::residual_type, saveVectors(), QudaMultigridParam_s::setup_inv_type, QudaMultigridParam_s::setup_tol, QudaMultigridParam_s::smoother, QudaMultigridParam_s::smoother_tol, quda::Solver::solve(), quda::sqrt(), strcmp(), quda::SolverParam::tol, quda::SolverParam::tol_precondition, quda::SolverParam::use_init_guess, QudaMultigridParam_s::vec_outfile, x, and quda::zero().
Referenced by MG().


| void quda::MG::loadVectors | ( | std::vector< ColorSpinorField *> & | B | ) |
Load the null space vectors in from file.
| B | Loaded null-space vectors (pre-allocated) |
Definition at line 648 of file multigrid.cpp.
References B, c, quda::ColorSpinorField::Create(), csParam, errorQuda, fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::MGParam::level, quda::MGParam::mg_global, param, printfQuda, profile_global, QUDA_CONSTANT_SOURCE, quda::QUDA_PROFILE_INIT, quda::QUDA_PROFILE_IO, QUDA_RANDOM_SOURCE, QUDA_ZERO_FIELD_CREATE, read_spinor_field(), s, strcmp(), tmp, V, vec_infile, QudaMultigridParam_s::vec_infile, quda::blas::xpy(), and quda::zero().
Referenced by MG().


|
virtual |
This applies the V-cycle to the residual vector returning the residual vector
| out | The solution vector |
| in | The residual vector (or equivalently the right hand side vector) |
Implements quda::Solver.
Definition at line 530 of file multigrid.cpp.
References axpby(), b, b_tilde, quda::MGParam::coarse_grid_solution_type, quda::debug, dirac, errorQuda, quda::ColorSpinorField::Even(), quda::DiracMatrix::Expose(), in, quda::MGParam::level, quda::MGParam::matResidual, quda::MGParam::matSmooth, quda::MGParam::Nlevel, quda::norm2(), out, quda::Transfer::P(), param, prefix, printfQuda, QUDA_DIRECT_PC_SOLVE, QUDA_DIRECT_SOLVE, QUDA_FULL_SITE_SUBSET, QUDA_MAT_SOLUTION, QUDA_MATPC_SOLUTION, quda::Transfer::R(), r, r_coarse, setOutputPrefix(), quda::MGParam::smoother_solve_type, strncpy(), transfer, x, x_coarse, quda::blas::xmyNorm(), and quda::blas::xpy().

| void quda::MG::reset | ( | ) |
This method is a placeholder for reseting the solver, e.g., when a parameter has changed such as the mass. For now, all it does is call Transfer::setSiteSubset to resize the on-GPU null-space components to single-parity if we're doing a single-parity solve (memory saving technique).
Definition at line 203 of file multigrid.cpp.
References coarse, quda::MGParam::coarse_grid_solution_type, QudaMultigridParam_s::invert_param, quda::MGParam::level, matpc_type, QudaInvertParam_s::matpc_type, quda::MGParam::mg_global, quda::MGParam::Nlevel, param, parity, QUDA_EVEN_PARITY, QUDA_FULL_SITE_SUBSET, QUDA_MATPC_EVEN_EVEN, QUDA_MATPC_EVEN_EVEN_ASYMMETRIC, QUDA_MATPC_SOLUTION, QUDA_ODD_PARITY, QUDA_PARITY_SITE_SUBSET, reset(), quda::Transfer::setSiteSubset(), and transfer.
Referenced by MG(), and reset().


| void quda::MG::saveVectors | ( | std::vector< ColorSpinorField *> & | B | ) |
Save the null space vectors in from file.
| B | Save null-space vectors from here |
Definition at line 708 of file multigrid.cpp.
References B, errorQuda, host_free, fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::MGParam::level, quda::MGParam::mg_global, param, printfQuda, profile_global, quda::QUDA_PROFILE_INIT, quda::QUDA_PROFILE_IO, safe_malloc, strcmp(), V, vec_outfile, QudaMultigridParam_s::vec_outfile, and write_spinor_field().
Referenced by generateNullVectors().


| void quda::MG::verify | ( | ) |
This method verifies the correctness of the MG method. It checks:
Verification that the constructed multigrid operator is valid
Definition at line 327 of file multigrid.cpp.
References quda::arpackSolve(), quda::MGParam::B, quda::blas::cDotProduct(), coarse, quda::MGParam::coarse_grid_solution_type, quda::ColorSpinorParam::create, quda::ColorSpinorField::Create(), csParam, dirac, dot(), e, errorQuda, quda::DiracMatrix::Expose(), fabs(), quda::ColorSpinorParam::fieldOrder, free(), quda::MGParam::geoBlockSize, fused_exterior_ndeg_tm_dslash_cuda_gen::i, quda::Dirac::Kappa(), kappa, quda::MGParam::level, quda::ColorSpinorParam::location, QudaMultigridParam_s::location, malloc(), quda::MGParam::matResidual, quda::MGParam::matSmooth, quda::Dirac::MdagM(), quda::MGParam::mg_global, quda::Dirac::Mu(), QudaMultigridParam_s::mu_factor, quda::MGParam::Nlevel, quda::norm2(), quda::MGParam::Nvec, quda::Transfer::P(), param, param_coarse, pow(), prefix, printfQuda, QUDA_CPU_FIELD_LOCATION, QUDA_DIRECT_PC_SOLVE, QUDA_DOUBLE_PRECISION, QUDA_EVEN_PARITY, QUDA_MATPC_SOLUTION, QUDA_NULL_FIELD_CREATE, QUDA_ODD_PARITY, QUDA_PARITY_SITE_SUBSET, QUDA_RANDOM_SOURCE, QUDA_SINGLE_PRECISION, QUDA_SPACE_SPIN_COLOR_FIELD_ORDER, QUDA_ZERO_FIELD_CREATE, quda::Transfer::R(), r, r_coarse, setOutputPrefix(), quda::LatticeFieldParam::siteSubset, quda::MGParam::smoother_solve_type, quda::ColorSpinorField::Source(), quda::MGParam::spinBlockSize, sprintf(), quda::sqrt(), tmp1, tmp2, tmp_coarse, tol, transfer, quda::ColorSpinorField::TwistFlavor(), quda::Transfer::Vectors(), verify(), quda::ColorSpinorField::Volume(), warningQuda, quda::LatticeFieldParam::x, x, x_coarse, quda::blas::xmyNorm(), and quda::zero().
Referenced by MG(), and verify().


|
private |
The fine-grid representation of the null space vectors
Definition at line 218 of file multigrid.h.
Referenced by generateNullVectors(), loadVectors(), and saveVectors().
|
private |
The coarse-grid representation of the null space vectors
Definition at line 221 of file multigrid.h.
|
private |
Projected source vector for preconditioned syste, else just points to source
Definition at line 227 of file multigrid.h.
Referenced by MG(), operator()(), and ~MG().
|
private |
|
private |
Prefix label used for printf on next coarse level
Definition at line 194 of file multigrid.h.
Referenced by MG().
|
private |
The coarse grid solver - this either points at "coarse" or a solver preconditioned by "coarse"
Definition at line 203 of file multigrid.h.
|
private |
The coarse operator used for computing inter-grid residuals
Definition at line 239 of file multigrid.h.
|
private |
The coarse operator used for doing smoothing
Definition at line 242 of file multigrid.h.
|
private |
The coarse operator used for doing sloppy smoothing
Definition at line 245 of file multigrid.h.
|
private |
This is the next coarser level
Definition at line 200 of file multigrid.h.
|
private |
Wrapper for the residual coarse grid operator
Definition at line 248 of file multigrid.h.
|
private |
Wrapper for the smoothing coarse grid operator
Definition at line 251 of file multigrid.h.
|
private |
Wrapper for the sloppy smoothing coarse grid operator
Definition at line 254 of file multigrid.h.
|
private |
Local copy of the multigrid metadata
Definition at line 176 of file multigrid.h.
Referenced by createSmoother(), destroySmoother(), flops(), generateNullVectors(), loadVectors(), MG(), operator()(), reset(), saveVectors(), verify(), and ~MG().
|
private |
Storage for the parameter struct for the coarse grid
Definition at line 206 of file multigrid.h.
|
private |
Storage for the parameter struct for the coarse solver
Definition at line 215 of file multigrid.h.
|
private |
Storage for the parameter struct for the post-smoother
Definition at line 212 of file multigrid.h.
Referenced by createSmoother(), destroySmoother(), and flops().
|
private |
Storage for the parameter struct for the pre-smoother
Definition at line 209 of file multigrid.h.
Referenced by createSmoother(), destroySmoother(), and flops().
|
private |
Definition at line 182 of file multigrid.h.
Referenced by createSmoother(), and destroySmoother().
|
private |
Prefix label used for printf at this level
Definition at line 191 of file multigrid.h.
Referenced by MG(), operator()(), and verify().
|
private |
This is the smoother used
Definition at line 182 of file multigrid.h.
Referenced by createSmoother(), and destroySmoother().
|
private |
TimeProfile for this level
Definition at line 188 of file multigrid.h.
Referenced by createSmoother(), generateNullVectors(), MG(), and ~MG().
|
private |
TimeProfile for all levels (refers to profile from parent solver)
Definition at line 185 of file multigrid.h.
Referenced by loadVectors(), MG(), and saveVectors().
|
private |
Residual vector
Definition at line 224 of file multigrid.h.
Referenced by MG(), operator()(), verify(), and ~MG().
|
private |
Coarse residual vector
Definition at line 230 of file multigrid.h.
Referenced by MG(), operator()(), verify(), and ~MG().
|
private |
Coarse temporary vector
Definition at line 236 of file multigrid.h.
|
private |
This is the transfer operator that defines the prolongation and restriction operators
Definition at line 179 of file multigrid.h.
Referenced by flops(), MG(), operator()(), reset(), verify(), and ~MG().
|
private |
Coarse solution vector
Definition at line 233 of file multigrid.h.
Referenced by MG(), operator()(), verify(), and ~MG().
1.8.14