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