CHROMA
lwldslash_array_sse_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Wilson Dslash linear operator array
3  */
4 
5 #include "chromabase.h"
7 #include "sse_dslash.h"
8 #include "sse_dslash_qdp_packer.h"
9 
10 namespace Chroma
11 {
12 
13  //! Initialization routine
15  {
16  START_CODE();
17 
18  // Initialize internal structures for DSLASH
19 #if 0
20  QDPIO::cout << "Calling init_sse_su3dslash()... " << std::endl;
21 #endif
22 
23  // Initialize using the total problem size
24  init_sse_su3dslash(Layout::lattSize().slice(),
25  Layout::QDPXX_getSiteCoords,
26  Layout::QDPXX_getLinearSiteIndex,
27  Layout::QDPXX_nodeNumber);
28 
29 
30  END_CODE();
31  }
32 
33  //! Empty constructor. Must use create later
35  {
36  init();
37  }
38 
39  //! Full constructor
41  int N5_,
42  const AnisoParam_t& aniso_)
43  {
44  init();
45  create(state,N5_,aniso_);
46  }
47 
48 
49  //! Full constructor
51  int N5_)
52  {
53  init();
54  create(state,N5_);
55  }
56 
57 
58  //! Creation routine
60  int N5_)
61  {
62  multi1d<Real> cf(Nd);
63  cf = 1.0;
64  create(state, N5_, cf);
65  }
66 
67 
68  //! Creation routine with anisotropy
70  const AnisoParam_t& anisoParam)
71  {
72  START_CODE();
73 
74  create(state, N5_, makeFermCoeffs(anisoParam));
75 
76  END_CODE();
77  }
78 
79  //! Creation routine
81  const multi1d<Real>& coeffs_)
82  {
83  START_CODE();
84 
85  N5 = N5_;
86  coeffs = coeffs_;
87 
88  // Save a copy of the fermbc
89  fbc = state->getFermBC();
90 
91  // Sanity check
92  if (fbc.operator->() == 0)
93  {
94  QDPIO::cerr << "SSEWilsonDslashArray: error: fbc is null" << std::endl;
95  QDP_abort(1);
96  }
97 
98  // Temporary copy - not kept
99  multi1d<LatticeColorMatrix> u = state->getLinks();
100 
101  // Rescale the u fields by the anisotropy
102  for(int mu=0; mu < u.size(); ++mu)
103  {
104  u[mu] *= coeffs[mu];
105  }
106 
107  // Pack the gauge fields
108  packed_gauge.resize( Nd * Layout::sitesOnNode() );
109 
110 #if 0
111  QDPIO::cout << "Done " << std::endl << std::flush;
112 
113  QDPIO::cout << "Calling pack_gauge_field..." << std::flush;
114 #endif
115 
116  SSEDslash::qdp_pack_gauge(u, packed_gauge);
117 
118 #if 0
119  QDPIO::cout << "Done" << std::endl << std::flush;
120 #endif
121 
122  END_CODE();
123  }
124 
125 
127  {
128  START_CODE();
129 
130 #if 0
131  QDPIO::cout << "Calling free_sse_su3dslash()... " << std::endl;
132 #endif
133 
134  free_sse_su3dslash();
135 
136  END_CODE();
137  }
138 
139 
140  //! General Wilson-Dirac dslash
141  /*! \ingroup linop
142  * Wilson dslash
143  *
144  * Arguments:
145  *
146  * \param chi Result (Write)
147  * \param psi Pseudofermion field (Read)
148  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
149  * \param cb Checkerboard of OUTPUT std::vector (Read)
150  */
151  void
152  SSEWilsonDslashArray::apply (multi1d<LatticeFermion>& chi,
153  const multi1d<LatticeFermion>& psi,
154  enum PlusMinus isign, int cb) const
155  {
156  START_CODE();
157 
158  if( chi.size() != N5 ) chi.resize(N5);
159 
160  for(int n=0; n < N5; ++n)
161  apply(chi[n], psi[n], isign, cb);
162 
163  END_CODE();
164  }
165 
166 
167  //! General Wilson-Dirac dslash
168  /*! \ingroup linop
169  * Wilson dslash
170  *
171  * Arguments:
172  *
173  * \param chi Result (Write)
174  * \param psi Pseudofermion field (Read)
175  * \param isign D'^dag or D' ( MINUS | PLUS ) resp. (Read)
176  * \param cb Checkerboard of OUTPUT std::vector (Read)
177  */
178  void
179  SSEWilsonDslashArray::apply (LatticeFermion& chi, const LatticeFermion& psi,
180  enum PlusMinus isign, int cb) const
181  {
182  START_CODE();
183 
184  /* Pass the right parities.
185  *
186  * SZIN standard is that cb is cb of INPUT
187  * Chroma standard is that the cb is cb of OUTPUT
188  *
189  * Need to invert cb for SZIN style SSE call
190 
191  *
192  *
193  * Pass all the fermion and all the gauge pieces
194  *
195  * NOTE: this breaks usage from SZIN. However, Chroma and SSE dslash can handle
196  * odd subgrid lattice sizes, whereas SZIN cannot. Thus, I must pass all fermion
197  * cbs to support such flexibility.
198  *
199  */
200  sse_su3dslash_wilson((SSEREAL *)&(packed_gauge[0]),
201  (SSEREAL *)&(psi.elem(0).elem(0).elem(0).real()),
202  (SSEREAL *)&(chi.elem(0).elem(0).elem(0).real()),
203  (int)isign, (1-cb));
204 
205  getFermBC().modifyF(chi, QDP::rb[cb]);
206 
207  END_CODE();
208  }
209 
210 } // End Namespace Chroma
211 
Primary include file for CHROMA library code.
Support class for fermion actions and linear operators.
Definition: state.h:94
Class for counted reference semantics.
Definition: handle.h:33
~SSEWilsonDslashArray()
No real need for cleanup here.
multi1d< PrimitiveSU3Matrix > packed_gauge
Handle< FermBC< T, P, Q > > fbc
void create(Handle< FermState< T, P, Q > > state, int N5_)
Creation routine.
SSEWilsonDslashArray()
Empty constructor. Must use create later.
const FermBC< T, P, Q > & getFermBC() const
Return the fermion BC object for this linear operator.
int mu
Definition: cool.cc:24
void apply(multi1d< LatticeFermion > &chi, const multi1d< LatticeFermion > &psi, enum PlusMinus isign, int cb) const
General Wilson-Dirac dslash.
unsigned n
Definition: ldumul_w.cc:36
Wilson Dslash linear operator array.
Nd
Definition: meslate.cc:74
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
Parameters for anisotropy.
Definition: aniso_io.h:24