QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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) {
20  extractGhost<Float, length>(G(u, 0, Ghost), u, location, extract, offset);
21  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_12) {
23  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
24  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_8) {
26  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
27  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_13) {
29  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
30  } else if (u.Reconstruct() == QUDA_RECONSTRUCT_9) {
33  extractGhost<Float, length>(G(u, 0, Ghost), u, location, extract, offset);
34  } else if (u.StaggeredPhase() == QUDA_STAGGERED_PHASE_NO) {
36  extractGhost<Float, length>(G(u, 0, Ghost), u, location, extract, offset);
37  } else {
38  errorQuda("Staggered phase type %d not supported", u.StaggeredPhase());
39  }
40  }
41  } else if (u.Order() == QUDA_QDP_GAUGE_ORDER) {
42 
43 #ifdef BUILD_QDP_INTERFACE
44  extractGhost<Float,length>(QDPOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
45 #else
46  errorQuda("QDP interface has not been built\n");
47 #endif
48 
49  } else if (u.Order() == QUDA_QDPJIT_GAUGE_ORDER) {
50 
51 #ifdef BUILD_QDPJIT_INTERFACE
52  extractGhost<Float,length>(QDPJITOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
53 #else
54  errorQuda("QDPJIT interface has not been built\n");
55 #endif
56 
57  } else if (u.Order() == QUDA_CPS_WILSON_GAUGE_ORDER) {
58 
59 #ifdef BUILD_CPS_INTERFACE
60  extractGhost<Float,length>(CPSOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
61 #else
62  errorQuda("CPS interface has not been built\n");
63 #endif
64 
65  } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
66 
67 #ifdef BUILD_MILC_INTERFACE
68  extractGhost<Float,length>(MILCOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
69 #else
70  errorQuda("MILC interface has not been built\n");
71 #endif
72 
73  } else if (u.Order() == QUDA_BQCD_GAUGE_ORDER) {
74 
75 #ifdef BUILD_BQCD_INTERFACE
76  extractGhost<Float,length>(BQCDOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
77 #else
78  errorQuda("BQCD interface has not been built\n");
79 #endif
80 
81  } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER) {
82 
83 #ifdef BUILD_TIFR_INTERFACE
84  extractGhost<Float,length>(TIFROrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
85 #else
86  errorQuda("TIFR interface has not been built\n");
87 #endif
88 
89  } else if (u.Order() == QUDA_TIFR_PADDED_GAUGE_ORDER) {
90 
91 #ifdef BUILD_TIFR_INTERFACE
92  extractGhost<Float,length>(TIFRPaddedOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
93 #else
94  errorQuda("TIFR interface has not been built\n");
95 #endif
96 
97  } else {
98  errorQuda("Gauge field %d order not supported", u.Order());
99  }
100 
101  }
102 
103  void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset);
104 
105  void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract, int offset) {
106 
107  // if number of colors doesn't equal three then we must have
108  // coarse-gauge field
109  if (u.Ncolor() != 3) {
110  extractGaugeGhostMG(u, ghost, extract, offset);
111  } else {
112  if (u.Precision() == QUDA_DOUBLE_PRECISION) {
113  extractGhost(u, (double**)ghost, extract, offset);
114  } else if (u.Precision() == QUDA_SINGLE_PRECISION) {
115  extractGhost(u, (float**)ghost, extract, offset);
116  } else if (u.Precision() == QUDA_HALF_PRECISION) {
117  extractGhost(u, (short**)ghost, extract, offset);
118  } else if (u.Precision() == QUDA_QUARTER_PRECISION) {
119  extractGhost(u, (char **)ghost, extract, offset);
120  } else {
121  errorQuda("Unknown precision type %d", u.Precision());
122  }
123  }
124  }
125 
126 } // namespace quda
struct to define TIFR ordered gauge fields: [mu][parity][volumecb][col][row]
void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract=true, int offset=0)
#define errorQuda(...)
Definition: util_quda.h:121
void extractGhost(const GaugeField &u, Float **Ghost, bool extract, int offset)
int length[]
int Ncolor() const
Definition: gauge_field.h:249
Main header file for host and device accessors to GaugeFields.
enum QudaFieldLocation_s QudaFieldLocation
QudaReconstructType Reconstruct() const
Definition: gauge_field.h:250
void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset)
QudaGaugeFieldOrder Order() const
Definition: gauge_field.h:251
QudaStaggeredPhase StaggeredPhase() const
Definition: gauge_field.h:259
QudaPrecision Precision() const
bool isNative() const