QUDA  0.9.0
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 
44  int neighborIndex(int dim[], int index, int oddBit, int dx[]);
45  int neighborIndexFullLattice(int dim[], int index, int dx[]);
46 
47  int neighborIndex_mg(int i, int oddBit, int dx4, int dx3, int dx2, int dx1);
48  int neighborIndexFullLattice_mg(int i, int dx4, int dx3, int dx2, int dx1);
49 
50  void printSpinorElement(void *spinor, int X, QudaPrecision precision);
51  void printGaugeElement(void *gauge, int X, QudaPrecision precision);
52 
53  int fullLatticeIndex(int i, int oddBit);
54  int fullLatticeIndex(int dim[], int index, int oddBit);
55  int getOddBit(int X);
56 
57  void construct_gauge_field(void **gauge, int type, QudaPrecision precision, QudaGaugeParam *param);
58  void construct_fat_long_gauge_field(void **fatlink, void** longlink, int type,
59  QudaPrecision precision, QudaGaugeParam*,
61  void construct_clover_field(void *clover, double norm, double diag, QudaPrecision precision);
62  void construct_spinor_field(void *spinor, int type, int i0, int s0, int c0, QudaPrecision precision);
63  void createSiteLinkCPU(void** link, QudaPrecision precision, int phase) ;
64 
65  void su3_construct(void *mat, QudaReconstructType reconstruct, QudaPrecision precision);
66  void su3_reconstruct(void *mat, int dir, int ga_idx, QudaReconstructType reconstruct, QudaPrecision precision, QudaGaugeParam *param);
67  //void su3_construct_8_half(float *mat, short *mat_half);
68  //void su3_reconstruct_8_half(float *mat, short *mat_half, int dir, int ga_idx, QudaGaugeParam *param);
69 
70  void compare_spinor(void *spinor_cpu, void *spinor_gpu, int len, QudaPrecision precision);
71  void strong_check(void *spinor, void *spinorGPU, int len, QudaPrecision precision);
72  int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision);
73 
74  void check_gauge(void **, void **, double epsilon, QudaPrecision precision);
75 
76  int strong_check_link(void ** linkA, const char* msgA, void **linkB, const char* msgB, int len, QudaPrecision prec);
77  int strong_check_mom(void * momA, void *momB, int len, QudaPrecision prec);
78 
79  void createMomCPU(void* mom, QudaPrecision precision);
80  void createHwCPU(void* hw, QudaPrecision precision);
81 
82  //used by link fattening code
83  int x4_from_full_index(int i);
84  // ---------- gauge_read.cpp ----------
85 
86  //void readGaugeField(char *filename, float *gauge[], int argc, char *argv[]);
87 
88  // additions for dw (quickly hacked on)
89  int fullLatticeIndex_4d(int i, int oddBit);
90  int fullLatticeIndex_5d(int i, int oddBit);
91  int fullLatticeIndex_5d_4dpc(int i, int oddBit);
92  int process_command_line_option(int argc, char** argv, int* idx);
93 
94  // use for some profiling
95  void stopwatchStart();
96  double stopwatchReadSeconds();
97 
98 #ifdef __cplusplus
99 //}
100 #endif
101 
102 #ifdef __cplusplus
103  extern "C" {
104 #endif
105 
106  // implemented in face_gauge.cpp
107  void exchange_cpu_sitelink(int* X,void** sitelink, void** ghost_sitelink,
108  void** ghost_sitelink_diag,
109  QudaPrecision gPrecision, QudaGaugeParam* param, int optflag);
110  void exchange_cpu_sitelink_ex(int* X, int *R, void** sitelink, QudaGaugeFieldOrder cpu_order,
111  QudaPrecision gPrecision, int optflag, int geometry);
112  void exchange_cpu_staple(int* X, void* staple, void** ghost_staple,
113  QudaPrecision gPrecision);
115  void exchange_llfat_cleanup(void);
116 
117 #ifdef __cplusplus
118  }
119 #endif
120 
121 #endif // _TEST_UTIL_H
QudaDslashType dslash_type
Definition: test_util.cpp:1626
void construct_clover_field(void *clover, double norm, double diag, QudaPrecision precision)
Definition: test_util.cpp:1166
int V5h
Definition: test_util.cpp:41
void exchange_cpu_sitelink_ex(int *X, int *R, void **sitelink, QudaGaugeFieldOrder cpu_order, QudaPrecision gPrecision, int optflag, int geometry)
void dw_setDims(int *X, const int L5)
Definition: test_util.cpp:167
void createHwCPU(void *hw, QudaPrecision precision)
Definition: test_util.cpp:1492
int strong_check_mom(void *momA, void *momB, int len, QudaPrecision prec)
Definition: test_util.cpp:1565
int Vsh_t
Definition: test_util.cpp:31
enum QudaPrecision_s QudaPrecision
int mySpinorSiteSize
Definition: test_util.cpp:43
__host__ __device__ ValueType norm(const complex< ValueType > &z)
Returns the magnitude of z squared.
Definition: complex_quda.h:896
void exchange_cpu_sitelink(int *X, void **sitelink, void **ghost_sitelink, void **ghost_sitelink_diag, QudaPrecision gPrecision, QudaGaugeParam *param, int optflag)
int E3
Definition: test_util.cpp:35
int E2
Definition: test_util.cpp:35
static __inline__ dim3 dim3 void size_t cudaStream_t int dim
void createSiteLinkCPU(void **link, QudaPrecision precision, int phase)
Definition: test_util.cpp:1229
void strong_check(void *spinor, void *spinorGPU, int len, QudaPrecision precision)
void setDims(int *X)
Definition: test_util.cpp:130
void printGaugeElement(void *gauge, int X, QudaPrecision precision)
Definition: test_util.cpp:212
int Ls
Definition: test_util.cpp:39
static int R[4]
void construct_fat_long_gauge_field(void **fatlink, void **longlink, int type, QudaPrecision precision, QudaGaugeParam *, QudaDslashType dslash_type)
Definition: test_util.cpp:1069
int strong_check_link(void **linkA, const char *msgA, void **linkB, const char *msgB, int len, QudaPrecision prec)
Definition: test_util.cpp:1428
int V_ex
Definition: test_util.cpp:37
void printSpinorElement(void *spinor, int X, QudaPrecision precision)
Definition: test_util.cpp:204
void finalizeComms()
Definition: test_util.cpp:107
int Z[4]
Definition: test_util.cpp:27
int Vsh_z
Definition: test_util.cpp:31
int E[4]
Definition: test_util.cpp:36
int E4
Definition: test_util.cpp:35
char * index(const char *, int)
QudaGaugeParam param
Definition: pack_test.cpp:17
#define b
int E1h
Definition: test_util.cpp:35
int V
Definition: test_util.cpp:28
int Vh_ex
Definition: test_util.cpp:37
void * longlink[4]
int neighborIndex(int i, int oddBit, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:492
static void * hw
int Vs_z
Definition: test_util.cpp:30
void exchange_cpu_staple(int *X, void *staple, void **ghost_staple, QudaPrecision gPrecision)
int Vsh_y
Definition: test_util.cpp:31
void check_gauge(void **, void **, double epsilon, QudaPrecision precision)
Definition: test_util.cpp:1219
void initComms(int argc, char **argv, const int *commDims)
Definition: test_util.cpp:72
enum QudaGaugeFieldOrder_s QudaGaugeFieldOrder
void su3_reconstruct(void *mat, int dir, int ga_idx, QudaReconstructType reconstruct, QudaPrecision precision, QudaGaugeParam *param)
Definition: test_util.cpp:393
int fullLatticeIndex_5d(int i, int oddBit)
Definition: test_util.cpp:692
void exchange_llfat_init(QudaPrecision prec)
int getOddBit(int X)
Definition: test_util.cpp:228
int x4_from_full_index(int i)
Definition: test_util.cpp:703
void exchange_llfat_cleanup(void)
void construct_spinor_field(void *spinor, int type, int i0, int s0, int c0, QudaPrecision precision)
void construct_gauge_field(void **gauge, int type, QudaPrecision precision, QudaGaugeParam *param)
Definition: test_util.cpp:1054
int V5
Definition: test_util.cpp:40
void compare_spinor(void *spinor_cpu, void *spinor_gpu, int len, QudaPrecision precision)
int Vs_y
Definition: test_util.cpp:30
int fullLatticeIndex_4d(int i, int oddBit)
Definition: test_util.cpp:658
void stopwatchStart()
Definition: test_util.cpp:2869
int neighborIndexFullLattice_mg(int i, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:611
int neighborIndexFullLattice(int i, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:563
int fullLatticeIndex_5d_4dpc(int i, int oddBit)
Definition: test_util.cpp:697
double stopwatchReadSeconds()
Definition: test_util.cpp:2873
void * fatlink[4]
int neighborIndex_mg(int i, int oddBit, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:527
enum QudaReconstructType_s QudaReconstructType
Main header file for the QUDA library.
int Vs_x
Definition: test_util.cpp:30
void createMomCPU(void *mom, QudaPrecision precision)
Definition: test_util.cpp:1454
int fullLatticeIndex(int i, int oddBit)
Definition: test_util.cpp:455
int process_command_line_option(int argc, char **argv, int *idx)
Definition: test_util.cpp:1795
enum QudaDslashType_s QudaDslashType
int Vsh_x
Definition: test_util.cpp:31
int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision)
Definition: test_util.cpp:437
void initRand()
Definition: test_util.cpp:117
void mat(void *out, void **link, void *in, int dagger_bit, int mu, QudaPrecision sPrecision, QudaPrecision gPrecision)
int faceVolume[4]
Definition: test_util.cpp:32
int E1
Definition: test_util.cpp:35
QudaPrecision prec
Definition: test_util.cpp:1615
int Vs_t
Definition: test_util.cpp:30
#define a
void su3_construct(void *mat, QudaReconstructType reconstruct, QudaPrecision precision)
Definition: test_util.cpp:303
int Vh
Definition: test_util.cpp:29
cpuColorSpinorField * spinor
Definition: covdev_test.cpp:41
void setSpinorSiteSize(int n)
Definition: test_util.cpp:192
int dimPartitioned(int dim)
Definition: test_util.cpp:1686