QUDA  0.9.0
extract_gauge_ghost.cu
Go to the documentation of this file.
1 #include <gauge_field_order.h>
3 
4 namespace quda {
5 
6  using namespace gauge;
7 
9  template <typename Float>
10  void extractGhost(const GaugeField &u, Float **Ghost, bool extract, int offset) {
11 
12  const int length = 18;
13 
14  QudaFieldLocation location =
16 
17  if (u.isNative()) {
18  if (u.Reconstruct() == QUDA_RECONSTRUCT_NO) {
19  if (typeid(Float)==typeid(short) && u.LinkType() == QUDA_ASQTAD_FAT_LINKS) {
20  extractGhost<short,length>(FloatNOrder<short,length,2,19>
21  (u, 0, (short**)Ghost), u, location, extract, offset);
22  } else {
24  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
25  }
26  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_12) {
28  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
29  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_8) {
31  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
32  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_13) {
34  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
35  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_9) {
37  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
38  }
39  } else if (u.Order() == QUDA_QDP_GAUGE_ORDER) {
40 
41 #ifdef BUILD_QDP_INTERFACE
42  extractGhost<Float,length>(QDPOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
43 #else
44  errorQuda("QDP interface has not been built\n");
45 #endif
46 
47  } else if (u.Order() == QUDA_QDPJIT_GAUGE_ORDER) {
48 
49 #ifdef BUILD_QDPJIT_INTERFACE
50  extractGhost<Float,length>(QDPJITOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
51 #else
52  errorQuda("QDPJIT interface has not been built\n");
53 #endif
54 
55  } else if (u.Order() == QUDA_CPS_WILSON_GAUGE_ORDER) {
56 
57 #ifdef BUILD_CPS_INTERFACE
58  extractGhost<Float,length>(CPSOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
59 #else
60  errorQuda("CPS interface has not been built\n");
61 #endif
62 
63  } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
64 
65 #ifdef BUILD_MILC_INTERFACE
66  extractGhost<Float,length>(MILCOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
67 #else
68  errorQuda("MILC interface has not been built\n");
69 #endif
70 
71  } else if (u.Order() == QUDA_BQCD_GAUGE_ORDER) {
72 
73 #ifdef BUILD_BQCD_INTERFACE
74  extractGhost<Float,length>(BQCDOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
75 #else
76  errorQuda("BQCD interface has not been built\n");
77 #endif
78 
79  } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER) {
80 
81 #ifdef BUILD_TIFR_INTERFACE
82  extractGhost<Float,length>(TIFROrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
83 #else
84  errorQuda("TIFR interface has not been built\n");
85 #endif
86 
87  } else if (u.Order() == QUDA_TIFR_PADDED_GAUGE_ORDER) {
88 
89 #ifdef BUILD_TIFR_INTERFACE
90  extractGhost<Float,length>(TIFRPaddedOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
91 #else
92  errorQuda("TIFR interface has not been built\n");
93 #endif
94 
95  } else {
96  errorQuda("Gauge field %d order not supported", u.Order());
97  }
98 
99  }
100 
101  void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset);
102 
103  void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract, int offset) {
104 
105  // if number of colors doesn't equal three then we must have
106  // coarse-gauge field
107  if (u.Ncolor() != 3) {
108  extractGaugeGhostMG(u, ghost, extract, offset);
109  } else {
110  if (u.Precision() == QUDA_DOUBLE_PRECISION) {
111  extractGhost(u, (double**)ghost, extract, offset);
112  } else if (u.Precision() == QUDA_SINGLE_PRECISION) {
113  extractGhost(u, (float**)ghost, extract, offset);
114  } else if (u.Precision() == QUDA_HALF_PRECISION) {
115  extractGhost(u, (short**)ghost, extract, offset);
116  } else {
117  errorQuda("Unknown precision type %d", u.Precision());
118  }
119  }
120  }
121 
122 } // namespace quda
void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract=true, int offset=0)
#define errorQuda(...)
Definition: util_quda.h:90
QudaLinkType LinkType() const
Definition: gauge_field.h:209
void extractGhost(const GaugeField &u, Float **Ghost, bool extract, int offset)
size_t size_t offset
int Ncolor() const
Definition: gauge_field.h:202
Main header file for host and device accessors to GaugeFields.
enum QudaFieldLocation_s QudaFieldLocation
void size_t length
Accessor routine for CloverFields in native field order.
QudaReconstructType Reconstruct() const
Definition: gauge_field.h:203
void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset)
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:204
QudaPrecision Precision() const
bool isNative() const