QUDA  0.9.0
copy_gauge.cu
Go to the documentation of this file.
1 #include <gauge_field_order.h>
2 
3 namespace quda {
4 
5  void copyGenericGaugeDoubleOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
6  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
7 
8  void copyGenericGaugeHalfOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
9  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
10 
11  void copyGenericGaugeSingleOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
12  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
13 
14  // specialized variation where we restrict different field orders supported but instantiate different colors
15  // this, as with all of the above are hacks until JIT is supported
16  void copyGenericGaugeMG(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
17  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
18 
19  void checkMomOrder(const GaugeField &u) {
20  if (u.Order() == QUDA_FLOAT2_GAUGE_ORDER) {
22  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
23  } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER || u.Order() == QUDA_TIFR_PADDED_GAUGE_ORDER) {
25  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
26  } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
28  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
29  } else if (u.Order() == QUDA_MILC_SITE_GAUGE_ORDER) {
31  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
32  } else {
33  errorQuda("Unsupported gauge field order %d", u.Order());
34  }
35  }
36 
37  // this is the function that is actually called, from here on down we instantiate all required templates
39  void *Out, void *In, void **ghostOut, void **ghostIn, int type) {
40  // do not copy the ghost zone if it does not exist
41  if (type == 0 && (in.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD ||
43 
44  if (in.Ncolor() != out.Ncolor())
45  errorQuda("Colors (%d,%d) do not match", out.Ncolor(), in.Ncolor());
46 
47  if (out.Geometry() != in.Geometry())
48  errorQuda("Field geometries %d %d do not match", out.Geometry(), in.Geometry());
49 
50  if (in.Ncolor() != 3) {
51  copyGenericGaugeMG(out, in, location, Out, In, ghostOut, ghostIn, type);
52  } else if (out.Precision() == QUDA_DOUBLE_PRECISION) {
53  copyGenericGaugeDoubleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
54  } else if (out.Precision() == QUDA_SINGLE_PRECISION) {
55  copyGenericGaugeSingleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
56  } else if (out.Precision() == QUDA_HALF_PRECISION) {
57  copyGenericGaugeHalfOut(out, in, location, Out, In, ghostOut, ghostIn, type);
58  }
59  }
60 
61 
62 } // namespace quda
void copyGenericGauge(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out=0, void *In=0, void **ghostOut=0, void **ghostIn=0, int type=0)
Definition: copy_gauge.cu:38
#define errorQuda(...)
Definition: util_quda.h:90
void copyGenericGaugeHalfOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
cpuColorSpinorField * in
Main header file for host and device accessors to GaugeFields.
enum QudaFieldLocation_s QudaFieldLocation
cpuColorSpinorField * out
void copyGenericGaugeDoubleOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
void copyGenericGaugeMG(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
QudaReconstructType Reconstruct() const
Definition: gauge_field.h:203
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:204
QudaGhostExchange GhostExchange() const
void copyGenericGaugeSingleOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
void checkMomOrder(const GaugeField &u)
Definition: copy_gauge.cu:19
QudaPrecision Precision() const