mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
View introduced
This commit is contained in:
parent
3277bda130
commit
aead94e9a7
@ -255,8 +255,11 @@ 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[0]=z[0]; // force serial dependency to prevent optimise away
|
auto x_v = x.View();
|
||||||
y[4]=z[4];
|
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 stop=usecond();
|
||||||
double time = (stop-start)/Nloop*1000;
|
double time = (stop-start)/Nloop*1000;
|
||||||
@ -532,9 +535,11 @@ public:
|
|||||||
{
|
{
|
||||||
LatticeGaugeField Umu5d(FGrid);
|
LatticeGaugeField Umu5d(FGrid);
|
||||||
std::vector<LatticeColourMatrix> U(4,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 ss=0;ss<Umu.Grid()->oSites();ss++){
|
||||||
for(int s=0;s<Ls;s++){
|
for(int s=0;s<Ls;s++){
|
||||||
Umu5d[Ls*ss+s] = Umu[ss];
|
Umu5d_v[Ls*ss+s] = Umu_v[ss];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ref = Zero();
|
ref = Zero();
|
||||||
@ -583,9 +588,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
for(int c=0;c<num_cases;c++) {
|
for(int c=0;c<num_cases;c++) {
|
||||||
|
|
||||||
WilsonKernelsStatic::Comms = Cases[c].CommsOverlap;
|
WilsonKernelsStatic::Comms = Cases[c].CommsOverlap;
|
||||||
WilsonKernelsStatic::Opt = Cases[c].Opt;
|
WilsonKernelsStatic::Opt = Cases[c].Opt;
|
||||||
CartesianCommunicator::SetCommunicatorPolicy(Cases[c].CommsAsynch);
|
CartesianCommunicator::SetCommunicatorPolicy(Cases[c].CommsAsynch);
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "=================================================================================="<<std::endl;
|
std::cout<<GridLogMessage << "=================================================================================="<<std::endl;
|
||||||
|
@ -122,9 +122,13 @@ int main (int argc, char ** argv)
|
|||||||
// replicate across fifth dimension
|
// replicate across fifth dimension
|
||||||
LatticeGaugeField Umu5d(FGrid);
|
LatticeGaugeField Umu5d(FGrid);
|
||||||
std::vector<LatticeColourMatrix> U(4,FGrid);
|
std::vector<LatticeColourMatrix> U(4,FGrid);
|
||||||
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
|
{
|
||||||
for(int s=0;s<Ls;s++){
|
auto Umu5d_v = Umu5d.View();
|
||||||
Umu5d[Ls*ss+s] = Umu[ss];
|
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++){
|
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
|
// 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.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 =adj(U[mu])*src;
|
||||||
tmp =Cshift(tmp,mu+1,-1);
|
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;
|
ref = -0.5*ref;
|
||||||
|
@ -132,9 +132,11 @@ void benchDw(std::vector<int> & latt4, int Ls, int threads,int report )
|
|||||||
LatticeGaugeField Umu5d(FGrid);
|
LatticeGaugeField Umu5d(FGrid);
|
||||||
|
|
||||||
// replicate across fifth dimension
|
// 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 ss=0;ss<Umu.Grid()->oSites();ss++){
|
||||||
for(int s=0;s<Ls;s++){
|
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);
|
LatticeGaugeField Umu5d(FGrid);
|
||||||
|
|
||||||
// replicate across fifth dimension
|
// 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 ss=0;ss<Umu.Grid()->oSites();ss++){
|
||||||
for(int s=0;s<Ls;s++){
|
for(int s=0;s<Ls;s++){
|
||||||
Umu5d[Ls*ss+s] = Umu[ss];
|
Umu5d_v[Ls*ss+s] = Umu_v[ss];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +79,11 @@ int main (int argc, char ** argv)
|
|||||||
|
|
||||||
double start=usecond();
|
double start=usecond();
|
||||||
thread_loop( (int t=0;t<threads;t++),{
|
thread_loop( (int t=0;t<threads;t++),{
|
||||||
|
auto x_t = x[t].View();
|
||||||
sum[t] = x[t][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][ss];
|
sum[t] = sum[t]+x_t[ss];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stop[t]=usecond();
|
stop[t]=usecond();
|
||||||
|
@ -75,9 +75,12 @@ 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++){
|
||||||
|
auto x_v = x.View();
|
||||||
|
auto y_v = y.View();
|
||||||
|
auto z_v = z.View();
|
||||||
axpy(z,a,x,y);
|
axpy(z,a,x,y);
|
||||||
x[0]=z[0]; // serial loop dependence to prevent optimise
|
x_v[0]=z_v[0]; // serial loop dependence to prevent optimise
|
||||||
y[4]=z[4];
|
y_v[4]=z_v[4];
|
||||||
}
|
}
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
double time = (stop-start)/Nloop*1000;
|
double time = (stop-start)/Nloop*1000;
|
||||||
@ -111,9 +114,12 @@ 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++){
|
||||||
|
auto x_v = x.View();
|
||||||
|
auto y_v = y.View();
|
||||||
|
auto z_v = z.View();
|
||||||
z=a*x-y;
|
z=a*x-y;
|
||||||
x[0]=z[0]; // force serial dependency to prevent optimise away
|
x_v[0]=z_v[0]; // force serial dependency to prevent optimise away
|
||||||
y[4]=z[4];
|
y_v[4]=z_v[4];
|
||||||
}
|
}
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
double time = (stop-start)/Nloop*1000;
|
double time = (stop-start)/Nloop*1000;
|
||||||
@ -145,11 +151,12 @@ int main (int argc, char ** argv)
|
|||||||
LatticeVec y(&Grid);// random(pRNG,y);
|
LatticeVec y(&Grid);// random(pRNG,y);
|
||||||
RealD a=2.0;
|
RealD a=2.0;
|
||||||
|
|
||||||
|
|
||||||
double start=usecond();
|
double start=usecond();
|
||||||
for(int i=0;i<Nloop;i++){
|
for(int i=0;i<Nloop;i++){
|
||||||
|
auto x_v = x.View();
|
||||||
|
auto z_v = z.View();
|
||||||
z=a*x;
|
z=a*x;
|
||||||
x[0]=z[0]*2.0;
|
x_v[0]=z_v[0]*2.0;
|
||||||
}
|
}
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
double time = (stop-start)/Nloop*1000;
|
double time = (stop-start)/Nloop*1000;
|
||||||
@ -181,8 +188,9 @@ int main (int argc, char ** argv)
|
|||||||
Real nn;
|
Real nn;
|
||||||
double start=usecond();
|
double start=usecond();
|
||||||
for(int i=0;i<Nloop;i++){
|
for(int i=0;i<Nloop;i++){
|
||||||
|
auto x_v = x.View();
|
||||||
nn=norm2(x);
|
nn=norm2(x);
|
||||||
vsplat(x[0]._internal[0],nn);
|
vsplat(x_v[0]._internal[0],nn);
|
||||||
}
|
}
|
||||||
double stop=usecond();
|
double stop=usecond();
|
||||||
double time = (stop-start)/Nloop*1000;
|
double time = (stop-start)/Nloop*1000;
|
||||||
|
@ -108,14 +108,22 @@ 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.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 =adj(U[mu])*src;
|
||||||
tmp =Cshift(tmp,mu,-1);
|
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 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[ss]()(i)(j);
|
auto ref_v = ref.View();
|
||||||
ComplexF * res_p = (ComplexF *)&result[ss]()(i)(j);
|
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;
|
std::cout<<GridLogMessage << ss<< " "<<i<<" "<<j<<" "<< (*ref_p)<<" " <<(*res_p)<<std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,16 +169,25 @@ int main (int argc, char ** argv)
|
|||||||
ref = Zero();
|
ref = Zero();
|
||||||
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.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 =adj(U[mu])*src;
|
||||||
tmp =Cshift(tmp,mu,-1);
|
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]; ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user