QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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 copyGenericGaugeSingleOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
9  void **ghostOut, void **ghostIn, int type);
10 
11  void copyGenericGaugeHalfOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
12  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
13 
14  void copyGenericGaugeQuarterOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out,
15  void *In, void **ghostOut, void **ghostIn, int type);
16 
17  // specialized variation where we restrict different field orders supported but instantiate different colors
18  // this, as with all of the above are hacks until JIT is supported
19  void copyGenericGaugeMG(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
20  void *Out, void *In, void **ghostOut, void **ghostIn, int type);
21 
22  void checkMomOrder(const GaugeField &u) {
23  if (u.Order() == QUDA_FLOAT2_GAUGE_ORDER) {
25  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
26  } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER || u.Order() == QUDA_TIFR_PADDED_GAUGE_ORDER) {
28  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
29  } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
31  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
32  } else if (u.Order() == QUDA_MILC_SITE_GAUGE_ORDER) {
34  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
35  } else {
36  errorQuda("Unsupported gauge field order %d", u.Order());
37  }
38  }
39 
40  // this is the function that is actually called, from here on down we instantiate all required templates
42  void *Out, void *In, void **ghostOut, void **ghostIn, int type) {
43  // do not copy the ghost zone if it does not exist
44  if (type == 0 && (in.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD ||
45  out.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD)) type = 2;
46 
47  if (in.Ncolor() != out.Ncolor())
48  errorQuda("Colors (%d,%d) do not match", out.Ncolor(), in.Ncolor());
49 
50  if (out.Geometry() != in.Geometry())
51  errorQuda("Field geometries %d %d do not match", out.Geometry(), in.Geometry());
52 
53  if (in.Ncolor() != 3) {
54  copyGenericGaugeMG(out, in, location, Out, In, ghostOut, ghostIn, type);
55  } else if (out.Precision() == QUDA_DOUBLE_PRECISION) {
56  copyGenericGaugeDoubleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
57  } else if (out.Precision() == QUDA_SINGLE_PRECISION) {
58  copyGenericGaugeSingleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
59  } else if (out.Precision() == QUDA_HALF_PRECISION) {
60  copyGenericGaugeHalfOut(out, in, location, Out, In, ghostOut, ghostIn, type);
61  } else if (out.Precision() == QUDA_QUARTER_PRECISION) {
62  copyGenericGaugeQuarterOut(out, in, location, Out, In, ghostOut, ghostIn, type);
63  } else {
64  errorQuda("Unknown precision %d", out.Precision());
65  }
66  }
67 
68 
69 } // 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:41
#define errorQuda(...)
Definition: util_quda.h:121
QudaFieldGeometry Geometry() const
Definition: gauge_field.h:258
int Ncolor() const
Definition: gauge_field.h:249
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 copyGenericGaugeQuarterOut(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:250
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:251
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:22
QudaPrecision Precision() const