CHROMA
lwldslash_3d_sse_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson Dslash linear operator
3  */
4 #include "qdp_config.h"
5 #if QDP_NS == 4
6 #if QDP_ND == 4
7 #if QDP_NC == 3
8 
9 #include "chromabase.h"
11 #include "sse_dslash_3d.h"
12 #include "sse_dslash_qdp_packer_3d.h"
13 
14 namespace Chroma
15 {
16 
17  //! Initialization routine
19  {
20  // Initialize internal structures for DSLASH
21 #if 0
22  QDPIO::cout << "Calling init_sse_su3dslash()... " << std::endl;
23 #endif
24 
25  // Initialize using the total problem size
26  init_sse_su3dslash_3d(Layout::lattSize().slice(),
27  Layout::QDPXX_getSiteCoords,
28  Layout::QDPXX_getLinearSiteIndex,
29  Layout::QDPXX_nodeNumber);
30  }
31 
32 
33  //! Empty constructor
34  SSEWilsonDslash3D::SSEWilsonDslash3D()
35  {
36  init();
37  }
38 
39  //! Full constructor
40  SSEWilsonDslash3D::SSEWilsonDslash3D(Handle< FermState<T,P,Q> > state)
41  {
42  init();
43  create(state);
44  }
45 
46  //! Full constructor with anisotropy
47  SSEWilsonDslash3D::SSEWilsonDslash3D(Handle< FermState<T,P,Q> > state,
48  const AnisoParam_t& aniso_)
49  {
50  init();
51  create(state, aniso_);
52  }
53 
54  //! Creation routine
55  void SSEWilsonDslash3D::create(Handle< FermState<T,P,Q> > state)
56  {
57  multi1d<Real> cf(Nd);
58  cf = 1.0;
59  create(state, cf);
60  }
61 
62  //! Creation routine with anisotropy
63  void SSEWilsonDslash3D::create(Handle< FermState<T,P,Q> > state,
64  const AnisoParam_t& anisoParam)
65  {
66  START_CODE();
67 
68  create(state, makeFermCoeffs(anisoParam));
69 
70  END_CODE();
71  }
72 
73  //! Full constructor with general coefficients
74  void SSEWilsonDslash3D::create(Handle< FermState<T,P,Q> > state,
75  const multi1d<Real>& coeffs_)
76  {
77  START_CODE();
78 
79  // Save a copy of the aniso params original fields and with aniso folded in
80  coeffs = coeffs_;
81 
82  // Save a copy of the fermbc
83  fbc = state->getFermBC();
84 
85  // Sanity check
86  if (fbc.operator->() == 0)
87  {
88  QDPIO::cerr << "SSEWilsonDslash3D: error: fbc is null" << std::endl;
89  QDP_abort(1);
90  }
91 
92  // Fold in anisotropy
93  multi1d<LatticeColorMatrix> u = state->getLinks();
94 
95  // Rescale the u fields by the anisotropy
96  for(int mu=0; mu < u.size(); ++mu)
97  {
98  u[mu] *= coeffs[mu];
99  }
100 
101  // Pack the gauge fields
102  packed_gauge.resize( 4 * Layout::sitesOnNode() );
103  SSEDslash3D::qdp_pack_gauge_3d(u, packed_gauge);
104 
105  END_CODE();
106  }
107 
108 
109  SSEWilsonDslash3D::~SSEWilsonDslash3D()
110  {
111  START_CODE();
112 
113 #if 0
114  QDPIO::cout << "Calling free_sse_su3dslash()... " << std::endl;
115 #endif
116 
117  free_sse_su3dslash_3d();
118 
119  END_CODE();
120  }
121 
122  //! General Wilson-Dirac dslash
123  /*! \ingroup linop
124  * Wilson dslash
125  *
126  * Arguments:
127  *
128  * \param chi Result (Write)
129  * \param psi Pseudofermion field (Read)
130  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
131  * \param cb Checkerboard of OUTPUT std::vector (Read)
132  */
133  void
134  SSEWilsonDslash3D::apply (LatticeFermion& chi, const LatticeFermion& psi,
135  enum PlusMinus isign, int cb) const
136  {
137  START_CODE();
138 
139  /* Pass the right parities.
140  *
141  * SZIN standard is that cb is cb of INPUT
142  * Chroma standard is that the cb is cb of OUTPUT
143  *
144  * Need to invert cb for SZIN style SSE call
145 
146  *
147  *
148  * Pass all the fermion and all the gauge pieces
149  *
150  * NOTE: this breaks usage from SZIN. However, Chroma and SSE dslash can handle
151  * odd subgrid lattice sizes, whereas SZIN cannot. Thus, I must pass all fermion
152  * cbs to support such flexibility.
153  *
154  */
155  int source_cb = 1 - cb;
156  int target_cb = cb;
157  int cbsites = QDP::Layout::sitesOnNode()/2;
158 
159  sse_su3dslash_wilson_3d((SSEREAL *)&(packed_gauge[0]),
160  (SSEREAL *)&(psi.elem(0).elem(0).elem(0).real()),
161  (SSEREAL *)&(chi.elem(0).elem(0).elem(0).real()),
162  (int)isign, source_cb);
163 
164 
165  getFermBC().modifyF(chi, QDP::rb3[cb]);
166 
167  END_CODE();
168  }
169 
170 } // End Namespace Chroma
171 
172 #endif
173 #endif
174 #endif
Primary include file for CHROMA library code.
int mu
Definition: cool.cc:24
Wilson Dslash linear operator.
Nd
Definition: meslate.cc:74
void init(MesonSpecData_t &data, XMLWriter &xml, const std::string &path, const std::string &id_tag, const Params &params)
Do some initialization.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
static multi1d< LatticeColorMatrix > u
multi1d< LatticeFermion > chi(Ncb)
LatticeFermion psi
Definition: mespbg5p_w.cc:35
START_CODE()
int cb
Definition: invbicg.cc:120
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
Definition: pbg5p_w.cc:28
multi1d< Real > makeFermCoeffs(const AnisoParam_t &aniso)
Make fermion coefficients.
Definition: aniso_io.cc:63