1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-14 01:35:36 +00:00

Hide internals

This commit is contained in:
paboyle 2018-01-26 23:08:27 +00:00
parent 32523a229c
commit 2a4a0e43c1
7 changed files with 30 additions and 30 deletions

View File

@ -261,8 +261,8 @@ public:
double start=usecond(); double start=usecond();
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
z=a*x-y; z=a*x-y;
x._odata[0]=z._odata[0]; // force serial dependency to prevent optimise away x[0]=z[0]; // force serial dependency to prevent optimise away
y._odata[4]=z._odata[4]; y[4]=z[4];
} }
double stop=usecond(); double stop=usecond();
double time = (stop-start)/Nloop*1000; double time = (stop-start)/Nloop*1000;
@ -540,7 +540,7 @@ public:
std::vector<LatticeColourMatrix> U(4,FGrid); std::vector<LatticeColourMatrix> U(4,FGrid);
for(int ss=0;ss<Umu._grid->oSites();ss++){ for(int ss=0;ss<Umu._grid->oSites();ss++){
for(int s=0;s<Ls;s++){ for(int s=0;s<Ls;s++){
Umu5d._odata[Ls*ss+s] = Umu._odata[ss]; Umu5d[Ls*ss+s] = Umu[ss];
} }
} }
ref = zero; ref = zero;

View File

@ -124,7 +124,7 @@ int main (int argc, char ** argv)
std::vector<LatticeColourMatrix> U(4,FGrid); std::vector<LatticeColourMatrix> U(4,FGrid);
for(int ss=0;ss<Umu._grid->oSites();ss++){ for(int ss=0;ss<Umu._grid->oSites();ss++){
for(int s=0;s<Ls;s++){ for(int s=0;s<Ls;s++){
Umu5d._odata[Ls*ss+s] = Umu._odata[ss]; Umu5d[Ls*ss+s] = Umu[ss];
} }
} }
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
@ -412,14 +412,14 @@ int main (int argc, char ** argv)
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x // ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
tmp = U[mu]*Cshift(src,mu+1,1); tmp = U[mu]*Cshift(src,mu+1,1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] + Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
} }
tmp =adj(U[mu])*src; tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu+1,-1); tmp =Cshift(tmp,mu+1,-1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] - Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
} }
} }
ref = -0.5*ref; ref = -0.5*ref;

View File

@ -134,7 +134,7 @@ void benchDw(std::vector<int> & latt4, int Ls, int threads,int report )
// replicate across fifth dimension // replicate across fifth dimension
for(int ss=0;ss<Umu._grid->oSites();ss++){ for(int ss=0;ss<Umu._grid->oSites();ss++){
for(int s=0;s<Ls;s++){ for(int s=0;s<Ls;s++){
Umu5d._odata[Ls*ss+s] = Umu._odata[ss]; Umu5d[Ls*ss+s] = Umu[ss];
} }
} }
@ -274,7 +274,7 @@ void benchsDw(std::vector<int> & latt4, int Ls, int threads, int report )
// replicate across fifth dimension // replicate across fifth dimension
for(int ss=0;ss<Umu._grid->oSites();ss++){ for(int ss=0;ss<Umu._grid->oSites();ss++){
for(int s=0;s<Ls;s++){ for(int s=0;s<Ls;s++){
Umu5d._odata[Ls*ss+s] = Umu._odata[ss]; Umu5d[Ls*ss+s] = Umu[ss];
} }
} }

View File

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

View File

@ -76,8 +76,8 @@ int main (int argc, char ** argv)
double start=usecond(); double start=usecond();
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
axpy(z,a,x,y); axpy(z,a,x,y);
x._odata[0]=z._odata[0]; // serial loop dependence to prevent optimise x[0]=z[0]; // serial loop dependence to prevent optimise
y._odata[4]=z._odata[4]; y[4]=z[4];
} }
double stop=usecond(); double stop=usecond();
double time = (stop-start)/Nloop*1000; double time = (stop-start)/Nloop*1000;
@ -112,8 +112,8 @@ int main (int argc, char ** argv)
double start=usecond(); double start=usecond();
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
z=a*x-y; z=a*x-y;
x._odata[0]=z._odata[0]; // force serial dependency to prevent optimise away x[0]=z[0]; // force serial dependency to prevent optimise away
y._odata[4]=z._odata[4]; y[4]=z[4];
} }
double stop=usecond(); double stop=usecond();
double time = (stop-start)/Nloop*1000; double time = (stop-start)/Nloop*1000;
@ -149,7 +149,7 @@ int main (int argc, char ** argv)
double start=usecond(); double start=usecond();
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
z=a*x; z=a*x;
x._odata[0]=z._odata[0]*2.0; x[0]=z[0]*2.0;
} }
double stop=usecond(); double stop=usecond();
double time = (stop-start)/Nloop*1000; double time = (stop-start)/Nloop*1000;
@ -182,7 +182,7 @@ int main (int argc, char ** argv)
double start=usecond(); double start=usecond();
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
nn=norm2(x); nn=norm2(x);
vsplat(x._odata[0]._internal[0],nn); vsplat(x[0]._internal[0],nn);
} }
double stop=usecond(); double stop=usecond();
double time = (stop-start)/Nloop*1000; double time = (stop-start)/Nloop*1000;

View File

@ -95,13 +95,13 @@ int main (int argc, char ** argv)
// ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x // ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x
tmp = U[mu]*Cshift(src,mu,1); tmp = U[mu]*Cshift(src,mu,1);
for(int i=0;i<ref._odata.size();i++){ for(int i=0;i<ref._odata.size();i++){
ref._odata[i]+= tmp._odata[i] - Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
} }
tmp =adj(U[mu])*src; tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1); tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref._odata.size();i++){ for(int i=0;i<ref._odata.size();i++){
ref._odata[i]+= tmp._odata[i] + Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
} }
} }
} }

View File

@ -108,14 +108,14 @@ int main (int argc, char ** argv)
for(int mu=0;mu<Nd;mu++){ for(int mu=0;mu<Nd;mu++){
// ref = src + Gamma(Gamma::Algebra::GammaX)* src ; // 1-gamma_x // ref = src + Gamma(Gamma::Algebra::GammaX)* src ; // 1-gamma_x
tmp = U[mu]*Cshift(src,mu,1); tmp = U[mu]*Cshift(src,mu,1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] - Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
} }
tmp =adj(U[mu])*src; tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1); tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] + Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
} }
} }
} }
@ -148,8 +148,8 @@ int main (int argc, char ** argv)
for(int ss=0;ss<0;ss++ ){ for(int ss=0;ss<0;ss++ ){
for(int i=0;i<Ns;i++){ for(int i=0;i<Ns;i++){
for(int j=0;j<Nc;j++){ for(int j=0;j<Nc;j++){
ComplexF * ref_p = (ComplexF *)&ref._odata[ss]()(i)(j); ComplexF * ref_p = (ComplexF *)&ref[ss]()(i)(j);
ComplexF * res_p = (ComplexF *)&result._odata[ss]()(i)(j); ComplexF * res_p = (ComplexF *)&result[ss]()(i)(j);
std::cout<<GridLogMessage << ss<< " "<<i<<" "<<j<<" "<< (*ref_p)<<" " <<(*res_p)<<std::endl; std::cout<<GridLogMessage << ss<< " "<<i<<" "<<j<<" "<< (*ref_p)<<" " <<(*res_p)<<std::endl;
} }
} }
@ -161,14 +161,14 @@ int main (int argc, char ** argv)
// ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x // ref = src - Gamma(Gamma::Algebra::GammaX)* src ; // 1+gamma_x
tmp = U[mu]*Cshift(src,mu,1); tmp = U[mu]*Cshift(src,mu,1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] + Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] + Gamma(Gmu[mu])*tmp[i]; ;
} }
tmp =adj(U[mu])*src; tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1); tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref._odata_size;i++){ for(int i=0;i<ref.size();i++){
ref._odata[i]+= tmp._odata[i] - Gamma(Gmu[mu])*tmp._odata[i]; ; ref[i]+= tmp[i] - Gamma(Gmu[mu])*tmp[i]; ;
} }
} }
} }