QUDA  v0.7.0
A library for QCD on GPUs
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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  void checkMomOrder(const GaugeField &u) {
15  if (u.Order() == QUDA_FLOAT2_GAUGE_ORDER) {
17  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
18  } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER) {
20  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
21  } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
23  errorQuda("Unsuported order %d and reconstruct %d combination", u.Order(), u.Reconstruct());
24  } else {
25  errorQuda("Unsupported gauge field order %d", u.Order());
26  }
27  }
28 
29  // this is the function that is actually called, from here on down we instantiate all required templates
31  void *Out, void *In, void **ghostOut, void **ghostIn, int type) {
32  // do not copy the ghost zone if it does not exist
33  if (type == 0 && (in.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD ||
34  out.GhostExchange() != QUDA_GHOST_EXCHANGE_PAD)) type = 2;
35 
36  if (out.Precision() == QUDA_DOUBLE_PRECISION) {
37  copyGenericGaugeDoubleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
38  } else if (out.Precision() == QUDA_SINGLE_PRECISION) {
39  copyGenericGaugeSingleOut(out, in, location, Out, In, ghostOut, ghostIn, type);
40  } else if (out.Precision() == QUDA_HALF_PRECISION) {
41  copyGenericGaugeHalfOut(out, in, location, Out, In, ghostOut, ghostIn, type);
42  }
43  }
44 
45 
46 } // namespace quda
QudaGhostExchange GhostExchange() const
Definition: gauge_field.h:179
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:30
#define errorQuda(...)
Definition: util_quda.h:73
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:169
QudaPrecision Precision() const
const QudaFieldLocation location
Definition: pack_test.cpp:46
void copyGenericGaugeHalfOut(GaugeField &out, const GaugeField &in, QudaFieldLocation location, void *Out, void *In, void **ghostOut, void **ghostIn, int type)
cpuColorSpinorField * in
QudaReconstructType Reconstruct() const
Definition: gauge_field.h:168
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 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:14