28 const double unitarize_eps = 1e-14;
29 const double max_error = 1e-10;
30 const int reunit_allow_svd = 1;
31 const int reunit_svd_only = 0;
32 const double svd_rel_error = 1e-6;
33 const double svd_abs_error = 1e-6;
45 qudaMemcpy(&num_failures, num_failures_dev,
sizeof(
int), cudaMemcpyDeviceToHost);
46 if (num_failures > 0)
errorQuda(
"Error in the unitarization\n");
54 printfQuda(
"prec sloppy_prec link_recon sloppy_link_recon S_dimension T_dimension Ls_dimension\n");
62 printfQuda(
" - level %d number of null-space vectors %d\n", i+1,
nvec[i]);
63 printfQuda(
" - level %d number of pre-smoother applications %d\n", i+1,
nu_pre[i]);
64 printfQuda(
" - level %d number of post-smoother applications %d\n", i+1,
nu_post[i]);
76 printfQuda(
" - level %d number of eigenvectors requested n_conv %d\n", i + 1,
nvec[i]);
87 printfQuda(
" - level %d Chebyshev polynomial maximum will be computed\n", i + 1);
100 int main(
int argc,
char **argv)
107 app->parse(argc, argv);
108 }
catch (
const CLI::ParseError &e) {
140 printfQuda(
"Solve_type %d not supported with MG. Please use QUDA_DIRECT_SOLVE or QUDA_DIRECT_PC_SOLVE\n\n",
163 mg_param.
eig_param[i] = &mg_eig_param[i];
194 void *clover =
nullptr;
195 void *clover_inv =
nullptr;
216 double time0 = -((double)clock());
218 using namespace quda;
230 int R[4] = {0,0,0,0};
232 for(
int dir=0; dir<4; ++dir) y[dir] =
gauge_param.
X[dir] + 2 * R[dir];
240 for(
int dir=0; dir<4; ++dir) gParamEx.r[dir] = R[dir];
248 RNG *randstates =
new RNG(*gauge, 1234);
253 bool coldstart =
false;
254 double beta_value = 6.2;
263 Monte(*gaugeEx, *randstates, beta_value, 100 * nhbsteps, 100 * novrsteps);
276 printfQuda(
"\n======================================================\n");
277 printfQuda(
"Running pure gauge evolution test at constant quark mass\n");
278 printfQuda(
"======================================================\n");
279 printfQuda(
"step=%d plaquette = %g topological charge = %g, mass = %g kappa = %g, mu = %g\n", 0,
301 void *mg_preconditioner =
nullptr;
308 for (
int step = 1; step < nsteps; ++step) {
310 Monte( *gaugeEx, *randstates, beta_value, nhbsteps, novrsteps);
333 printfQuda(
"step=%d plaquette = %g topological charge = %g, mass = %g kappa = %g, mu = %g\n", step,
342 for (
int i=0; i<mg_param.
n_level; i++) {
344 sprintf(mg_param.
vec_outfile[i],
"dump_step_evolve_%d", step);
346 warningQuda(
"Solver failed to converge within max iteration count - dumping null vectors to %s",
350 for (
int i=0; i<mg_param.
n_level; i++) {
362 printfQuda(
"\n====================================================\n");
363 printfQuda(
"Running MG mass scaling test at constant gauge field\n");
364 printfQuda(
"====================================================\n");
387 for (
int step = 1; step < nsteps; ++step) {
421 printfQuda(
"step=%d plaquette = %g topological charge = %g, mass = %g kappa = %g, mu = %g\n", step,
429 for (
int i = 0; i < mg_param.
n_level; i++) {
431 sprintf(mg_param.
vec_outfile[i],
"dump_step_shift_%d", step);
433 warningQuda(
"Solver failed to converge within max iteration count - dumping null vectors to %s",
437 for (
int i = 0; i < mg_param.
n_level; i++) {
457 time0 /= CLOCKS_PER_SEC;
472 if (clover) free(clover);
473 if (clover_inv) free(clover_inv);
476 for (
int dir = 0; dir<4; dir++) free(gauge[dir]);
QudaGaugeFieldOrder Order() const
Class declaration to initialize and hold CURAND RNG states.
int comm_dim_partitioned(int dim)
quda::mgarray< int > mg_eig_poly_deg
quda::mgarray< QudaEigType > mg_eig_type
QudaReconstructType link_recon_sloppy
bool mg_eig_preserve_deflation
std::shared_ptr< QUDAApp > make_app(std::string app_description, std::string app_name)
QudaReconstructType link_recon
quda::mgarray< bool > mg_eig
void add_multigrid_option_group(std::shared_ptr< QUDAApp > quda_app)
quda::mgarray< int > nu_post
quda::mgarray< int > nu_pre
quda::mgarray< int > mg_eig_n_kr
quda::mgarray< double > mg_eig_amin
quda::mgarray< int > nvec
quda::mgarray< QudaEigSpectrumType > mg_eig_spectrum
QudaDslashType dslash_type
quda::mgarray< bool > mg_eig_use_dagger
quda::mgarray< int > mg_eig_n_ev
quda::mgarray< double > mg_eig_amax
quda::mgarray< bool > mg_eig_use_poly_acc
quda::mgarray< double > mg_eig_tol
quda::mgarray< bool > mg_eig_use_normop
quda::mgarray< bool > mg_eig_require_convergence
quda::mgarray< int > mg_eig_block_size
std::array< int, 4 > gridsize_from_cmdline
QudaPrecision prec_sloppy
void * memset(void *s, int c, size_t n)
cpuColorSpinorField * spinorOut
QudaGaugeParam gauge_param
QudaInvertParam inv_param
@ QUDA_TWISTED_CLOVER_DSLASH
@ QUDA_CLOVER_WILSON_DSLASH
@ QUDA_TWISTED_MASS_DSLASH
@ QUDA_DOMAIN_WALL_DSLASH
@ QUDA_DOMAIN_WALL_4D_DSLASH
@ QUDA_CUDA_FIELD_LOCATION
@ QUDA_EIG_BLK_TR_LANCZOS
@ QUDA_GHOST_EXCHANGE_EXTENDED
void constructHostCloverField(void *clover, void *clover_inv, QudaInvertParam &inv_param)
size_t host_gauge_data_type_size
int dimPartitioned(int dim)
void initComms(int argc, char **argv, std::array< int, 4 > &commDims)
size_t host_spinor_data_type_size
void setQudaMgSolveTypes()
void setQudaDefaultMgTestParams()
size_t host_clover_data_type_size
void constructHostGaugeField(void **gauge, QudaGaugeParam &gauge_param, int argc, char **argv)
void setWilsonGaugeParam(QudaGaugeParam &gauge_param)
void setMultigridInvertParam(QudaInvertParam &inv_param)
void setMultigridEigParam(QudaEigParam &eig_param, int level)
void setMultigridParam(QudaMultigridParam &mg_param)
#define device_malloc(size)
void setInvertParam(QudaInvertParam &invertParam, QudaInvertArgs_t &inv_args, int external_precision, int quda_precision, double kappa, double reliable_delta)
const char * get_prec_str(QudaPrecision prec)
const char * get_eig_spectrum_str(QudaEigSpectrumType type)
const char * get_eig_type_str(QudaEigType type)
const char * get_recon_str(QudaReconstructType recon)
void CallUnitarizeLinks(quda::cudaGaugeField *cudaInGauge)
int main(int argc, char **argv)
void setReunitarizationConsts()
void Monte(GaugeField &data, RNG &rngstate, double Beta, int nhb, int nover)
Perform heatbath and overrelaxation. Performs nhb heatbath steps followed by nover overrelaxation ste...
void setUnitarizeLinksConstants(double unitarize_eps, double max_error, bool allow_svd, bool svd_only, double svd_rel_error, double svd_abs_error)
void InitGaugeField(GaugeField &data)
Perform a cold start to the gauge field, identity SU(3) matrix, also fills the ghost links in multi-G...
void PGaugeExchangeFree()
Release all allocated memory used to exchange data between nodes.
void unitarizeLinks(GaugeField &outfield, const GaugeField &infield, int *fails)
void setTransferGPU(bool)
void copyExtendedGauge(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out=0, void *In=0)
Main header file for the QUDA library.
void dumpMultigridQuda(void *mg_instance, QudaMultigridParam *param)
Dump the null-space vectors to disk.
void * newMultigridQuda(QudaMultigridParam *param)
QudaGaugeParam newQudaGaugeParam(void)
void initQuda(int device)
QudaMultigridParam newQudaMultigridParam(void)
QudaGaugeObservableParam newQudaGaugeObservableParam(void)
void loadGaugeQuda(void *h_gauge, QudaGaugeParam *param)
void loadCloverQuda(void *h_clover, void *h_clovinv, QudaInvertParam *inv_param)
void freeCloverQuda(void)
QudaInvertParam newQudaInvertParam(void)
QudaEigParam newQudaEigParam(void)
void gaugeObservablesQuda(QudaGaugeObservableParam *param)
Calculates a variety of gauge-field observables. If a smeared gauge field is presently loaded (in gau...
void updateMultigridQuda(void *mg_instance, QudaMultigridParam *param)
Updates the multigrid preconditioner for the new gauge / clover field.
void destroyMultigridQuda(void *mg_instance)
Free resources allocated by the multigrid solver.
void invertQuda(void *h_x, void *h_b, QudaInvertParam *param)
#define qudaMemcpy(dst, src, count, kind)
#define qudaMemset(ptr, value, count)
#define QUDA_MAX_MG_LEVEL
Maximum number of multi-grid levels. This number may be increased if needed.
QudaBoolean compute_qcharge
QudaBoolean compute_plaquette
QudaReconstructType reconstruct
QudaFieldLocation location
QudaGaugeFieldOrder gauge_order
int setup_maxiter_refresh[QUDA_MAX_MG_LEVEL]
QudaEigParam * eig_param[QUDA_MAX_MG_LEVEL]
QudaBoolean preserve_deflation
char vec_outfile[QUDA_MAX_MG_LEVEL][256]
QudaSolveType smoother_solve_type[QUDA_MAX_MG_LEVEL]
QudaInvertParam * invert_param
QudaReconstructType reconstruct
QudaGaugeFieldOrder order
void setPrecision(QudaPrecision precision, bool force_native=false)
Helper function for setting the precision and corresponding field order for QUDA internal fields.
QudaGhostExchange ghostExchange
QudaPrecision Precision() const