QUDA  1.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
extract_gauge_ghost_mg.cu
Go to the documentation of this file.
1 // trove cannot deal with the large matrices that MG uses so we need
2 // to disable it (regardless we're using fine-grained access)
3 #define DISABLE_TROVE
4 #define FINE_GRAINED_ACCESS
5 
6 #include <gauge_field_order.h>
8 
9 namespace quda {
10 
11  using namespace gauge;
12 
14  template <typename storeFloat, int Nc>
15  void extractGhostMG(const GaugeField &u, storeFloat **Ghost, bool extract, int offset) {
16 
17  typedef typename mapper<storeFloat>::type Float;
18  constexpr int length = 2*Nc*Nc;
19 
20  QudaFieldLocation location =
22 
23  if (u.isNative()) {
24  if (u.Reconstruct() == QUDA_RECONSTRUCT_NO) {
25 #ifdef FINE_GRAINED_ACCESS
27  extractGhost<Float,length>(G(const_cast<GaugeField&>(u), 0, (void**)Ghost), u, location, extract, offset);
28 #else
30  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
31 #endif
32  }
33  } else if (u.Order() == QUDA_QDP_GAUGE_ORDER) {
34 
35 #ifdef BUILD_QDP_INTERFACE
36 #ifdef FINE_GRAINED_ACCESS
38  extractGhost<Float,length>(G(const_cast<GaugeField&>(u), 0, (void**)Ghost), u, location, extract, offset);
39 #else
40  extractGhost<Float,length>(QDPOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
41 #endif
42 #else
43  errorQuda("QDP interface has not been built\n");
44 #endif
45 
46  } else {
47  errorQuda("Gauge field %d order not supported", u.Order());
48  }
49  }
50 
51 
53  template <typename Float>
54  void extractGhostMG(const GaugeField &u, Float **Ghost, bool extract, int offset) {
55 
56  if (u.Reconstruct() != QUDA_RECONSTRUCT_NO)
57  errorQuda("Reconstruct %d not supported", u.Reconstruct());
58 
59  if (u.LinkType() != QUDA_COARSE_LINKS)
60  errorQuda("Link type %d not supported", u.LinkType());
61 
62  if (u.Ncolor() == 12) { // free field Wilson
63  extractGhostMG<Float, 12>(u, Ghost, extract, offset);
64  } else if (u.Ncolor() == 32) {
65  extractGhostMG<Float, 32>(u, Ghost, extract, offset);
66  } else if (u.Ncolor() == 48) {
67  extractGhostMG<Float, 48>(u, Ghost, extract, offset);
68  } else if (u.Ncolor() == 64) {
69  extractGhostMG<Float, 64>(u, Ghost, extract, offset);
70  } else {
71  errorQuda("Ncolor = %d not supported", u.Ncolor());
72  }
73  }
74 
75  void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset) {
76 
77 #ifndef FINE_GRAINED_ACCESS
78  if (u.Precision() == QUDA_HALF_PRECISION) errorQuda("Precision format not supported");
79 #endif
80 
81  if (u.Precision() == QUDA_DOUBLE_PRECISION) {
82 #ifdef GPU_MULTIGRID_DOUBLE
83  extractGhostMG(u, (double**)ghost, extract, offset);
84 #else
85  errorQuda("Double precision multigrid has not been enabled");
86 #endif
87  } else if (u.Precision() == QUDA_SINGLE_PRECISION) {
88  extractGhostMG(u, (float**)ghost, extract, offset);
89  } else if (u.Precision() == QUDA_HALF_PRECISION) {
90  extractGhostMG(u, (short**)ghost, extract, offset);
91  } else {
92  errorQuda("Unknown precision type %d", u.Precision());
93  }
94  }
95 
96 } // namespace quda
#define errorQuda(...)
Definition: util_quda.h:121
QudaLinkType LinkType() const
Definition: gauge_field.h:255
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
void extractGhostMG(const GaugeField &u, storeFloat **Ghost, bool extract, int offset)
QudaPrecision Precision() const
bool isNative() const