mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Coordinate handling gpu friendly
This commit is contained in:
		@@ -79,7 +79,7 @@ void CayleyFermion5D<Impl>::DminusDag(const FermionField &psi, FermionField &chi
 | 
			
		||||
template<class Impl> void CayleyFermion5D<Impl>::CayleyReport(void)
 | 
			
		||||
{
 | 
			
		||||
  this->Report();
 | 
			
		||||
  std::vector<int> latt = GridDefaultLatt();          
 | 
			
		||||
  Coordinate latt = GridDefaultLatt();          
 | 
			
		||||
  RealD volume = this->Ls;  for(int mu=0;mu<Nd;mu++) volume=volume*latt[mu];
 | 
			
		||||
  RealD NP     = this->_FourDimGrid->_Nprocessors;
 | 
			
		||||
  if ( M5Dcalls > 0 ) {
 | 
			
		||||
 
 | 
			
		||||
@@ -374,7 +374,7 @@ public:
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    for (int lidx = 0; lidx < GaugeGrid->lSites(); lidx++) {
 | 
			
		||||
      std::vector<int> lcoor;
 | 
			
		||||
      Coordinate lcoor;
 | 
			
		||||
      GaugeGrid->LocalIndexToLocalCoor(lidx, lcoor);
 | 
			
		||||
      
 | 
			
		||||
      peekLocalSite(ScalarUmu, Umu, lcoor);
 | 
			
		||||
@@ -514,13 +514,12 @@ public:
 | 
			
		||||
    assert((distance == 1) || (distance == -1));  // nearest neighbour stencil hard code
 | 
			
		||||
    assert((sl == 1) || (sl == 2));
 | 
			
		||||
   
 | 
			
		||||
    std::vector<int> icoor;
 | 
			
		||||
        
 | 
			
		||||
    Coordinate icoor;
 | 
			
		||||
    if ( SE->_around_the_world && Params.twists[mmu] ) {
 | 
			
		||||
 | 
			
		||||
      if ( sl == 2 ) {
 | 
			
		||||
       
 | 
			
		||||
	std::vector<sobj> vals(Nsimd);
 | 
			
		||||
	ExtractBuffer<sobj> vals(Nsimd);
 | 
			
		||||
 | 
			
		||||
	extract(chi,vals);
 | 
			
		||||
	for(int s=0;s<Nsimd;s++){
 | 
			
		||||
@@ -905,7 +904,7 @@ public:
 | 
			
		||||
	SiteScalarGaugeLink   ScalarU;
 | 
			
		||||
	SiteDoubledGaugeField ScalarUds;
 | 
			
		||||
	  
 | 
			
		||||
	std::vector<int> lcoor;
 | 
			
		||||
	Coordinate lcoor;
 | 
			
		||||
	GaugeGrid->LocalIndexToLocalCoor(lidx, lcoor);
 | 
			
		||||
	peekLocalSite(ScalarUds, Uds, lcoor);
 | 
			
		||||
 | 
			
		||||
@@ -933,7 +932,7 @@ public:
 | 
			
		||||
	SiteScalarGaugeLink  ScalarU;
 | 
			
		||||
	SiteDoubledGaugeField ScalarUds;
 | 
			
		||||
	  
 | 
			
		||||
	std::vector<int> lcoor;
 | 
			
		||||
	Coordinate lcoor;
 | 
			
		||||
	GaugeGrid->LocalIndexToLocalCoor(lidx, lcoor);
 | 
			
		||||
      
 | 
			
		||||
	peekLocalSite(ScalarUds, UUUds, lcoor);
 | 
			
		||||
 
 | 
			
		||||
@@ -294,7 +294,7 @@ void ImprovedStaggeredFermion5D<Impl>::Dhop(const FermionField &in, FermionField
 | 
			
		||||
template<class Impl>
 | 
			
		||||
void ImprovedStaggeredFermion5D<Impl>::Report(void) 
 | 
			
		||||
{
 | 
			
		||||
  std::vector<int> latt = GridDefaultLatt();          
 | 
			
		||||
  Coordinate latt = GridDefaultLatt();          
 | 
			
		||||
  RealD volume = Ls;  for(int mu=0;mu<Nd;mu++) volume=volume*latt[mu];
 | 
			
		||||
  RealD NP = _FourDimGrid->_Nprocessors;
 | 
			
		||||
  RealD NN = _FourDimGrid->NodeCount();
 | 
			
		||||
 
 | 
			
		||||
@@ -150,7 +150,7 @@ void WilsonFermion<Impl>::MomentumSpacePropagator(FermionField &out, const Fermi
 | 
			
		||||
    Gamma::Algebra::GammaT
 | 
			
		||||
  };
 | 
			
		||||
  
 | 
			
		||||
  std::vector<int> latt_size   = _grid->_fdimensions;
 | 
			
		||||
  Coordinate latt_size   = _grid->_fdimensions;
 | 
			
		||||
  
 | 
			
		||||
  FermionField   num  (_grid); num  = Zero();
 | 
			
		||||
  LatComplex    wilson(_grid); wilson= Zero();
 | 
			
		||||
 
 | 
			
		||||
@@ -139,7 +139,7 @@ void WilsonFermion5D<Impl>::Report(void)
 | 
			
		||||
  RealD NP     = _FourDimGrid->_Nprocessors;
 | 
			
		||||
  RealD NN     = _FourDimGrid->NodeCount();
 | 
			
		||||
  RealD volume = Ls;  
 | 
			
		||||
  std::vector<int> latt = _FourDimGrid->GlobalDimensions();
 | 
			
		||||
  Coordinate latt = _FourDimGrid->GlobalDimensions();
 | 
			
		||||
  for(int mu=0;mu<Nd;mu++) volume=volume*latt[mu];
 | 
			
		||||
 | 
			
		||||
  if ( DhopCalls > 0 ) {
 | 
			
		||||
@@ -584,8 +584,7 @@ void WilsonFermion5D<Impl>::MomentumSpacePropagatorHt(FermionField &out,const Fe
 | 
			
		||||
    Gamma::Algebra::GammaT
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  std::vector<int> latt_size   = _grid->_fdimensions;
 | 
			
		||||
 | 
			
		||||
  Coordinate latt_size   = _grid->FullDimensions();
 | 
			
		||||
  
 | 
			
		||||
  FermionField   num  (_grid); num  = Zero();
 | 
			
		||||
 | 
			
		||||
@@ -626,7 +625,7 @@ void WilsonFermion5D<Impl>::MomentumSpacePropagatorHt(FermionField &out,const Fe
 | 
			
		||||
 | 
			
		||||
  // FIXME Need a Lattice acosh
 | 
			
		||||
  for(int idx=0;idx<_grid->lSites();idx++){
 | 
			
		||||
    std::vector<int> lcoor(Nd);
 | 
			
		||||
    Coordinate lcoor(Nd);
 | 
			
		||||
    Tcomplex cc;
 | 
			
		||||
    _grid->LocalIndexToLocalCoor(idx,lcoor);
 | 
			
		||||
    peekLocalSite(cc,cosha,lcoor);
 | 
			
		||||
@@ -663,7 +662,7 @@ void WilsonFermion5D<Impl>::MomentumSpacePropagatorHw(FermionField &out,const Fe
 | 
			
		||||
  typedef Lattice<iSinglet<vector_type> > LatComplex;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  std::vector<int> latt_size   = _grid->_fdimensions;
 | 
			
		||||
  Coordinate latt_size   = _grid->FullDimensions();
 | 
			
		||||
 | 
			
		||||
  LatComplex    sk(_grid);  sk = Zero();
 | 
			
		||||
  LatComplex    sk2(_grid); sk2= Zero();
 | 
			
		||||
@@ -714,7 +713,7 @@ void WilsonFermion5D<Impl>::MomentumSpacePropagatorHw(FermionField &out,const Fe
 | 
			
		||||
// Helper macro to reverse Simd vector. Fixme: slow, generic implementation.
 | 
			
		||||
#define REVERSE_LS(qSite, qSiteRev, Nsimd)				\
 | 
			
		||||
  {									\
 | 
			
		||||
    std::vector<typename SitePropagator::scalar_object> qSiteVec(Nsimd); \
 | 
			
		||||
    ExtractBuffer<typename SitePropagator::scalar_object> qSiteVec(Nsimd); \
 | 
			
		||||
    extract(qSite, qSiteVec);						\
 | 
			
		||||
    for (int i = 0; i < Nsimd / 2; ++i)					\
 | 
			
		||||
      {									\
 | 
			
		||||
 
 | 
			
		||||
@@ -102,8 +102,8 @@ void Photon<Gimpl>::invKHatSquared(GaugeLinkField &out)
 | 
			
		||||
  GridBase           *grid = out.Grid();
 | 
			
		||||
  GaugeLinkField     kmu(grid), one(grid);
 | 
			
		||||
  const unsigned int nd    = grid->_ndimension;
 | 
			
		||||
  std::vector<int>   &l    = grid->_fdimensions;
 | 
			
		||||
  std::vector<int>   zm(nd,0);
 | 
			
		||||
  Coordinate   &l    = grid->_fdimensions;
 | 
			
		||||
  Coordinate   zm(nd,0);
 | 
			
		||||
  TComplex           Tone = Complex(1.0,0.0);
 | 
			
		||||
  TComplex           Tzero= Complex(0.0,0.0);
 | 
			
		||||
    
 | 
			
		||||
@@ -132,7 +132,7 @@ void Photon<Gimpl>::zmSub(GaugeLinkField &out)
 | 
			
		||||
    {
 | 
			
		||||
    case ZmScheme::qedTL:
 | 
			
		||||
      {
 | 
			
		||||
        std::vector<int> zm(nd,0);
 | 
			
		||||
        Coordinate zm(nd,0);
 | 
			
		||||
        TComplex         Tzero = Complex(0.0,0.0);
 | 
			
		||||
        
 | 
			
		||||
        pokeSite(Tzero, out, zm);
 | 
			
		||||
@@ -177,7 +177,7 @@ void Photon<Gimpl>::StochasticWeight(GaugeLinkField &weight)
 | 
			
		||||
{
 | 
			
		||||
  auto               *grid     = dynamic_cast<GridCartesian *>(weight.Grid());
 | 
			
		||||
  const unsigned int nd        = grid->_ndimension;
 | 
			
		||||
  std::vector<int>   latt_size = grid->_fdimensions;
 | 
			
		||||
  Coordinate   latt_size = grid->_fdimensions;
 | 
			
		||||
    
 | 
			
		||||
  Integer vol = 1;
 | 
			
		||||
  for(int d = 0; d < nd; d++)
 | 
			
		||||
@@ -250,7 +250,7 @@ void Photon<Gimpl>::StochasticField(GaugeField &out, GridParallelRNG &rng,
 | 
			
		||||
//    typedef typename GaugeField::scalar_type ScalComplex;
 | 
			
		||||
//    typedef Lattice<iSinglet<vector_type> > LatComplex;
 | 
			
		||||
//    
 | 
			
		||||
//    std::vector<int> latt_size   = grid->_fdimensions;
 | 
			
		||||
//    Coordinate latt_size   = grid->_fdimensions;
 | 
			
		||||
//    
 | 
			
		||||
//    LatComplex denom(grid); denom= Zero();
 | 
			
		||||
//    LatComplex   one(grid); one = ScalComplex(1.0,0.0);
 | 
			
		||||
@@ -268,7 +268,7 @@ void Photon<Gimpl>::StochasticField(GaugeField &out, GridParallelRNG &rng,
 | 
			
		||||
//      
 | 
			
		||||
//      denom = denom + 4.0*sin(kmu*0.5)*sin(kmu*0.5); // Wilson term
 | 
			
		||||
//    }
 | 
			
		||||
//    std::vector<int> zero_mode(nd,0);
 | 
			
		||||
//    Coordinate zero_mode(nd,0);
 | 
			
		||||
//    TComplexD Tone = ComplexD(1.0,0.0);
 | 
			
		||||
//    TComplexD Tzero= ComplexD(0.0,0.0);
 | 
			
		||||
//    
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ public:
 | 
			
		||||
    GridBase           *grid = out.Grid();
 | 
			
		||||
    Field              kmu(grid), one(grid);
 | 
			
		||||
    const unsigned int nd    = grid->_ndimension;
 | 
			
		||||
    std::vector<int>   &l    = grid->_fdimensions;
 | 
			
		||||
    Coordinate         &l    = grid->_fdimensions;
 | 
			
		||||
      
 | 
			
		||||
    one = Complex(1.0,0.0);
 | 
			
		||||
    out = m*m;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user