QUDA  0.9.0
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 Float, int Nc>
15  void extractGhostMG(const GaugeField &u, Float **Ghost, bool extract, int offset) {
16 
17  constexpr int length = 2*Nc*Nc;
18 
19  QudaFieldLocation location =
21 
22  if (u.isNative()) {
23  if (u.Reconstruct() == QUDA_RECONSTRUCT_NO) {
24 #ifdef FINE_GRAINED_ACCESS
26  extractGhost<Float,length>(G(const_cast<GaugeField&>(u), 0, (void**)Ghost), u, location, extract, offset);
27 #else
29  extractGhost<Float,length>(G(u, 0, Ghost), u, location, extract, offset);
30 #endif
31  }
32  } else if (u.Order() == QUDA_QDP_GAUGE_ORDER) {
33 
34 #ifdef BUILD_QDP_INTERFACE
35 #ifdef FINE_GRAINED_ACCESS
37  extractGhost<Float,length>(G(const_cast<GaugeField&>(u), 0, (void**)Ghost), u, location, extract, offset);
38 #else
39  extractGhost<Float,length>(QDPOrder<Float,length>(u, 0, Ghost), u, location, extract, offset);
40 #endif
41 #else
42  errorQuda("QDP interface has not been built\n");
43 #endif
44 
45  } else {
46  errorQuda("Gauge field %d order not supported", u.Order());
47  }
48  }
49 
50 
52  template <typename Float>
53  void extractGhostMG(const GaugeField &u, Float **Ghost, bool extract, int offset) {
54 
55  if (u.Reconstruct() != QUDA_RECONSTRUCT_NO)
56  errorQuda("Reconstruct %d not supported", u.Reconstruct());
57 
58  if (u.LinkType() != QUDA_COARSE_LINKS)
59  errorQuda("Link type %d not supported", u.LinkType());
60 
61  if (u.Ncolor() == 4) {
62  extractGhostMG<Float, 4>(u, Ghost, extract, offset);
63  } else if (u.Ncolor() == 32) {
64  extractGhostMG<Float, 32>(u, Ghost, extract, offset);
65  } else if (u.Ncolor() == 48) {
66  extractGhostMG<Float, 48>(u, Ghost, extract, offset);
67  } else if (u.Ncolor() == 64) {
68  extractGhostMG<Float, 64>(u, Ghost, extract, offset);
69  } else {
70  errorQuda("Ncolor = %d not supported", u.Ncolor());
71  }
72  }
73 
74  void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset) {
75 
76  if (u.Precision() == QUDA_DOUBLE_PRECISION) {
77 #ifdef GPU_MULTIGRID_DOUBLE
78  extractGhostMG(u, (double**)ghost, extract, offset);
79 #else
80  errorQuda("Double precision multigrid has not been enabled");
81 #endif
82  } else if (u.Precision() == QUDA_SINGLE_PRECISION) {
83  extractGhostMG(u, (float**)ghost, extract, offset);
84  } else {
85  errorQuda("Unknown precision type %d", u.Precision());
86  }
87  }
88 
89 } // namespace quda
#define errorQuda(...)
Definition: util_quda.h:90
QudaLinkType LinkType() const
Definition: gauge_field.h:209
size_t size_t offset
int Ncolor() const
Definition: gauge_field.h:202
void extractGhostMG(const GaugeField &u, Float **Ghost, bool extract, int offset)
Main header file for host and device accessors to GaugeFields.
enum QudaFieldLocation_s QudaFieldLocation
void size_t length
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