17 #define MAX(a, b) ((a) > (b) ? (a) : (b))
22 printfQuda(
"prec prec_sloppy multishift matpc_type recon recon_sloppy solve_type S_dimension T_dimension "
23 "Ls_dimension dslash_type normalization\n");
25 "%6s %6s %d %12s %2s %2s %10s %3d/%3d/%3d %3d %2d %14s %8s\n",
34 printfQuda(
" - level %d number of null-space vectors %d\n", i + 1,
nvec[i]);
35 printfQuda(
" - level %d number of pre-smoother applications %d\n", i + 1,
nu_pre[i]);
36 printfQuda(
" - level %d number of post-smoother applications %d\n", i + 1,
nu_post[i]);
46 printfQuda(
" - level %d number of eigenvectors requested n_conv %d\n", i + 1,
nvec[i]);
51 printfQuda(
" - level %d Operator: daggered (%s) , norm-op (%s)\n", i + 1,
57 printfQuda(
" - level %d Chebyshev polynomial maximum will be computed\n", i + 1);
77 printfQuda(
" - Operator: MdagM. Will compute SVD of M\n");
78 printfQuda(
" - ***********************************************************\n");
79 printfQuda(
" - **** Overriding any previous choices of operator type. ****\n");
80 printfQuda(
" - **** SVD demands normal operator, will use MdagM ****\n");
81 printfQuda(
" - ***********************************************************\n");
90 printfQuda(
" - Chebyshev polynomial maximum will be computed\n");
101 int main(
int argc,
char **argv)
112 app->parse(argc, argv);
113 }
catch (
const CLI::ParseError &e) {
118 printfQuda(
"Error: Cannot use both deflation and multigrid preconditioners on top level solve.\n");
153 printfQuda(
"Solve_type %d not supported with MG. Please use QUDA_DIRECT_SOLVE or QUDA_DIRECT_PC_SOLVE\n\n",
178 mg_param.
eig_param[i] = &mg_eig_param[i];
209 bool use_split_grid = num_sub_partition > 1;
230 void *clover =
nullptr;
231 void *clover_inv =
nullptr;
252 void *mg_preconditioner =
nullptr;
254 if (use_split_grid) {
errorQuda(
"Split grid does not work with MG yet."); }
262 printfQuda(
"Computed plaquette is %e (spatial = %e, temporal = %e)\n", plaq[0], plaq[1], plaq[2]);
266 std::vector<quda::ColorSpinorField *> in(
Nsrc);
267 std::vector<quda::ColorSpinorField *> out(
Nsrc);
268 std::vector<quda::ColorSpinorField *> out_multishift(
multishift *
Nsrc);
273 std::vector<std::vector<void *>> _hp_multi_x(
Nsrc, std::vector<void *>(
multishift));
285 if (use_split_grid) {
errorQuda(
"Split grid does not work with multishift yet."); }
289 masses[i] = 0.06 + i * i * 0.01;
296 for (
int n = 0; n <
Nsrc; n++) {
298 _hp_multi_x[n][i] = out_multishift[n *
multishift + i]->V();
303 std::vector<double> time(
Nsrc);
304 std::vector<double> gflops(
Nsrc);
305 std::vector<int> iter(
Nsrc);
310 std::vector<quda::ColorSpinorField *> _h_b(
Nsrc,
nullptr);
311 std::vector<quda::ColorSpinorField *> _h_x(
Nsrc,
nullptr);
313 for (
int i = 0; i <
Nsrc; i++) {
320 if (!use_split_grid) {
322 for (
int i = 0; i <
Nsrc; i++) {
342 std::vector<void *> _hp_x(
Nsrc);
343 std::vector<void *> _hp_b(
Nsrc);
344 for (
int i = 0; i <
Nsrc; i++) {
345 _hp_x[i] = out[i]->V();
346 _hp_b[i] = in[i]->V();
378 for (
int i = 0; i <
Nsrc; i++) {
387 for (
auto p : out_multishift) {
delete p; }
390 for (
auto p : in) {
delete p; }
391 for (
auto p : out) {
delete p; }
394 for (
int dir = 0; dir < 4; dir++) free(gauge[dir]);
398 if (clover) free(clover);
399 if (clover_inv) free(clover_inv);
static ColorSpinorField * Create(const ColorSpinorParam ¶m)
Class declaration to initialize and hold CURAND RNG states.
void comm_allreduce_int(int *data)
void comm_allreduce_max(double *data)
void comm_allreduce(double *data)
quda::mgarray< int > mg_eig_poly_deg
quda::mgarray< QudaEigType > mg_eig_type
QudaReconstructType link_recon_sloppy
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)
std::array< int, 4 > grid_partition
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
void add_eofa_option_group(std::shared_ptr< QUDAApp > quda_app)
quda::mgarray< QudaEigSpectrumType > mg_eig_spectrum
QudaSolutionType solution_type
QudaDslashType dslash_type
quda::mgarray< bool > mg_eig_use_dagger
quda::mgarray< int > mg_eig_n_ev
quda::mgarray< double > mg_eig_amax
void add_eigen_option_group(std::shared_ptr< QUDAApp > quda_app)
QudaEigSpectrumType eig_spectrum
quda::mgarray< bool > mg_eig_use_poly_acc
quda::mgarray< double > mg_eig_tol
void add_deflation_option_group(std::shared_ptr< QUDAApp > quda_app)
quda::mgarray< bool > mg_eig_use_normop
bool eig_require_convergence
quda::mgarray< bool > mg_eig_require_convergence
quda::mgarray< int > mg_eig_block_size
void add_comms_option_group(std::shared_ptr< QUDAApp > quda_app)
std::array< int, 4 > gridsize_from_cmdline
QudaMassNormalization normalization
QudaPrecision prec_sloppy
QudaGaugeParam gauge_param
QudaInvertParam inv_param
void verifyInversion(void *spinorOut, void *spinorIn, void *spinorCheck, QudaGaugeParam &gauge_param, QudaInvertParam &inv_param, void **gauge, void *clover, void *clover_inv)
@ QUDA_TWISTED_CLOVER_DSLASH
@ QUDA_CLOVER_WILSON_DSLASH
@ QUDA_TWISTED_MASS_DSLASH
@ QUDA_DOMAIN_WALL_DSLASH
@ QUDA_MOBIUS_DWF_EOFA_DSLASH
@ QUDA_CLOVER_HASENBUSCH_TWIST_DSLASH
@ QUDA_DOMAIN_WALL_4D_DSLASH
@ QUDA_EIG_BLK_TR_LANCZOS
@ QUDA_MATPCDAG_MATPC_SOLUTION
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 performanceStats(std::vector< double > &time, std::vector< double > &gflops, std::vector< int > &iter)
void setQudaDefaultMgTestParams()
size_t host_clover_data_type_size
void dw_setDims(int *X, const int L5)
void constructHostGaugeField(void **gauge, QudaGaugeParam &gauge_param, int argc, char **argv)
void constructWilsonTestSpinorParam(quda::ColorSpinorParam *cs_param, const QudaInvertParam *inv_param, const QudaGaugeParam *gauge_param)
void setWilsonGaugeParam(QudaGaugeParam &gauge_param)
void setMultigridInvertParam(QudaInvertParam &inv_param)
void setEigParam(QudaEigParam &eig_param)
void setMultigridEigParam(QudaEigParam &eig_param, int level)
void setMultigridParam(QudaMultigridParam &mg_param)
int main(int argc, char **argv)
void setInvertParam(QudaInvertParam &invertParam, QudaInvertArgs_t &inv_args, int external_precision, int quda_precision, double kappa, double reliable_delta)
const char * get_matpc_str(QudaMatPCType type)
const char * get_prec_str(QudaPrecision prec)
const char * get_solve_str(QudaSolveType type)
const char * get_eig_spectrum_str(QudaEigSpectrumType type)
const char * get_dslash_str(QudaDslashType type)
const char * get_eig_type_str(QudaEigType type)
const char * get_mass_normalization_str(QudaMassNormalization type)
const char * get_recon_str(QudaReconstructType recon)
Main header file for the QUDA library.
void invertMultiSrcQuda(void **_hp_x, void **_hp_b, QudaInvertParam *param, void *h_gauge, QudaGaugeParam *gauge_param)
Perform the solve like @invertQuda but for multiple rhs by spliting the comm grid into sub-partitions...
void * newMultigridQuda(QudaMultigridParam *param)
void plaqQuda(double plaq[3])
QudaGaugeParam newQudaGaugeParam(void)
void invertMultiSrcCloverQuda(void **_hp_x, void **_hp_b, QudaInvertParam *param, void *h_gauge, QudaGaugeParam *gauge_param, void *h_clover, void *h_clovinv)
Really the same with @invertMultiSrcQuda but for clover-style fermions, by accepting pointers to dire...
void invertMultiShiftQuda(void **_hp_x, void *_hp_b, QudaInvertParam *param)
void initQuda(int device)
QudaMultigridParam newQudaMultigridParam(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 destroyMultigridQuda(void *mg_instance)
Free resources allocated by the multigrid solver.
void invertQuda(void *h_x, void *h_b, QudaInvertParam *param)
QudaBoolean preserve_deflation
double tol_hq_offset[QUDA_MAX_MULTI_SHIFT]
int split_grid[QUDA_MAX_DIM]
int num_src_per_sub_partition
double offset[QUDA_MAX_MULTI_SHIFT]
double tol_offset[QUDA_MAX_MULTI_SHIFT]
QudaEigParam * eig_param[QUDA_MAX_MG_LEVEL]
QudaSolveType smoother_solve_type[QUDA_MAX_MG_LEVEL]
QudaInvertParam * invert_param