QUDA  v1.1.0
A library for QCD on GPUs
copy_gauge.cpp
Go to the documentation of this file.
1 #include <gauge_field.h>
2 
3 namespace quda {
4 
5  void copyGenericGaugeDoubleIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
6  void **ghostOut, void **ghostIn, int type);
7 
8  void copyGenericGaugeSingleIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
9  void **ghostOut, void **ghostIn, int type);
10 
11  void copyGenericGaugeHalfIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
12  void **ghostOut, void **ghostIn, int type);
13 
14  void copyGenericGaugeQuarterIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In,
15  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
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_QDP_GAUGE_ORDER) {
34  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
35  } else if (u.Order() == QUDA_MILC_SITE_GAUGE_ORDER) {
37  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
38  } else {
39  errorQuda("Unsupported gauge field order %d", u.Order());
40  }
41  }
42 
43  // this is the function that is actually called, from here on down we instantiate all required templates
44  void copyGenericGauge(GaugeField &out, const GaugeField &in, QudaFieldLocation location,
45  void *Out, void *In, void **ghostOut, void **ghostIn, int type) {
46  // do not copy the ghost zone if it does not exist
47  if (type == 0 && (in.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD ||
48  out.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD)) type = 2;
49 
50  if (in.Ncolor() != out.Ncolor())
51  errorQuda("Colors (%d,%d) do not match", out.Ncolor(), in.Ncolor());
52 
53  if (out.Geometry() != in.Geometry())
54  errorQuda("Field geometries %d %d do not match", out.Geometry(), in.Geometry());
55 
56  if (in.Ncolor() != 3) {
57  copyGenericGaugeMG(out, in, location, Out, In, ghostOut, ghostIn, type);
58  } else if (in.Precision() == QUDA_DOUBLE_PRECISION) {
59  copyGenericGaugeDoubleIn(out, in, location, Out, In, ghostOut, ghostIn, type);
60  } else if (in.Precision() == QUDA_SINGLE_PRECISION) {
61  copyGenericGaugeSingleIn(out, in, location, Out, In, ghostOut, ghostIn, type);
62  } else if (in.Precision() == QUDA_HALF_PRECISION) {
63  copyGenericGaugeHalfIn(out, in, location, Out, In, ghostOut, ghostIn, type);
64  } else if (in.Precision() == QUDA_QUARTER_PRECISION) {
65  copyGenericGaugeQuarterIn(out, in, location, Out, In, ghostOut, ghostIn, type);
66  } else {
67  errorQuda("Unknown precision %d", out.Precision());
68  }
69  }
70 
71 
72 } // namespace quda
QudaFieldGeometry Geometry() const
Definition: gauge_field.h:294
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:287
int Ncolor() const
Definition: gauge_field.h:285
QudaReconstructType Reconstruct() const
Definition: gauge_field.h:286
QudaPrecision Precision() const
QudaGhostExchange GhostExchange() const
@ QUDA_RECONSTRUCT_NO
Definition: enum_quda.h:70
@ QUDA_RECONSTRUCT_10
Definition: enum_quda.h:75
enum QudaFieldLocation_s QudaFieldLocation
@ QUDA_GHOST_EXCHANGE_PAD
Definition: enum_quda.h:509
@ 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
@ QUDA_FLOAT2_GAUGE_ORDER
Definition: enum_quda.h:40
@ QUDA_TIFR_GAUGE_ORDER
Definition: enum_quda.h:50
@ QUDA_QDP_GAUGE_ORDER
Definition: enum_quda.h:44
@ QUDA_MILC_SITE_GAUGE_ORDER
Definition: enum_quda.h:48
@ QUDA_TIFR_PADDED_GAUGE_ORDER
Definition: enum_quda.h:51
@ QUDA_MILC_GAUGE_ORDER
Definition: enum_quda.h:47
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.cpp:44
void copyGenericGaugeQuarterIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
void copyGenericGaugeDoubleIn(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.cpp:22
void copyGenericGaugeHalfIn(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
void copyGenericGaugeSingleIn(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)
#define errorQuda(...)
Definition: util_quda.h:120