1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00

Reworking CSHIFT and Stencil. Implementing Wilson and discovered rework is required

This commit is contained in:
Peter Boyle
2015-04-27 13:45:07 +01:00
parent 35cfef2129
commit 0b7d389258
11 changed files with 176 additions and 204 deletions

View File

@ -1,7 +1,6 @@
#include <Grid.h>
#include <parallelIO/GridNerscIO.h>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
@ -10,7 +9,7 @@ int main (int argc, char ** argv)
Grid_init(&argc,&argv);
std::vector<int> simd_layout({1,1,2,2});
std::vector<int> mpi_layout ({2,2,2,2});
std::vector<int> mpi_layout ({2,2,1,4});
std::vector<int> latt_size ({8,8,8,16});
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
@ -71,11 +70,11 @@ int main (int argc, char ** argv)
Fine.CoorFromIndex(peer,index,latt_size);
if (nrm > 0){
cout<<"FAIL shift "<< shift<<" in dir "<< dir<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] = "<< cm()()()<<" expect "<<scm<<" "<<nrm<<endl;
cout<<"Got "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
std::cerr<<"FAIL shift "<< shift<<" in dir "<< dir<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] = "<< cm()()()<<" expect "<<scm<<" "<<nrm<<std::endl;
std::cerr<<"Got "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
index=real(scm);
Fine.CoorFromIndex(peer,index,latt_size);
cout<<"Expect "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
std::cerr<<"Expect "<<index<<" " << peer[0]<<","<<peer[1]<<","<<peer[2]<<","<<peer[3]<<std::endl;
}
}}}}
}

View File

@ -116,8 +116,6 @@ int main (int argc, char ** argv)
// Insist that operations on random scalars gives
// identical results to on vectors.
Tester<RealD,vRealD>(funcPlus());
std::cout << "==================================="<< std::endl;
std::cout << "Testing vComplexF "<<std::endl;
std::cout << "==================================="<< std::endl;

View File

@ -9,7 +9,7 @@ class SimpleCompressor {
public:
void Point(int) {};
vobj operator() (vobj &arg) {
vobj operator() (const vobj &arg) {
return arg;
}
};

View File

@ -1,5 +1,4 @@
#include <Grid.h>
#include <parallelIO/GridNerscIO.h>
using namespace std;
using namespace Grid;
@ -10,13 +9,19 @@ struct scal {
d internal;
};
Gamma::GammaMatrix Gmu [] = {
Gamma::GammaX,
Gamma::GammaY,
Gamma::GammaZ,
Gamma::GammaT
};
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> simd_layout({1,1,2,2});
std::vector<int> mpi_layout ({1,1,1,1});
std::vector<int> mpi_layout ({2,1,1,2});
std::vector<int> latt_size ({8,8,8,8});
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
@ -29,19 +34,37 @@ int main (int argc, char ** argv)
LatticeFermion src(&Grid); random(pRNG,src);
LatticeFermion result(&Grid); result=zero;
LatticeFermion ref(&Grid); ref=zero;
LatticeFermion tmp(&Grid); tmp=zero;
LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid);
for(int mu=0;mu<Nd;mu++){
U[mu] = 1.0;
pokeIndex<3>(Umu,U[mu],mu);
// U[mu] = 1.0;
// pokeIndex<3>(Umu,U[mu],mu);
U[mu] = peekIndex<3>(Umu,mu);
}
{
int mu=0;
// ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x
ref = src;
ref = U[0]*Cshift(ref,0,1);
std::vector<int> mask({0,0,0,0,1,0,0,0});
{ // Naive wilson implementation
ref = zero;
for(int mu=0;mu<Nd;mu++){
// ref = src + Gamma(Gamma::GammaX)* src ; // 1-gamma_x
if( mask[mu] ) {
tmp = U[mu]*Cshift(src,mu,1);
for(int i=0;i<ref._odata.size();i++){
ref._odata[i]+= tmp._odata[i] + Gamma(Gmu[mu])*tmp._odata[i]; ;
}
}
if( mask[mu+4] ){
tmp =adj(U[mu])*src;
tmp =Cshift(tmp,mu,-1);
for(int i=0;i<ref._odata.size();i++){
ref._odata[i]+= tmp._odata[i] - Gamma(Gmu[mu])*tmp._odata[i]; ;
}
}
}
}
RealD mass=0.1;