QUDA  v0.7.0
A library for QCD on GPUs
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qio_util.h
Go to the documentation of this file.
1 #ifndef QIO_TEST_H
2 #define QIO_TEST_H
3 
4 #include <qmp.h>
5 #include <qio.h>
6 #define mynode QMP_get_node_number
7 
8 extern QIO_Layout layout;
9 extern int lattice_dim;
10 extern int lattice_size[4];
11 
12 #include <layout_hyper.h>
13 
14 #define NCLR 3
15 
16 typedef struct
17 {
18  float re;
19  float im;
20 } complex;
21 
22 typedef struct { complex e[NCLR][NCLR]; } suN_matrix;
23 
24 /* get and put */
25 void vput_R(char *buf, size_t index, int count, void *qfin);
26 void vget_R(char *buf, size_t index, int count, void *qfin);
27 void vput_M(char *buf, size_t index, int count, void *qfin);
28 void vget_M(char *buf, size_t index, int count, void *qfin);
29 void vput_r(char *buf, size_t index, int count, void *qfin);
30 void vget_r(char *buf, size_t index, int count, void *qfin);
31 
32 // templatized version of vput_M to allow for precision conversion
33 template <typename oFloat, typename iFloat, int len>
34 void vputM(char *s1, size_t index, int count, void *s2)
35 {
36  oFloat **field = (oFloat **)s2;
37  iFloat *src = (iFloat *)s1;
38 
39  //For the site specified by "index", move an array of "count" data
40  //from the read buffer to an array of fields
41 
42  for (int i=0;i<count;i++)
43  {
44  oFloat *dest = field[i] + len*index;
45  for (int j=0; j<len; j++) dest[j] = src[i*len+j];
46  }
47 }
48 
49 // templatized version of vget_M to allow for precision conversion
50 template <typename oFloat, typename iFloat, int len>
51 void vgetM(char *s1, size_t index, int count, void *s2)
52 {
53  iFloat **field = (iFloat **)s2;
54  oFloat *dest = (oFloat *)s1;
55 
56 /* For the site specified by "index", move an array of "count" data
57  from the array of fields to the write buffer */
58  for (int i=0; i<count; i++, dest+=18)
59  {
60  iFloat *src = field[i] + len*index;
61  for (int j=0; j<len; j++) dest[j] = src[j];
62  }
63 }
64 
65 
66 int vcreate_R(float *field_out[],int count);
67 int vcreate_M(suN_matrix *field[] , int count);
68 void vdestroy_R(float *field[], int count);
69 void vdestroy_M(suN_matrix *field[], int count);
70 void vset_R(float *field[],int count);
71 void vset_M(suN_matrix *field[], int count);
72 float vcompare_R(float *fielda[], float *fieldb[], int count);
73 float vcompare_M(suN_matrix *fielda[], suN_matrix *fieldb[], int count);
74 float vcompare_r(float arraya[], float arrayb[], int count);
75 
76 int qio_test(int output_volfmt, int output_serpar, int ildgstyle,
77  int input_volfmt, int input_serpar, int argc, char *argv[]);
78 
79 int qio_host_test(QIO_Filesystem *fs, int argc, char *argv[]);
80 
81 #endif /* QIO_TEST_H */
82 
void vset_M(suN_matrix *field[], int count)
Definition: qio_util.cpp:39
void vput_M(char *buf, size_t index, int count, void *qfin)
Definition: qio_util.cpp:104
void vgetM(char *s1, size_t index, int count, void *s2)
Definition: qio_util.h:51
float vcompare_r(float arraya[], float arrayb[], int count)
int vcreate_R(float *field_out[], int count)
int qio_host_test(QIO_Filesystem *fs, int argc, char *argv[])
float vcompare_R(float *fielda[], float *fieldb[], int count)
int lattice_dim
Definition: gauge_qio.cpp:7
int qio_test(int output_volfmt, int output_serpar, int ildgstyle, int input_volfmt, int input_serpar, int argc, char *argv[])
void vdestroy_R(float *field[], int count)
void vput_r(char *buf, size_t index, int count, void *qfin)
float vcompare_M(suN_matrix *fielda[], suN_matrix *fieldb[], int count)
Definition: qio_util.cpp:81
void vdestroy_M(suN_matrix *field[], int count)
Definition: qio_util.cpp:73
void vget_M(char *buf, size_t index, int count, void *qfin)
Definition: qio_util.cpp:121
__device__ unsigned int count
Definition: reduce_core.h:112
void vget_r(char *buf, size_t index, int count, void *qfin)
void vget_R(char *buf, size_t index, int count, void *qfin)
int lattice_size[4]
Definition: gauge_qio.cpp:8
#define NCLR
Definition: qio_util.h:14
QIO_Layout layout
Definition: gauge_qio.cpp:6
float im
Definition: qio_util.h:19
void vset_R(float *field[], int count)
void vputM(char *s1, size_t index, int count, void *s2)
Definition: qio_util.h:34
void vput_R(char *buf, size_t index, int count, void *qfin)
int vcreate_M(suN_matrix *field[], int count)
Definition: qio_util.cpp:57
float re
Definition: qio_util.h:18