1 #include <gauge_field_order.h>
2 #include <extract_gauge_ghost_helper.cuh>
3 #include <instantiate.h>
9 /** This is the template driver for extractGhost */
10 template <typename Float> struct GhostExtract {
11 GhostExtract(const GaugeField &u, void **Ghost_, bool extract, int offset)
13 Float **Ghost = reinterpret_cast<Float**>(Ghost_);
14 const int length = 18;
17 if (u.Reconstruct() == QUDA_RECONSTRUCT_NO) {
18 typedef typename gauge_mapper<Float, QUDA_RECONSTRUCT_NO>::type G;
19 extractGhost<Float, length>(G(u, 0, Ghost), u, extract, offset);
20 } else if (u.Reconstruct() == QUDA_RECONSTRUCT_12) {
21 #if QUDA_RECONSTRUCT & 2
22 typedef typename gauge_mapper<Float,QUDA_RECONSTRUCT_12>::type G;
23 extractGhost<Float,length>(G(u, 0, Ghost), u, extract, offset);
25 errorQuda("QUDA_RECONSTRUCT = %d does not enable QUDA_RECONSTRUCT_12", QUDA_RECONSTRUCT);
27 } else if (u.Reconstruct() == QUDA_RECONSTRUCT_8) {
28 #if QUDA_RECONSTRUCT & 1
29 typedef typename gauge_mapper<Float,QUDA_RECONSTRUCT_8>::type G;
30 extractGhost<Float,length>(G(u, 0, Ghost), u, extract, offset);
32 errorQuda("QUDA_RECONSTRUCT = %d does not enable QUDA_RECONSTRUCT_8", QUDA_RECONSTRUCT);
34 } else if (u.Reconstruct() == QUDA_RECONSTRUCT_13) {
35 #if QUDA_RECONSTRUCT & 2
36 typedef typename gauge_mapper<Float,QUDA_RECONSTRUCT_13>::type G;
37 extractGhost<Float,length>(G(u, 0, Ghost), u, extract, offset);
39 errorQuda("QUDA_RECONSTRUCT = %d does not enable QUDA_RECONSTRUCT_13", QUDA_RECONSTRUCT);
41 } else if (u.Reconstruct() == QUDA_RECONSTRUCT_9) {
42 #if QUDA_RECONSTRUCT & 1
43 if (u.StaggeredPhase() == QUDA_STAGGERED_PHASE_MILC) {
44 typedef typename gauge_mapper<Float, QUDA_RECONSTRUCT_9, 18, QUDA_STAGGERED_PHASE_MILC>::type G;
45 extractGhost<Float, length>(G(u, 0, Ghost), u, extract, offset);
46 } else if (u.StaggeredPhase() == QUDA_STAGGERED_PHASE_NO) {
47 typedef typename gauge_mapper<Float, QUDA_RECONSTRUCT_9>::type G;
48 extractGhost<Float, length>(G(u, 0, Ghost), u, extract, offset);
50 errorQuda("Staggered phase type %d not supported", u.StaggeredPhase());
53 errorQuda("QUDA_RECONSTRUCT = %d does not enable QUDA_RECONSTRUCT_9", QUDA_RECONSTRUCT);
56 } else if (u.Order() == QUDA_QDP_GAUGE_ORDER) {
58 #ifdef BUILD_QDP_INTERFACE
59 extractGhost<Float,length>(QDPOrder<Float,length>(u, 0, Ghost), u, extract, offset);
61 errorQuda("QDP interface has not been built\n");
64 } else if (u.Order() == QUDA_QDPJIT_GAUGE_ORDER) {
66 #ifdef BUILD_QDPJIT_INTERFACE
67 extractGhost<Float,length>(QDPJITOrder<Float,length>(u, 0, Ghost), u, extract, offset);
69 errorQuda("QDPJIT interface has not been built\n");
72 } else if (u.Order() == QUDA_CPS_WILSON_GAUGE_ORDER) {
74 #ifdef BUILD_CPS_INTERFACE
75 extractGhost<Float,length>(CPSOrder<Float,length>(u, 0, Ghost), u, extract, offset);
77 errorQuda("CPS interface has not been built\n");
80 } else if (u.Order() == QUDA_MILC_GAUGE_ORDER) {
82 #ifdef BUILD_MILC_INTERFACE
83 extractGhost<Float,length>(MILCOrder<Float,length>(u, 0, Ghost), u, extract, offset);
85 errorQuda("MILC interface has not been built\n");
88 } else if (u.Order() == QUDA_BQCD_GAUGE_ORDER) {
90 #ifdef BUILD_BQCD_INTERFACE
91 extractGhost<Float,length>(BQCDOrder<Float,length>(u, 0, Ghost), u, extract, offset);
93 errorQuda("BQCD interface has not been built\n");
96 } else if (u.Order() == QUDA_TIFR_GAUGE_ORDER) {
98 #ifdef BUILD_TIFR_INTERFACE
99 extractGhost<Float,length>(TIFROrder<Float,length>(u, 0, Ghost), u, extract, offset);
101 errorQuda("TIFR interface has not been built\n");
104 } else if (u.Order() == QUDA_TIFR_PADDED_GAUGE_ORDER) {
106 #ifdef BUILD_TIFR_INTERFACE
107 extractGhost<Float,length>(TIFRPaddedOrder<Float,length>(u, 0, Ghost), u, extract, offset);
109 errorQuda("TIFR interface has not been built\n");
113 errorQuda("Gauge field %d order not supported", u.Order());
119 void extractGaugeGhostMG(const GaugeField &u, void **ghost, bool extract, int offset);
121 void extractGaugeGhost(const GaugeField &u, void **ghost, bool extract, int offset) {
123 // if number of colors doesn't equal three then we must have
124 // coarse-gauge field
125 if (u.Ncolor() != 3) {
126 extractGaugeGhostMG(u, ghost, extract, offset);
128 instantiatePrecision<GhostExtract>(u, ghost, extract, offset);