QUDA  v0.7.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 
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 #endif // _TEST_UTIL_H
QudaDslashType dslash_type
Definition: test_util.cpp:1560
void construct_clover_field(void *clover, double norm, double diag, QudaPrecision precision)
Definition: test_util.cpp:1103
int V5h
Definition: test_util.cpp:42
void dw_setDims(int *X, const int L5)
Definition: test_util.cpp:125
void createHwCPU(void *hw, QudaPrecision precision)
Definition: test_util.cpp:1429
int strong_check_mom(void *momA, void *momB, int len, QudaPrecision prec)
Definition: test_util.cpp:1502
int Vsh_t
Definition: test_util.cpp:32
enum QudaPrecision_s QudaPrecision
int mySpinorSiteSize
Definition: test_util.cpp:44
__host__ __device__ ValueType norm(const complex< ValueType > &z)
Returns the magnitude of z squared.
Definition: complex_quda.h:859
int E3
int E2
void createSiteLinkCPU(void **link, QudaPrecision precision, int phase)
Definition: test_util.cpp:1166
void strong_check(void *spinor, void *spinorGPU, int len, QudaPrecision precision)
void setDims(int *X)
Definition: test_util.cpp:88
void mat(void *out, void **fatlink, void **longlink, void *in, double kappa, int dagger_bit, QudaPrecision sPrecision, QudaPrecision gPrecision)
void printGaugeElement(void *gauge, int X, QudaPrecision precision)
Definition: test_util.cpp:170
int Ls
Definition: test_util.cpp:40
void construct_fat_long_gauge_field(void **fatlink, void **longlink, int type, QudaPrecision precision, QudaGaugeParam *, QudaDslashType dslash_type)
Definition: test_util.cpp:1018
int strong_check_link(void **linkA, const char *msgA, void **linkB, const char *msgB, int len, QudaPrecision prec)
Definition: test_util.cpp:1365
cpuColorSpinorField * spinor
Definition: dslash_test.cpp:40
int V_ex
Definition: test_util.cpp:38
void printSpinorElement(void *spinor, int X, QudaPrecision precision)
Definition: test_util.cpp:162
void finalizeComms()
Definition: test_util.cpp:65
int Z[4]
Definition: test_util.cpp:28
int Vsh_z
Definition: test_util.cpp:32
int E[4]
void * longlink[4]
int E4
QudaGaugeParam param
Definition: pack_test.cpp:17
int E1h
int V
Definition: test_util.cpp:29
int Vh_ex
int neighborIndex(int i, int oddBit, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:450
int Vs_z
Definition: test_util.cpp:31
int Vsh_y
Definition: test_util.cpp:32
void check_gauge(void **, void **, double epsilon, QudaPrecision precision)
Definition: test_util.cpp:1156
void initComms(int argc, char **argv, const int *commDims)
Definition: test_util.cpp:48
void su3_reconstruct(void *mat, int dir, int ga_idx, QudaReconstructType reconstruct, QudaPrecision precision, QudaGaugeParam *param)
Definition: test_util.cpp:351
int fullLatticeIndex_5d(int i, int oddBit)
Definition: test_util.cpp:650
int getOddBit(int X)
Definition: test_util.cpp:186
int x4_from_full_index(int i)
Definition: test_util.cpp:661
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:1003
int V5
Definition: test_util.cpp:41
void compare_spinor(void *spinor_cpu, void *spinor_gpu, int len, QudaPrecision precision)
int Vs_y
Definition: test_util.cpp:31
int fullLatticeIndex_4d(int i, int oddBit)
Definition: test_util.cpp:616
void stopwatchStart()
Definition: test_util.cpp:2055
int dx[4]
int neighborIndexFullLattice_mg(int i, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:569
int neighborIndexFullLattice(int i, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:521
int fullLatticeIndex_5d_4dpc(int i, int oddBit)
Definition: test_util.cpp:655
double stopwatchReadSeconds()
Definition: test_util.cpp:2059
int neighborIndex_mg(int i, int oddBit, int dx4, int dx3, int dx2, int dx1)
Definition: test_util.cpp:485
enum QudaReconstructType_s QudaReconstructType
Main header file for the QUDA library.
int Vs_x
Definition: test_util.cpp:31
void createMomCPU(void *mom, QudaPrecision precision)
Definition: test_util.cpp:1391
int fullLatticeIndex(int i, int oddBit)
Definition: test_util.cpp:413
int process_command_line_option(int argc, char **argv, int *idx)
Definition: test_util.cpp:1635
enum QudaDslashType_s QudaDslashType
int Vsh_x
Definition: test_util.cpp:32
int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision)
Definition: test_util.cpp:395
void initRand()
Definition: test_util.cpp:75
QudaPrecision prec
Definition: test_util.cpp:1551
int E1
int Vs_t
Definition: test_util.cpp:31
void su3_construct(void *mat, QudaReconstructType reconstruct, QudaPrecision precision)
Definition: test_util.cpp:261
void * gauge[4]
Definition: su3_test.cpp:15
int Vh
int oddBit
void setSpinorSiteSize(int n)
Definition: test_util.cpp:150
int dimPartitioned(int dim)
Definition: test_util.cpp:1577
void * fatlink[4]