1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

View introduced

This commit is contained in:
paboyle 2018-03-04 16:39:29 +00:00
parent 3277bda130
commit aead94e9a7
6 changed files with 84 additions and 36 deletions

View File

@ -255,8 +255,11 @@ public:
double start=usecond();
for(int i=0;i<Nloop;i++){
z=a*x-y;
x[0]=z[0]; // force serial dependency to prevent optimise away
y[4]=z[4];
auto x_v = x.View();
auto y_v = y.View();
auto z_v = z.View();
x_v[0]=z_v[0]; // force serial dependency to prevent optimise away
y_v[4]=z_v[4];
}
double stop=usecond();
double time = (stop-start)/Nloop*1000;
@ -532,9 +535,11 @@ public:
{
LatticeGaugeField Umu5d(FGrid);
std::vector<LatticeColourMatrix> U(4,FGrid);
auto Umu_v = Umu.View();
auto Umu5d_v = Umu5d.View();
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d[Ls*ss+s] = Umu[ss];
Umu5d_v[Ls*ss+s] = Umu_v[ss];
}
}
ref = Zero();
@ -583,9 +588,9 @@ public:
};
for(int c=0;c<num_cases;c++) {
WilsonKernelsStatic::Comms = Cases[c].CommsOverlap;
WilsonKernelsStatic::Opt = Cases[c].Opt;
WilsonKernelsStatic::Comms = Cases[c].CommsOverlap;
WilsonKernelsStatic::Opt = Cases[c].Opt;
CartesianCommunicator::SetCommunicatorPolicy(Cases[c].CommsAsynch);
std::cout<<GridLogMessage << "=================================================================================="<<std::endl;

View File

@ -122,9 +122,13 @@ int main (int argc, char ** argv)
// replicate across fifth dimension
LatticeGaugeField Umu5d(FGrid);
std::vector<LatticeColourMatrix> U(4,FGrid);
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d[Ls*ss+s] = Umu[ss];
{
auto Umu5d_v = Umu5d.View();
auto Umu_v = Umu.View();
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d_v[Ls*ss+s] = Umu_v[ss];
}
}
}
for(int mu=0;mu<Nd;mu++){
@ -412,14 +416,22 @@ int main (int argc, char ** argv)
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
tmp = U[mu]*Cshift(src,mu+1,1);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu+1,-1);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] - Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
}
ref = -0.5*ref;

View File

@ -132,9 +132,11 @@ void benchDw(std::vector<int> & latt4, int Ls, int threads,int report )
LatticeGaugeField Umu5d(FGrid);
// replicate across fifth dimension
auto Umu5d_v = Umu5d.View();
auto Umu_v = Umu.View();
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d[Ls*ss+s] = Umu[ss];
Umu5d_v[Ls*ss+s] = Umu_v[ss];
}
}
@ -272,9 +274,11 @@ void benchsDw(std::vector<int> & latt4, int Ls, int threads, int report )
LatticeGaugeField Umu5d(FGrid);
// replicate across fifth dimension
auto Umu5d_v = Umu5d.View();
auto Umu_v = Umu.View();
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d[Ls*ss+s] = Umu[ss];
Umu5d_v[Ls*ss+s] = Umu_v[ss];
}
}

View File

@ -79,11 +79,11 @@ int main (int argc, char ** argv)
double start=usecond();
thread_loop( (int t=0;t<threads;t++),{
sum[t] = x[t][0];
auto x_t = x[t].View();
sum[t] = x_t[0];
for(int i=0;i<Nloop;i++){
for(auto ss=x[t].begin();ss<x[t].end();ss++){
sum[t] = sum[t]+x[t][ss];
for(auto ss=x_t.begin();ss<x_t.end();ss++){
sum[t] = sum[t]+x_t[ss];
}
}
stop[t]=usecond();

View File

@ -75,9 +75,12 @@ int main (int argc, char ** argv)
double start=usecond();
for(int i=0;i<Nloop;i++){
auto x_v = x.View();
auto y_v = y.View();
auto z_v = z.View();
axpy(z,a,x,y);
x[0]=z[0]; // serial loop dependence to prevent optimise
y[4]=z[4];
x_v[0]=z_v[0]; // serial loop dependence to prevent optimise
y_v[4]=z_v[4];
}
double stop=usecond();
double time = (stop-start)/Nloop*1000;
@ -111,9 +114,12 @@ int main (int argc, char ** argv)
double start=usecond();
for(int i=0;i<Nloop;i++){
auto x_v = x.View();
auto y_v = y.View();
auto z_v = z.View();
z=a*x-y;
x[0]=z[0]; // force serial dependency to prevent optimise away
y[4]=z[4];
x_v[0]=z_v[0]; // force serial dependency to prevent optimise away
y_v[4]=z_v[4];
}
double stop=usecond();
double time = (stop-start)/Nloop*1000;
@ -145,11 +151,12 @@ int main (int argc, char ** argv)
LatticeVec y(&Grid);// random(pRNG,y);
RealD a=2.0;
double start=usecond();
for(int i=0;i<Nloop;i++){
auto x_v = x.View();
auto z_v = z.View();
z=a*x;
x[0]=z[0]*2.0;
x_v[0]=z_v[0]*2.0;
}
double stop=usecond();
double time = (stop-start)/Nloop*1000;
@ -181,8 +188,9 @@ int main (int argc, char ** argv)
Real nn;
double start=usecond();
for(int i=0;i<Nloop;i++){
auto x_v = x.View();
nn=norm2(x);
vsplat(x[0]._internal[0],nn);
vsplat(x_v[0]._internal[0],nn);
}
double stop=usecond();
double time = (stop-start)/Nloop*1000;

View File

@ -108,14 +108,22 @@ 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);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] - Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
}
}
@ -148,8 +156,10 @@ int main (int argc, char ** argv)
for(int ss=0;ss<0;ss++ ){
for(int i=0;i<Ns;i++){
for(int j=0;j<Nc;j++){
ComplexF * ref_p = (ComplexF *)&ref[ss]()(i)(j);
ComplexF * res_p = (ComplexF *)&result[ss]()(i)(j);
auto ref_v = ref.View();
auto result_v = result.View();
ComplexF * ref_p = (ComplexF *)&ref_v[ss]()(i)(j);
ComplexF * res_p = (ComplexF *)&result_v[ss]()(i)(j);
std::cout<<GridLogMessage << ss<< " "<<i<<" "<<j<<" "<< (*ref_p)<<" " <<(*res_p)<<std::endl;
}
}
@ -159,16 +169,25 @@ int main (int argc, char ** argv)
ref = Zero();
for(int mu=0;mu<Nd;mu++){
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
tmp = U[mu]*Cshift(src,mu,1);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] + Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref.size();i++){
ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
{
auto ref_v = ref.View();
auto tmp_v = tmp.View();
for(int i=0;i<ref_v.size();i++){
ref_v[i]+= tmp_v[i] - Gamma(Gmu[mu])*tmp_v[i]; ;
}
}
}
}