mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	@@ -137,7 +137,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
 | 
			
		||||
  Eigen::MatrixXd mean(nVol, 4), stdDev(nVol, 4), rob(nVol, 4);
 | 
			
		||||
  Eigen::VectorXd avMean(4), avStdDev(4), avRob(4);
 | 
			
		||||
  double          n = BENCH_IO_NPASS;
 | 
			
		||||
  //  double          n = BENCH_IO_NPASS;
 | 
			
		||||
 | 
			
		||||
  stats(mean, stdDev, perf);
 | 
			
		||||
  stats(avMean, avStdDev, avPerf);
 | 
			
		||||
@@ -164,7 +164,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
                mean(volInd(l), gWrite), stdDev(volInd(l), gWrite));
 | 
			
		||||
  }
 | 
			
		||||
  MSG << std::endl;
 | 
			
		||||
  MSG << "Robustness of individual results, in \%. (rob = 100\% - std dev / mean)" << std::endl;
 | 
			
		||||
  MSG << "Robustness of individual results, in %. (rob = 100% - std dev / mean)" << std::endl;
 | 
			
		||||
  MSG << std::endl;
 | 
			
		||||
  grid_printf("%4s %12s %12s %12s %12s\n",
 | 
			
		||||
              "L", "std read", "std write", "Grid read", "Grid write");
 | 
			
		||||
@@ -185,7 +185,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
              avMean(sRead), avStdDev(sRead), avMean(sWrite), avStdDev(sWrite),
 | 
			
		||||
              avMean(gRead), avStdDev(gRead), avMean(gWrite), avStdDev(gWrite));
 | 
			
		||||
  MSG << std::endl;
 | 
			
		||||
  MSG << "Robustness of volume-averaged results, in \%. (rob = 100\% - std dev / mean)" << std::endl;
 | 
			
		||||
  MSG << "Robustness of volume-averaged results, in %. (rob = 100% - std dev / mean)" << std::endl;
 | 
			
		||||
  MSG << std::endl;
 | 
			
		||||
  grid_printf("%12s %12s %12s %12s\n",
 | 
			
		||||
              "std read", "std write", "Grid read", "Grid write");
 | 
			
		||||
 
 | 
			
		||||
@@ -142,7 +142,7 @@ public:
 | 
			
		||||
	  //	  bzero((void *)rbuf[d],lat*lat*lat*Ls*sizeof(HalfSpinColourVectorD));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	int ncomm;
 | 
			
		||||
	//	int ncomm;
 | 
			
		||||
	double dbytes;
 | 
			
		||||
 | 
			
		||||
        for(int dir=0;dir<8;dir++) {
 | 
			
		||||
@@ -290,7 +290,7 @@ public:
 | 
			
		||||
      LatticeSU4 z(&Grid); z=Zero();
 | 
			
		||||
      LatticeSU4 x(&Grid); x=Zero();
 | 
			
		||||
      LatticeSU4 y(&Grid); y=Zero();
 | 
			
		||||
      double a=2.0;
 | 
			
		||||
      //      double a=2.0;
 | 
			
		||||
 | 
			
		||||
      uint64_t Nloop=NLOOP;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ struct time_statistics{
 | 
			
		||||
 | 
			
		||||
void header(){
 | 
			
		||||
  std::cout <<GridLogMessage << " L  "<<"\t"<<" Ls  "<<"\t"
 | 
			
		||||
            <<std::setw(11)<<"bytes\t\t"<<"MB/s uni (err/min/max)"<<"\t\t"<<"MB/s bidi (err/min/max)"<<std::endl;
 | 
			
		||||
            <<std::setw(11)<<"bytes\t\t"<<"MB/s uni"<<"\t"<<"MB/s bidi"<<std::endl;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int main (int argc, char ** argv)
 | 
			
		||||
@@ -72,7 +72,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
 | 
			
		||||
  std::cout << GridLogMessage << "Number of iterations to average: "<< Nloop << std::endl;
 | 
			
		||||
  std::vector<double> t_time(Nloop);
 | 
			
		||||
  time_statistics timestat;
 | 
			
		||||
  //  time_statistics timestat;
 | 
			
		||||
 | 
			
		||||
  std::cout<<GridLogMessage << "===================================================================================================="<<std::endl;
 | 
			
		||||
  std::cout<<GridLogMessage << "= Benchmarking sequential halo exchange from host memory "<<std::endl;
 | 
			
		||||
 
 | 
			
		||||
@@ -126,19 +126,10 @@ int main (int argc, char ** argv)
 | 
			
		||||
  // Naive wilson implementation
 | 
			
		||||
  ////////////////////////////////////
 | 
			
		||||
  // replicate across fifth dimension
 | 
			
		||||
  LatticeGaugeFieldF Umu5d(FGrid);
 | 
			
		||||
  std::vector<LatticeColourMatrixF> U(4,FGrid);
 | 
			
		||||
  {
 | 
			
		||||
    autoView( Umu5d_v, Umu5d, CpuWrite);
 | 
			
		||||
    autoView( Umu_v  , Umu  , CpuRead);
 | 
			
		||||
    for(int ss=0;ss<Umu.Grid()->oSites();ss++){
 | 
			
		||||
      for(int s=0;s<Ls;s++){
 | 
			
		||||
	Umu5d_v[Ls*ss+s] = Umu_v[ss];
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  //  LatticeGaugeFieldF Umu5d(FGrid);
 | 
			
		||||
  std::vector<LatticeColourMatrixF> U(4,UGrid);
 | 
			
		||||
  for(int mu=0;mu<Nd;mu++){
 | 
			
		||||
    U[mu] = PeekIndex<LorentzIndex>(Umu5d,mu);
 | 
			
		||||
    U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
 | 
			
		||||
  }
 | 
			
		||||
  std::cout << GridLogMessage << "Setting up Cshift based reference " << std::endl;
 | 
			
		||||
 | 
			
		||||
@@ -147,10 +138,28 @@ int main (int argc, char ** argv)
 | 
			
		||||
    ref = Zero();
 | 
			
		||||
    for(int mu=0;mu<Nd;mu++){
 | 
			
		||||
 | 
			
		||||
      tmp = U[mu]*Cshift(src,mu+1,1);
 | 
			
		||||
      tmp = Cshift(src,mu+1,1);
 | 
			
		||||
      {
 | 
			
		||||
	autoView( tmp_v  , tmp  , CpuWrite);
 | 
			
		||||
	autoView( U_v  , U[mu]  , CpuRead);
 | 
			
		||||
	for(int ss=0;ss<U[mu].Grid()->oSites();ss++){
 | 
			
		||||
	  for(int s=0;s<Ls;s++){
 | 
			
		||||
	    tmp_v[Ls*ss+s] = U_v[ss]*tmp_v[Ls*ss+s];
 | 
			
		||||
	  }
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
      ref=ref + tmp - Gamma(Gmu[mu])*tmp;
 | 
			
		||||
 | 
			
		||||
      tmp =adj(U[mu])*src;
 | 
			
		||||
      {
 | 
			
		||||
	autoView( tmp_v  , tmp  , CpuWrite);
 | 
			
		||||
	autoView( U_v  , U[mu]  , CpuRead);
 | 
			
		||||
	autoView( src_v, src    , CpuRead);
 | 
			
		||||
	for(int ss=0;ss<U[mu].Grid()->oSites();ss++){
 | 
			
		||||
	  for(int s=0;s<Ls;s++){
 | 
			
		||||
	    tmp_v[Ls*ss+s] = adj(U_v[ss])*src_v[Ls*ss+s];
 | 
			
		||||
	  }
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
      tmp =Cshift(tmp,mu+1,-1);
 | 
			
		||||
      ref=ref + tmp + Gamma(Gmu[mu])*tmp;
 | 
			
		||||
    }
 | 
			
		||||
@@ -182,7 +191,7 @@ int main (int argc, char ** argv)
 | 
			
		||||
  std::cout << GridLogMessage<< "*****************************************************************" <<std::endl;
 | 
			
		||||
 | 
			
		||||
  DomainWallFermionF Dw(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
 | 
			
		||||
  int ncall =3000;
 | 
			
		||||
  int ncall =300;
 | 
			
		||||
 | 
			
		||||
  if (1) {
 | 
			
		||||
    FGrid->Barrier();
 | 
			
		||||
@@ -242,16 +251,30 @@ int main (int argc, char ** argv)
 | 
			
		||||
    for(int mu=0;mu<Nd;mu++){
 | 
			
		||||
 | 
			
		||||
      //    ref =  src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
 | 
			
		||||
      tmp = U[mu]*Cshift(src,mu+1,1);
 | 
			
		||||
      tmp = Cshift(src,mu+1,1);
 | 
			
		||||
      {
 | 
			
		||||
	autoView( ref_v, ref, CpuWrite);
 | 
			
		||||
	autoView( tmp_v, tmp, CpuRead);
 | 
			
		||||
	for(int i=0;i<ref_v.size();i++){
 | 
			
		||||
	  ref_v[i]+= tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]; ;
 | 
			
		||||
	autoView( U_v  , U[mu]  , CpuRead);
 | 
			
		||||
	for(int ss=0;ss<U[mu].Grid()->oSites();ss++){
 | 
			
		||||
	  for(int s=0;s<Ls;s++){
 | 
			
		||||
	    int i=s+Ls*ss;
 | 
			
		||||
	    ref_v[i]+= U_v[ss]*(tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]); ;
 | 
			
		||||
	  }
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      tmp =adj(U[mu])*src;
 | 
			
		||||
      
 | 
			
		||||
      {
 | 
			
		||||
	autoView( tmp_v  , tmp  , CpuWrite);
 | 
			
		||||
	autoView( U_v  , U[mu]  , CpuRead);
 | 
			
		||||
	autoView( src_v, src    , CpuRead);
 | 
			
		||||
	for(int ss=0;ss<U[mu].Grid()->oSites();ss++){
 | 
			
		||||
	  for(int s=0;s<Ls;s++){
 | 
			
		||||
	    tmp_v[Ls*ss+s] = adj(U_v[ss])*src_v[Ls*ss+s];
 | 
			
		||||
	  }
 | 
			
		||||
	}
 | 
			
		||||
      }
 | 
			
		||||
      //      tmp =adj(U[mu])*src;
 | 
			
		||||
      tmp =Cshift(tmp,mu+1,-1);
 | 
			
		||||
      {
 | 
			
		||||
	autoView( ref_v, ref, CpuWrite);
 | 
			
		||||
 
 | 
			
		||||
@@ -184,8 +184,10 @@ int main (int argc, char ** argv)
 | 
			
		||||
      
 | 
			
		||||
      double bytes=1.0*vol*Nvec*sizeof(Real);
 | 
			
		||||
      double flops=vol*Nvec*2;// mul,add
 | 
			
		||||
      std::cout<<GridLogMessage<<std::setprecision(3) << lat<<"\t\t"<<bytes<<"  \t\t"<<bytes/time<<"\t\t"<<flops/time<< "\t\t"<<(stop-start)/1000./1000.<< "\t\t " <<std::endl;
 | 
			
		||||
 | 
			
		||||
      std::cout<<GridLogMessage<<std::setprecision(3) << lat<<"\t\t"
 | 
			
		||||
	       <<bytes<<"  \t\t"<<bytes/time<<"\t\t"<<flops/time<< "\t\t"
 | 
			
		||||
	       <<(stop-start)/1000./1000.<< "\t\t " <<std::endl;
 | 
			
		||||
      assert(nn==nn);
 | 
			
		||||
  }    
 | 
			
		||||
 | 
			
		||||
  Grid_finalize();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user