QUDA  v0.5.0
A library for QCD on GPUs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_util.h
Go to the documentation of this file.
1 #ifndef _TEST_UTIL_H
2 #define _TEST_UTIL_H
3 
4 #include <quda.h>
5 
6 #define gaugeSiteSize 18 // real numbers per link
7 #define spinorSiteSize 24 // real numbers per spinor
8 #define cloverSiteSize 72 // real numbers per block-diagonal clover matrix
9 #define momSiteSize 10 // real numbers per momentum
10 #define hwSiteSize 12 // real numbers per half wilson
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16  extern int Z[4];
17  extern int V;
18  extern int Vh;
19  extern int Vs_x, Vs_y, Vs_z, Vs_t;
20  extern int Vsh_x, Vsh_y, Vsh_z, Vsh_t;
21  extern int faceVolume[4];
22  extern int E1, E1h, E2, E3, E4;
23  extern int E[4];
24  extern int V_ex, Vh_ex;
25 
26  extern int Ls;
27  extern int V5;
28  extern int V5h;
29 
30  extern int mySpinorSiteSize;
31 
32  void initComms(int argc, char **argv, const int *commDims);
33  void finalizeComms();
34  void initRand();
35 
36  void setDims(int *X);
37  void dw_setDims(int *X, const int L5);
38  void setSpinorSiteSize(int n);
39  int dimPartitioned(int dim);
40 
41  int neighborIndex(int i, int oddBit, int dx4, int dx3, int dx2, int dx1);
42  int neighborIndexFullLattice(int i, int dx4, int dx3, int dx2, int dx1) ;
43  int neighborIndex_mg(int i, int oddBit, int dx4, int dx3, int dx2, int dx1);
44  int neighborIndexFullLattice_mg(int i, int dx4, int dx3, int dx2, int dx1);
45 
46  void printSpinorElement(void *spinor, int X, QudaPrecision precision);
47  void printGaugeElement(void *gauge, int X, QudaPrecision precision);
48 
49  int fullLatticeIndex(int i, int oddBit);
50  int getOddBit(int X);
51 
52  void construct_gauge_field(void **gauge, int type, QudaPrecision precision, QudaGaugeParam *param);
53  void construct_fat_long_gauge_field(void **fatlink, void** longlink, int type, QudaPrecision precision, QudaGaugeParam*);
54  void construct_clover_field(void *clover, double norm, double diag, QudaPrecision precision);
55  void construct_spinor_field(void *spinor, int type, int i0, int s0, int c0, QudaPrecision precision);
56  void createSiteLinkCPU(void** link, QudaPrecision precision, int phase) ;
57 
58  void su3_construct(void *mat, QudaReconstructType reconstruct, QudaPrecision precision);
59  void su3_reconstruct(void *mat, int dir, int ga_idx, QudaReconstructType reconstruct, QudaPrecision precision, QudaGaugeParam *param);
60  //void su3_construct_8_half(float *mat, short *mat_half);
61  //void su3_reconstruct_8_half(float *mat, short *mat_half, int dir, int ga_idx, QudaGaugeParam *param);
62 
63  void compare_spinor(void *spinor_cpu, void *spinor_gpu, int len, QudaPrecision precision);
64  void strong_check(void *spinor, void *spinorGPU, int len, QudaPrecision precision);
65  int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision);
66 
67  void check_gauge(void **, void **, double epsilon, QudaPrecision precision);
68 
69  int strong_check_link(void ** linkA, const char* msgA, void **linkB, const char* msgB, int len, QudaPrecision prec);
70  int strong_check_mom(void * momA, void *momB, int len, QudaPrecision prec);
71 
72  void createMomCPU(void* mom, QudaPrecision precision);
73  void createHwCPU(void* hw, QudaPrecision precision);
74 
75  //used by link fattening code
76  int x4_from_full_index(int i);
77  // ---------- gauge_read.cpp ----------
78 
79  //void readGaugeField(char *filename, float *gauge[], int argc, char *argv[]);
80 
81  // additions for dw (quickly hacked on)
82  int fullLatticeIndex_4d(int i, int oddBit);
83  int fullLatticeIndex_5d(int i, int oddBit);
84  int process_command_line_option(int argc, char** argv, int* idx);
85 
86  // use for some profiling
87  void stopwatchStart();
88  double stopwatchReadSeconds();
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif // _TEST_UTIL_H