21 #define TDIFF(a,b) (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec))
33 static double unitarize_eps = 1e-6;
34 static bool reunit_allow_svd =
true;
35 static bool reunit_svd_only =
false;
36 static double svd_rel_error = 1e-4;
37 static double svd_abs_error = 1e-4;
38 static double max_allowed_error = 1e-11;
49 static void hisq_test()
57 errorQuda(
"Precision %d is unsupported in some link fattening routines\n",
prec);
71 qudaGaugeParam.
X[0] =
xdim;
72 qudaGaugeParam.
X[1] =
ydim;
73 qudaGaugeParam.
X[2] =
zdim;
74 qudaGaugeParam.
X[3] =
tdim;
112 double act_path_coeff_1[6] = {
116 u4*( 1.0/8.0)*0.25*0.5,
117 u6*(-1.0/8.0)*0.125*(1.0/6.0),
122 double act_path_coeff_2[6] = {
123 (( 1.0/8.0)+(2.0*6.0/16.0)+(1.0/8.0)),
128 (-1.0/8.0)*0.125*(1.0/6.0),
133 double act_path_coeff_3[6] = {
166 for(
int i=0; i<
V; ++i){
167 for(
int dir=0; dir<4; ++dir){
168 char* src = (
char*)sitelink[dir];
187 void* fatlink_eps =
nullptr;
188 void* longlink_eps =
nullptr;
197 computeKSLinkQuda(vlink , longlink, wlink, milc_sitelink, act_path_coeff_2, &qudaGaugeParam);
200 struct timeval t0, t1;
202 gettimeofday(&t0, NULL);
203 for (
int n = 0; n <
niter; n++) {
208 computeKSLinkQuda(vlink,
nullptr, wlink, milc_sitelink, act_path_coeff_1, &qudaGaugeParam);
212 computeKSLinkQuda(fatlink, longlink,
nullptr, wlink, act_path_coeff_3, &qudaGaugeParam);
223 computeKSLinkQuda(fatlink, longlink,
nullptr, wlink, act_path_coeff_2, &qudaGaugeParam);
231 gettimeofday(&t1, NULL);
233 double secs =
TDIFF(t0,t1);
239 void* long_reflink[4];
240 void* fat_reflink[4];
241 for(
int i=0;i < 4;i++) {
246 void* long_reflink_eps[4];
247 void* fat_reflink_eps[4];
249 for(
int i=0;i < 4;i++) {
257 double* act_paths[3] = { act_path_coeff_1, act_path_coeff_2, act_path_coeff_3 };
260 fat_reflink_eps, long_reflink_eps,
261 sitelink, &qudaGaugeParam, act_paths,
eps_naik);
270 void* mylonglink [4];
271 void* myfatlink_eps [4];
272 void* mylonglink_eps [4];
273 for(
int i=0; i < 4; i++) {
288 for(
int i=0; i <
V; i++){
289 for(
int dir=0; dir< 4; dir++){
317 for(
int dir=0; dir<4; dir++){
322 fat_reflink,
"CPU reference results:",
325 printfQuda(
"Fat-link test %s\n\n",(1 == res) ?
"PASSED" :
"FAILED");
331 for(
int dir=0; dir<4; ++dir){
336 long_reflink,
"CPU reference results:",
339 printfQuda(
"Long-link test %s\n\n",(1 == res) ?
"PASSED" :
"FAILED");
343 printfQuda(
"Checking fat eps_naik links...\n");
345 for(
int dir=0; dir<4; dir++){
351 fat_reflink_eps,
"CPU reference results:",
354 printfQuda(
"Fat-link eps_naik test %s\n\n",(1 == res) ?
"PASSED" :
"FAILED");
357 printfQuda(
"Checking long eps_naik links...\n");
359 for(
int dir=0; dir<4; ++dir){
365 long_reflink_eps,
"CPU reference results:",
368 printfQuda(
"Long-link eps_naik test %s\n\n",(1 == res) ?
"PASSED" :
"FAILED");
373 int volume = qudaGaugeParam.
X[0]*qudaGaugeParam.
X[1]*qudaGaugeParam.
X[2]*qudaGaugeParam.
X[3];
380 double perf =
flops*volume/(secs*1024*1024*1024);
381 printfQuda(
"link computation time =%.2f ms, flops= %.2f Gflops\n", (secs*1000)/
niter, perf);
383 for (
int i=0; i < 4; i++) {
393 for(
int i=0; i < 4; i++){
414 if(milc_sitelink)
host_free(milc_sitelink);
425 printfQuda(
"link_precision link_reconstruct space_dimension T_dimension Ordering\n");
443 int main(
int argc,
char **argv)
458 app->parse(argc, argv);
459 }
catch (
const CLI::ParseError &e) {
std::shared_ptr< QUDAApp > make_app(std::string app_description, std::string app_name)
QudaReconstructType link_recon
std::array< int, 4 > gridsize_from_cmdline
void * memset(void *s, int c, size_t n)
@ QUDA_STAGGERED_PHASE_MILC
enum QudaGaugeFieldOrder_s QudaGaugeFieldOrder
void exchange_llfat_cleanup(void)
QudaGaugeFieldOrder gauge_order
int main(int argc, char **argv)
void cpu_axy(QudaPrecision prec, double a, void *x, void *y, int size)
void cpu_xpy(QudaPrecision prec, void *x, void *y, int size)
int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision)
size_t host_gauge_data_type_size
int dimPartitioned(int dim)
void initComms(int argc, char **argv, std::array< int, 4 > &commDims)
int strong_check_link(void **linkA, const char *msgA, void **linkB, const char *msgB, int len, QudaPrecision prec)
void createSiteLinkCPU(void **link, QudaPrecision precision, int phase)
void computeHISQLinksCPU(void **fatlink, void **longlink, void **fatlink_eps, void **longlink_eps, void **sitelink, void *qudaGaugeParamPtr, double **act_path_coeffs, double eps_naik)
#define safe_malloc(size)
#define pinned_malloc(size)
const char * get_prec_str(QudaPrecision prec)
const char * get_gauge_order_str(QudaGaugeFieldOrder order)
const char * get_recon_str(QudaReconstructType recon)
void setUnitarizeLinksConstants(double unitarize_eps, double max_error, bool allow_svd, bool svd_only, double svd_rel_error, double svd_abs_error)
Main header file for the QUDA library.
QudaGaugeParam newQudaGaugeParam(void)
void initQuda(int device)
void computeKSLinkQuda(void *fatlink, void *longlink, void *ulink, void *inlink, double *path_coeff, QudaGaugeParam *param)
QudaReconstructType reconstruct
QudaPrecision cuda_prec_sloppy
QudaReconstructType reconstruct_sloppy
QudaGaugeFieldOrder gauge_order
QudaStaggeredPhase staggered_phase_type
QudaGaugeFieldOrder order
QudaGhostExchange ghostExchange