6 #ifndef __lwldslash_qphix_h__
7 #define __lwldslash_qphix_h__
11 #ifdef CHROMA_BUILDING_QPHIX_DSLASH
12 #warning USING QPHIX DSLASH
13 #undef DEBUG_QPHIX_DSLASH
20 #include "qdp_datalayout.h"
21 #include "qphix/geometry.h"
22 #include "qphix/dslash_def.h"
23 #include "qphix/qdp_packer.h"
29 warning
"S is defined"
63 template<
typename T,
typename P,
typename Q>
64 class QPhiXWilsonDslash :
public WilsonDslashBase<T,P,Q>
68 using FT =
typename WordType<T>::Type_t;
72 using VecTraits = Chroma::QPhiXVecTraits::VecTraits<TT>;
75 using Geom =
typename QPhiX::Geometry<FT,VecTraits<FT>::Vec, VecTraits<FT>::Soa,
false>;
80 using Dsl =
typename QPhiX::Dslash<FT,VecTraits<FT>::Vec, VecTraits<FT>::Soa,
false>;
83 using Spinor =
typename Geom::FourSpinorBlock;
84 using Gauge =
typename Geom::SU3MatrixBlock;
94 #ifndef CHROMA_STATIC_PACKED_GAUGE
95 : packed_gauge{
nullptr,
nullptr}
105 QPhiXWilsonDslash(Handle< FermState<T,P,Q> >
state)
106 #ifndef CHROMA_STATIC_PACKED_GAUGE
107 : packed_gauge{
nullptr,
nullptr}
116 QPhiXWilsonDslash(Handle< FermState<T,P,Q> >
state,
117 const AnisoParam_t& aniso_)
118 #ifndef CHROMA_STATIC_PACKED_GAUGE
119 : packed_gauge{
nullptr,
nullptr}
122 create(
state,aniso_);
128 QPhiXWilsonDslash(Handle< FermState<T,P,Q> >
state,
129 const multi1d<Real>& coeffs_)
130 #ifndef CHROMA_STATIC_PACKED_GAUGE
131 : packed_gauge{
nullptr,
nullptr}
134 create(
state,coeffs_);
138 void create(Handle< FermState<T,P,Q> >
state)
140 multi1d<Real> cf(
Nd);
145 void create(Handle< FermState<T,P,Q> >
state,
146 const AnisoParam_t& aniso_) {
154 void create(Handle< FermState<T,P,Q> >
state,
const multi1d<Real>& coeffs_) {
159 fbc =
state->getFermBC();
163 if (fbc.operator->() == 0) {
164 QDPIO::cerr <<
"QPhiXWilsonDslash: error: fbc is null" << std::endl;
169 QPhiX::QPhiXCLIArgs& QPhiXParams = TheQPhiXParams::Instance();
173 if( theGeom ==
nullptr ) {
174 #ifdef DEBUG_QPHIX_DSLASH
175 QDPIO::cout <<
"Allocating Geometry" <<std::endl;
176 QDPIO::cout <<
" By="<< QPhiXParams.getBy() << std::endl;
177 QDPIO::cout <<
" Bz="<< QPhiXParams.getBz() << std::endl;
178 QDPIO::cout <<
" NCores="<< QPhiXParams.getNCores() << std::endl;
179 QDPIO::cout <<
" Sy="<< QPhiXParams.getSy() << std::endl;
180 QDPIO::cout <<
" Sz="<< QPhiXParams.getSz() << std::endl;
181 QDPIO::cout <<
" MinCt="<< QPhiXParams.getMinCt() << std::endl;
184 theGeom =
new Geom(Layout::subgridLattSize().slice(),
187 QPhiXParams.getNCores(),
190 0,0,QPhiXParams.getMinCt());
192 if (theGeom ==
nullptr) {
193 QDPIO::cerr <<
"Failed to allocate geometry. Aborting" <<std::endl;
198 if( theDslash ==
nullptr ) {
199 double aniso_fac_s = toDouble(coeffs_[0]);
200 double aniso_fac_t = toDouble(coeffs_[
Nd-1]);
201 double t_boundary = toDouble(1);
202 #ifdef DEBUG_QPHIX_DSLASH
203 QDPIO::cout <<
"Allocating Dslash: fac_s="<<aniso_fac_s<<
" fac_t="<<aniso_fac_t <<
" t_boundary="<<t_boundary <<std::endl;
205 theDslash =
new Dsl(theGeom,t_boundary,aniso_fac_s, aniso_fac_t);
206 if( theDslash ==
nullptr ) {
207 QDPIO::cerr <<
"Failed to allocate Dslash... Aborting " << std::endl;
212 if( packed_gauge[0] ==
nullptr) {
213 #ifdef DEBUG_QPHIX_DSLASH
214 QDPIO::cout <<
"Allocating packed gauge field (cb=0)" << std::endl;
217 packed_gauge[0] = (Gauge*)theGeom->allocCBGauge();
218 if( packed_gauge[0] ==
nullptr ) {
219 QDPIO::cerr <<
"Failed to allocate packed gauge_field(cb=0)" << std::endl;
224 if( packed_gauge[1] ==
nullptr) {
225 #ifdef DEBUG_QPHIX_DSLASH
226 QDPIO::cout <<
"Allocating packed gauge field (cb=1)" << std::endl;
228 packed_gauge[1] = (Gauge*)theGeom->allocCBGauge();
229 if( packed_gauge[0] ==
nullptr ) {
230 QDPIO::cerr <<
"Failed to allocate packed gauge_field(cb=1)" << std::endl;
235 const Q&
u =
state->getLinks();
236 #ifdef DEBUG_QPHIX_DSLASH
237 QDPIO::cout <<
"Packing Gauge Field" << std::endl;
239 QPhiX::qdp_pack_gauge<>(
u,packed_gauge[0],packed_gauge[1],(*theGeom));
244 ~QPhiXWilsonDslash() {
246 #ifndef CHROMA_STATIC_PACKED_GAUGE
249 theGeom->free(packed_gauge[0]); packed_gauge[0] =
nullptr;
250 theGeom->free(packed_gauge[1]); packed_gauge[1] =
nullptr;
271 int source_cb = 1 -
cb;
273 int qphix_isign = (
isign ==
PLUS) ? +1 : -1;
274 int cbsize_in_blocks = rb[0].numSiteTable()/VecTraits<FT>::Soa;
277 Spinor* chi_targ = (Spinor *)(
chi.getFjit())+target_cb*cbsize_in_blocks;
278 Spinor* psi_src = (Spinor *)(
psi.getFjit())+source_cb*cbsize_in_blocks;
279 theDslash->dslash(chi_targ,
281 packed_gauge[target_cb],
286 getFermBC().modifyF(
chi, QDP::rb[
cb]);
290 const FermBC<T,P,Q>& getFermBC()
const {
return *fbc;}
294 const multi1d<Real>& getCoeffs()
const {
return coeffs;}
297 multi1d<Real> coeffs;
298 Handle< FermBC<T,P,Q> > fbc;
302 static Geom *theGeom;
303 static Dsl *theDslash;
306 #ifdef CHROMA_STATIC_PACKED_GAUGE
307 static Gauge* packed_gauge[2];
309 Gauge* packed_gauge[2];
315 using QPhiXWilsonDslashFloating = QPhiXWilsonDslash<LatticeFermion,multi1d<LatticeColorMatrix>,multi1d<LatticeColorMatrix>>;
316 using QPhiXWilsonDslashF = QPhiXWilsonDslash<LatticeFermionF,multi1d<LatticeColorMatrixF>,multi1d<LatticeColorMatrixF>>;
317 using QPhiXWilsonDslashD = QPhiXWilsonDslash<LatticeFermionD,multi1d<LatticeColorMatrixD>,multi1d<LatticeColorMatrixD>>;
320 QPhiXWilsonDslashF::Geom* QPhiXWilsonDslashF::theGeom =
nullptr;
321 QPhiXWilsonDslashF::Dsl* QPhiXWilsonDslashF::theDslash =
nullptr;
323 #ifdef CHROMA_STATIC_PACKED_GAUGE
324 QPhiXWilsonDslashF::Gauge* QPhiXWilsonDslashF::packed_gauge[2] = {
nullptr,
nullptr };
327 QPhiXWilsonDslashD::Geom* QPhiXWilsonDslashD::theGeom =
nullptr;
328 QPhiXWilsonDslashD::Dsl* QPhiXWilsonDslashD::theDslash =
nullptr;
330 #ifdef CHROMA_STATIC_PACKED_GAUGE
331 QPhiXWilsonDslashD::Gauge* QPhiXWilsonDslashD::packed_gauge[2] = {
nullptr,
nullptr};
Wilson Dslash linear operator.
Asqtad Staggered-Dirac operator.
static multi1d< LatticeColorMatrix > u
multi1d< LatticeFermion > chi(Ncb)
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > state
multi1d< Real > makeFermCoeffs(const AnisoParam_t &aniso)
Make fermion coefficients.
Fermion action factories.
Support class for fermion actions and linear operators.
multi1d< LatticeColorMatrix > Q