QUDA  v1.1.0
A library for QCD on GPUs
copy_color_spinor.cpp
Go to the documentation of this file.
1 #include <color_spinor_field.h>
2 
3 namespace quda {
4 
5  void copyGenericColorSpinorDD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
6  void copyGenericColorSpinorDS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
7  void copyGenericColorSpinorDH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
8  void copyGenericColorSpinorDQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
9 
10  void copyGenericColorSpinorSD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
11  void copyGenericColorSpinorSS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
12  void copyGenericColorSpinorSH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
13  void copyGenericColorSpinorSQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
14 
15  void copyGenericColorSpinorHD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
16  void copyGenericColorSpinorHS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
17  void copyGenericColorSpinorHH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
18  void copyGenericColorSpinorHQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
19 
20  void copyGenericColorSpinorQD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
21  void copyGenericColorSpinorQS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
22  void copyGenericColorSpinorQH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
23  void copyGenericColorSpinorQQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
24 
25  // multigrid copying routines
26  void copyGenericColorSpinorMGDD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
27  void copyGenericColorSpinorMGDS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
28  void copyGenericColorSpinorMGSD(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
29  void copyGenericColorSpinorMGSS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
30  void copyGenericColorSpinorMGSH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
31  void copyGenericColorSpinorMGSQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
32  void copyGenericColorSpinorMGHS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
33  void copyGenericColorSpinorMGHH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
34  void copyGenericColorSpinorMGHQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
35  void copyGenericColorSpinorMGQS(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
36  void copyGenericColorSpinorMGQH(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
37  void copyGenericColorSpinorMGQQ(ColorSpinorField &, const ColorSpinorField&, QudaFieldLocation, void*, void*, void*a=0, void *b=0);
38 
39  void copyGenericColorSpinor(ColorSpinorField &dst, const ColorSpinorField &src, QudaFieldLocation location, void *Dst,
40  void *Src, void *dstNorm, void *srcNorm)
41  {
42 
43  if (dst.SiteSubset() != src.SiteSubset())
44  errorQuda("Destination %d and source %d site subsets not equal", dst.SiteSubset(), src.SiteSubset());
45 
46  if (dst.Ncolor() != src.Ncolor())
47  errorQuda("Destination %d and source %d colors not equal", dst.Ncolor(), src.Ncolor());
48 
49  if (dst.Ncolor() == 3) {
50  if (dst.Precision() == QUDA_DOUBLE_PRECISION) {
51  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
52  copyGenericColorSpinorDD(dst, src, location, (double*)Dst, (double*)Src);
53  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
54  copyGenericColorSpinorDS(dst, src, location, (double*)Dst, (float*)Src);
55  } else if (src.Precision() == QUDA_HALF_PRECISION) {
56  copyGenericColorSpinorDH(dst, src, location, (double*)Dst, (short*)Src, 0, (float*)srcNorm);
57  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
58  copyGenericColorSpinorDQ(dst, src, location, (double *)Dst, (int8_t *)Src, 0, (float *)srcNorm);
59  } else {
60  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
61  }
62  } else if (dst.Precision() == QUDA_SINGLE_PRECISION) {
63  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
64  copyGenericColorSpinorSD(dst, src, location, (float*)Dst, (double*)Src);
65  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
66  copyGenericColorSpinorSS(dst, src, location, (float*)Dst, (float*)Src);
67  } else if (src.Precision() == QUDA_HALF_PRECISION) {
68  copyGenericColorSpinorSH(dst, src, location, (float*)Dst, (short*)Src, 0, (float*)srcNorm);
69  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
70  copyGenericColorSpinorSQ(dst, src, location, (float *)Dst, (int8_t *)Src, 0, (float *)srcNorm);
71  } else {
72  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
73  }
74  } else if (dst.Precision() == QUDA_HALF_PRECISION) {
75  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
76  copyGenericColorSpinorHD(dst, src, location, (short*)Dst, (double*)Src, (float*)dstNorm, 0);
77  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
78  copyGenericColorSpinorHS(dst, src, location, (short*)Dst, (float*)Src, (float*)dstNorm, 0);
79  } else if (src.Precision() == QUDA_HALF_PRECISION) {
80  copyGenericColorSpinorHH(dst, src, location, (short*)Dst, (short*)Src, (float*)dstNorm, (float*)srcNorm);
81  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
82  copyGenericColorSpinorHQ(dst, src, location, (short *)Dst, (int8_t *)Src, (float *)dstNorm, (float *)srcNorm);
83  } else {
84  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
85  }
86  } else if (dst.Precision() == QUDA_QUARTER_PRECISION) {
87  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
88  copyGenericColorSpinorQD(dst, src, location, (int8_t *)Dst, (double *)Src, (float *)dstNorm, 0);
89  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
90  copyGenericColorSpinorQS(dst, src, location, (int8_t *)Dst, (float *)Src, (float *)dstNorm, 0);
91  } else if (src.Precision() == QUDA_HALF_PRECISION) {
92  copyGenericColorSpinorQH(dst, src, location, (int8_t *)Dst, (short *)Src, (float *)dstNorm, (float *)srcNorm);
93  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
94  copyGenericColorSpinorQQ(dst, src, location, (int8_t *)Dst, (int8_t *)Src, (float *)dstNorm, (float *)srcNorm);
95  } else {
96  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
97  }
98  } else {
99  errorQuda("Unsupported Destination Precision %d", dst.Precision());
100  }
101  } else {
102  if (dst.Precision() == QUDA_DOUBLE_PRECISION) {
103  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
104  copyGenericColorSpinorMGDD(dst, src, location, Dst, Src);
105  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
106  copyGenericColorSpinorMGDS(dst, src, location, (double*)Dst, (float*)Src);
107  } else {
108  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
109  }
110  } else if (dst.Precision() == QUDA_SINGLE_PRECISION) {
111  if (src.Precision() == QUDA_DOUBLE_PRECISION) {
112  copyGenericColorSpinorMGSD(dst, src, location, (float*)Dst, (double*)Src);
113  } else if (src.Precision() == QUDA_SINGLE_PRECISION) {
114  copyGenericColorSpinorMGSS(dst, src, location, (float*)Dst, (float*)Src);
115  } else if (src.Precision() == QUDA_HALF_PRECISION) {
116  copyGenericColorSpinorMGSH(dst, src, location, (float*)Dst, (short*)Src);
117  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
118  copyGenericColorSpinorMGSQ(dst, src, location, (float *)Dst, (int8_t *)Src);
119  } else {
120  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
121  }
122  } else if (dst.Precision() == QUDA_HALF_PRECISION) {
123  if (src.Precision() == QUDA_SINGLE_PRECISION) {
124  copyGenericColorSpinorMGHS(dst, src, location, (short*)Dst, (float*)Src);
125  } else if (src.Precision() == QUDA_HALF_PRECISION) {
126  copyGenericColorSpinorMGHH(dst, src, location, (short*)Dst, (short*)Src);
127  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
128  copyGenericColorSpinorMGHQ(dst, src, location, (short *)Dst, (int8_t *)Src);
129  } else {
130  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
131  }
132  } else if (dst.Precision() == QUDA_QUARTER_PRECISION) {
133  if (src.Precision() == QUDA_SINGLE_PRECISION) {
134  copyGenericColorSpinorMGQS(dst, src, location, (int8_t *)Dst, (float *)Src);
135  } else if (src.Precision() == QUDA_HALF_PRECISION) {
136  copyGenericColorSpinorMGQH(dst, src, location, (int8_t *)Dst, (short *)Src);
137  } else if (src.Precision() == QUDA_QUARTER_PRECISION) {
138  copyGenericColorSpinorMGQQ(dst, src, location, (int8_t *)Dst, (int8_t *)Src);
139  } else {
140  errorQuda("Unsupported Destination Precision %d with Source Precision %d", dst.Precision(), src.Precision());
141  }
142  } else {
143  errorQuda("Unsupported Destination Precision %d", dst.Precision());
144  }
145  }
146  }
147 
148 } // namespace quda
QudaSiteSubset SiteSubset() const
QudaPrecision Precision() const
enum QudaFieldLocation_s QudaFieldLocation
@ QUDA_DOUBLE_PRECISION
Definition: enum_quda.h:65
@ QUDA_SINGLE_PRECISION
Definition: enum_quda.h:64
@ QUDA_QUARTER_PRECISION
Definition: enum_quda.h:62
@ QUDA_HALF_PRECISION
Definition: enum_quda.h:63
void copyGenericColorSpinorQH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorDS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGHS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGSQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorHQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorSQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorHH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorHD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGDD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGSD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGHQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinor(ColorSpinorField &dst, const ColorSpinorField &src, QudaFieldLocation location, void *Dst=0, void *Src=0, void *dstNorm=0, void *srcNorm=0)
void copyGenericColorSpinorDH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorSH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorSD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorSS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGQQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorQS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorQD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorDD(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGDS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGHH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorDQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGSH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGSS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorHS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGQH(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorMGQS(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
void copyGenericColorSpinorQQ(ColorSpinorField &, const ColorSpinorField &, QudaFieldLocation, void *, void *, void *a=0, void *b=0)
#define errorQuda(...)
Definition: util_quda.h:120