#include namespace Grid { namespace QCD { // S-direction is INNERMOST and takes no part in the parity. const std::vector WilsonFermion5D::directions ({1,2,3,4, 1, 2, 3, 4}); const std::vector WilsonFermion5D::displacements({1,1,1,1,-1,-1,-1,-1}); int WilsonFermion5D::HandOptDslash; // 5d lattice for DWF. WilsonFermion5D::WilsonFermion5D(LatticeGaugeField &_Umu, GridCartesian &FiveDimGrid, GridRedBlackCartesian &FiveDimRedBlackGrid, GridCartesian &FourDimGrid, GridRedBlackCartesian &FourDimRedBlackGrid, RealD _M5) : _FiveDimGrid(&FiveDimGrid), _FiveDimRedBlackGrid(&FiveDimRedBlackGrid), _FourDimGrid(&FourDimGrid), _FourDimRedBlackGrid(&FourDimRedBlackGrid), Stencil (_FiveDimGrid,npoint,Even,directions,displacements), StencilEven(_FiveDimRedBlackGrid,npoint,Even,directions,displacements), // source is Even StencilOdd (_FiveDimRedBlackGrid,npoint,Odd ,directions,displacements), // source is Odd M5(_M5), Umu(_FourDimGrid), UmuEven(_FourDimRedBlackGrid), UmuOdd (_FourDimRedBlackGrid), Lebesgue(_FourDimGrid), LebesgueEvenOdd(_FourDimRedBlackGrid) { // some assertions assert(FiveDimGrid._ndimension==5); assert(FourDimGrid._ndimension==4); assert(FiveDimRedBlackGrid._ndimension==5); assert(FourDimRedBlackGrid._ndimension==4); assert(FiveDimRedBlackGrid._checker_dim==1); // Dimension zero of the five-d is the Ls direction Ls=FiveDimGrid._fdimensions[0]; assert(FiveDimRedBlackGrid._fdimensions[0]==Ls); assert(FiveDimRedBlackGrid._processors[0] ==1); assert(FiveDimRedBlackGrid._simd_layout[0]==1); assert(FiveDimGrid._processors[0] ==1); assert(FiveDimGrid._simd_layout[0] ==1); // Other dimensions must match the decomposition of the four-D fields for(int d=0;d<4;d++){ assert(FourDimRedBlackGrid._fdimensions[d] ==FourDimGrid._fdimensions[d]); assert(FiveDimRedBlackGrid._fdimensions[d+1]==FourDimGrid._fdimensions[d]); assert(FourDimRedBlackGrid._processors[d] ==FourDimGrid._processors[d]); assert(FiveDimRedBlackGrid._processors[d+1] ==FourDimGrid._processors[d]); assert(FourDimRedBlackGrid._simd_layout[d] ==FourDimGrid._simd_layout[d]); assert(FiveDimRedBlackGrid._simd_layout[d+1]==FourDimGrid._simd_layout[d]); assert(FiveDimGrid._fdimensions[d+1] ==FourDimGrid._fdimensions[d]); assert(FiveDimGrid._processors[d+1] ==FourDimGrid._processors[d]); assert(FiveDimGrid._simd_layout[d+1] ==FourDimGrid._simd_layout[d]); } // Allocate the required comms buffer comm_buf.resize(Stencil._unified_buffer_size); // this is always big enough to contain EO DoubleStore(Umu,_Umu); pickCheckerboard(Even,UmuEven,Umu); pickCheckerboard(Odd ,UmuOdd,Umu); } void WilsonFermion5D::DoubleStore(LatticeDoubledGaugeField &Uds,const LatticeGaugeField &Umu) { conformable(Uds._grid,GaugeGrid()); conformable(Umu._grid,GaugeGrid()); LatticeColourMatrix U(GaugeGrid()); for(int mu=0;mu(Umu,mu); pokeIndex(Uds,U,mu); U = adj(Cshift(U,mu,-1)); pokeIndex(Uds,U,mu+4); } } void WilsonFermion5D::DhopDir(const LatticeFermion &in, LatticeFermion &out,int dir,int disp) { assert( (disp==1)||(disp==-1) ); WilsonCompressor compressor(DaggerNo); Stencil.HaloExchange(in,comm_buf,compressor); int skip = (disp==1) ? 0 : 1; int dirdisp = dir+skip*4; PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ for(int s=0;s(in,comm_buf,compressor); // Dhop takes the 4d grid from U, and makes a 5d index for fermion // Not loop ordering and data layout. // Designed to create // - per thread reuse in L1 cache for U // - 8 linear access unit stride streams per thread for Fermion for hw prefetchable. if ( dag == DaggerYes ) { if( HandOptDslash ) { PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ for(int s=0;soSites();ss++){ for(int s=0;soSites();ss++){ for(int s=0;soSites();ss++){ for(int s=0;s