QUDA v0.4.0
A library for QCD on GPUs
quda/include/quda.h
Go to the documentation of this file.
00001 #ifndef _QUDA_H
00002 #define _QUDA_H
00003 
00012 #include <enum_quda.h>
00013 
00014 #define QUDA_VERSION_MAJOR     0
00015 #define QUDA_VERSION_MINOR     4
00016 #define QUDA_VERSION_SUBMINOR  0 
00017 
00022 #define QUDA_VERSION ((QUDA_VERSION_MAJOR<<16) | (QUDA_VERSION_MINOR<<8) | QUDA_VERSION_SUBMINOR)
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00033 #define QUDA_MAX_DIM 6
00034 
00040 #define QUDA_MAX_MULTI_SHIFT 32
00041 
00042 
00047   typedef struct QudaGaugeParam_s {
00048 
00049     int X[4];
00050 
00051     double anisotropy;    
00052     double tadpole_coeff; 
00054     QudaLinkType type;
00055     QudaGaugeFieldOrder gauge_order;
00056 
00057     QudaTboundary t_boundary;
00058 
00059     QudaPrecision cpu_prec;
00060 
00061     QudaPrecision cuda_prec;
00062     QudaReconstructType reconstruct;
00063 
00064     QudaPrecision cuda_prec_sloppy;
00065     QudaReconstructType reconstruct_sloppy;
00066 
00067     QudaPrecision cuda_prec_precondition;
00068     QudaReconstructType reconstruct_precondition;
00069 
00070     QudaGaugeFixed gauge_fix;
00071 
00072     int ga_pad;
00073 
00075     int site_ga_pad;
00076 
00077     int staple_pad;   
00078     int llfat_ga_pad; 
00079     int mom_ga_pad;   
00080     int packed_size;
00081     double gaugeGiB;
00082 
00083     int preserve_gauge; 
00085   } QudaGaugeParam;
00086 
00087 
00088   /*
00089    * Parameters relating to the solver and the choice of Dirac operator.
00090    */
00091   typedef struct QudaInvertParam_s {
00092 
00093     QudaDslashType dslash_type;
00094     QudaInverterType inv_type;
00095 
00096     double mass;  
00097     double kappa; 
00099     double m5;    
00100     int Ls;       
00102     double mu;    
00103     QudaTwistFlavorType twist_flavor;  
00105     double tol;
00106     int maxiter;
00107     double reliable_delta; 
00109     int num_offset; 
00112     double offset[QUDA_MAX_MULTI_SHIFT];
00113 
00115     double tol_offset[QUDA_MAX_MULTI_SHIFT];
00116 
00117     QudaSolutionType solution_type;  
00118     QudaSolveType solve_type;        
00119     QudaMatPCType matpc_type;
00120     QudaDagType dagger;
00121     QudaMassNormalization mass_normalization;
00122 
00123     QudaPreserveSource preserve_source;
00124 
00125     QudaPrecision cpu_prec;
00126     QudaPrecision cuda_prec;
00127     QudaPrecision cuda_prec_sloppy;
00128     QudaPrecision cuda_prec_precondition;
00129 
00130     QudaDiracFieldOrder dirac_order;
00131 
00133     QudaGammaBasis gamma_basis;
00134 
00135     QudaPrecision clover_cpu_prec;
00136     QudaPrecision clover_cuda_prec;
00137     QudaPrecision clover_cuda_prec_sloppy;
00138     QudaPrecision clover_cuda_prec_precondition;
00139 
00140     QudaCloverFieldOrder clover_order;
00141     QudaUseInitGuess use_init_guess;
00142 
00143     QudaVerbosity verbosity;    
00144 
00145     int sp_pad;
00146     int cl_pad;
00147 
00148     int iter;
00149     double spinorGiB;
00150     double cloverGiB;
00151     double gflops;
00152     double secs;
00153 
00155     QudaTune tune;
00156 
00158     QudaPreserveDirac preserve_dirac;
00159 
00161     int gcrNkrylov;
00162 
00163     /*
00164      * The following parameters are related to the domain-decomposed
00165      * preconditioner, if enabled.
00166      */
00167 
00172     QudaInverterType inv_type_precondition;
00173 
00175     QudaVerbosity verbosity_precondition;
00176 
00178     double tol_precondition;
00179 
00181     int maxiter_precondition;
00182 
00184     QudaPrecision prec_precondition;
00185 
00187     double omega;
00188 
00189   } QudaInvertParam;
00190 
00191 
00192   /*
00193    * Interface functions, found in interface_quda.cpp
00194    */
00195 
00204   void initQuda(int device);
00205 
00209   void loadGaugeQuda(void *h_gauge, QudaGaugeParam *param);
00210 
00214   void freeGaugeQuda(void);
00215 
00219   void saveGaugeQuda(void *h_gauge, QudaGaugeParam *param);
00220 
00225   void loadCloverQuda(void *h_clover, void *h_clovinv,
00226                       QudaInvertParam *inv_param);
00227 
00231   void freeCloverQuda(void);
00232 
00238   void invertQuda(void *h_x, void *h_b, QudaInvertParam *param);
00239 
00243   void invertMultiShiftQuda(void **_hp_x, void *_hp_b, QudaInvertParam *param,
00244                             double* offsets, int num_offsets,
00245                             double* residue_sq);
00246 
00251   void invertMultiShiftQudaMixed(void **_hp_x, void *_hp_b,
00252                                  QudaInvertParam *param, double* offsets,
00253                                  int num_offsets, double* residue_sq);
00254     
00256   void dslashQuda(void *h_out, void *h_in, QudaInvertParam *inv_param,
00257                   QudaParity parity);
00258 
00260   void MatQuda(void *h_out, void *h_in, QudaInvertParam *inv_param);
00261 
00263   void MatDagMatQuda(void *h_out, void *h_in, QudaInvertParam *inv_param);
00264 
00266   void endQuda(void);
00267 
00275   QudaGaugeParam newQudaGaugeParam(void);
00276 
00284   QudaInvertParam newQudaInvertParam(void);
00285 
00289   void printQudaGaugeParam(QudaGaugeParam *param);
00290 
00294   void printQudaInvertParam(QudaInvertParam *param);
00295 
00296 
00297   /*
00298    * The following routines are temporary additions used by the HISQ
00299    * link-fattening code.
00300    */
00301 
00302   void  record_gauge(int* X, void *_fatlink, int _fatlink_pad, 
00303                      void* _longlink, int _longlink_pad, 
00304                      QudaReconstructType _longlink_recon,
00305                      QudaReconstructType _longlink_recon_sloppy,
00306                      QudaGaugeParam *_param);
00307   void set_dim(int *);
00308   void pack_ghost(void **cpuLink, void **cpuGhost, int nFace,
00309                   QudaPrecision precision);
00310   void setFatLinkPadding(QudaComputeFatMethod method, QudaGaugeParam* param);
00311   int computeFatLinkQuda(void* fatlink, void** sitelink,
00312                          double* act_path_coeff, QudaGaugeParam* param, 
00313                          QudaComputeFatMethod method);
00314   
00315   /*
00316    * The following routines are only used by the examples in tests/ .
00317    * They should generally not be called in a typical application.
00318    */  
00319   void initCommsQuda(int argc, char **argv, const int *X, const int nDim);
00320   void endCommsQuda();
00321 
00322 #ifdef __cplusplus
00323 }
00324 #endif
00325 
00326 #endif /* _QUDA_H */
00327 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines