1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-12 20:27:06 +01:00

Merge GPU support (upstream/develop) into distillation branch.

This compiles and looks right ... but may need some testing

* develop: (762 commits)
  Tensor ambiguous fix
  Fix for GCC preprocessor/pragma handling bug
  Trips up NVCC for reasons I dont understand on summit
  Fix GCC complaint
  Zero() change
  Force a couple of things to compile on NVCC
  Remove debug code
  nvcc error suppress
  Merge develop
  Reduction finished and hopefully fixes CI regression fail on single precisoin and force
  Double precision variants for summation accuracy
  Update todo list
  Freeze the seed
  Fix compiling of MSource::Gauss for single precision
  Think the reduction is now sorted and cleaned up
  Fix force term
  Printing improvement
  GPU reduction fix and also exit backtrace option
  GPU friendly
  Simplify the comms benchmark
  ...

# Conflicts:
#	Grid/communicator/SharedMemoryMPI.cc
#	Grid/qcd/action/fermion/WilsonKernelsAsm.cc
#	Grid/qcd/action/fermion/implementation/StaggeredKernelsAsm.h
#	Grid/qcd/smearing/StoutSmearing.h
#	Hadrons/Modules.hpp
#	Hadrons/Utilities/Contractor.cc
#	Hadrons/modules.inc
#	tests/forces/Test_dwf_force_eofa.cc
#	tests/forces/Test_dwf_gpforce_eofa.cc
This commit is contained in:
Michael Marshall
2019-09-13 13:30:00 +01:00
796 changed files with 41536 additions and 52391 deletions

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
@ -41,12 +41,12 @@ int main (int argc, char ** argv)
std::cout <<GridLogMessage<< " main "<<std::endl;
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
//std::vector<int> latt_size ({48,48,48,96});
//std::vector<int> latt_size ({32,32,32,32});
std::vector<int> latt_size ({16,16,16,32});
std::vector<int> clatt_size ({4,4,4,8});
Coordinate latt_size ({16,16,16,32});
Coordinate clatt_size ({4,4,4,8});
int orthodir=3;
int orthosz =latt_size[orthodir];

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
@ -40,9 +40,9 @@ int main (int argc, char ** argv)
Grid_init(&argc,&argv);
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
std::vector<int> latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
int orthodir=3;
int orthosz =latt_size[orthodir];
@ -64,7 +64,7 @@ int main (int argc, char ** argv)
// Painful ; fix syntactical niceness
LatticeComplex LinkTrace(&Fine);
LinkTrace=zero;
LinkTrace=Zero();
for(int mu=0;mu<Nd;mu++){
LinkTrace = LinkTrace + trace(U[mu]);
}
@ -72,7 +72,7 @@ int main (int argc, char ** argv)
// (1+2+3)=6 = N(N-1)/2 terms
LatticeComplex Plaq(&Fine);
Plaq = zero;
Plaq = Zero();
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
@ -89,7 +89,7 @@ int main (int argc, char ** argv)
int Nt = Plaq_T.size();
TComplex Plaq_T_sum;
Plaq_T_sum=zero;
Plaq_T_sum=Zero();
for(int t=0;t<Nt;t++){
Plaq_T_sum = Plaq_T_sum+Plaq_T[t];
Complex Pt=TensorRemove(Plaq_T[t]);

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
@ -40,19 +40,18 @@ int main (int argc, char ** argv)
std::cout <<GridLogMessage<< " main "<<std::endl;
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
//std::vector<int> latt_size ({48,48,48,96});
//std::vector<int> latt_size ({32,32,32,32});
std::vector<int> latt_size ({16,16,16,32});
std::vector<int> clatt_size ({4,4,4,8});
Coordinate latt_size ({16,16,16,32});
Coordinate clatt_size ({4,4,4,8});
int orthodir=3;
int orthosz =latt_size[orthodir];
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
GridCartesian Coarse(clatt_size,simd_layout,mpi_layout);
GridParallelRNG pRNGa(&Fine);
GridParallelRNG pRNGb(&Fine);
GridSerialRNG sRNGa;
@ -106,7 +105,7 @@ int main (int argc, char ** argv)
// Painful ; fix syntactical niceness
LatticeComplex LinkTrace(&Fine);
LinkTrace=zero;
LinkTrace=Zero();
for(int mu=0;mu<Nd;mu++){
LinkTrace = LinkTrace + trace(U[mu]);
}
@ -115,7 +114,7 @@ int main (int argc, char ** argv)
LatticeComplex Plaq(&Fine);
LatticeComplex cPlaq(&Coarse);
Plaq = zero;
Plaq = Zero();
#if 1
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
@ -131,7 +130,7 @@ int main (int argc, char ** argv)
int Nt = Plaq_T.size();
TComplex Plaq_T_sum;
Plaq_T_sum=zero;
Plaq_T_sum=Zero();
for(int t=0;t<Nt;t++){
Plaq_T_sum = Plaq_T_sum+Plaq_T[t];
Complex Pt=TensorRemove(Plaq_T[t]);

View File

@ -31,17 +31,14 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
std::vector<int> latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
int orthodir=3;
int orthosz =latt_size[orthodir];
@ -60,7 +57,7 @@ int main (int argc, char ** argv)
// Painful ; fix syntactical niceness
LatticeComplex LinkTrace(&Fine);
LinkTrace=zero;
LinkTrace=Zero();
for(int mu=0;mu<Nd;mu++){
LinkTrace = LinkTrace + trace(U[mu]);
}
@ -68,7 +65,7 @@ int main (int argc, char ** argv)
// (1+2+3)=6 = N(N-1)/2 terms
LatticeComplex Plaq(&Fine);
Plaq = zero;
Plaq = Zero();
#if 1
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
@ -85,7 +82,7 @@ int main (int argc, char ** argv)
int Nt = Plaq_T.size();
TComplex Plaq_T_sum;
Plaq_T_sum=zero;
Plaq_T_sum=Zero();
for(int t=0;t<Nt;t++){
Plaq_T_sum = Plaq_T_sum+Plaq_T[t];
Complex Pt=TensorRemove(Plaq_T[t]);

View File

@ -32,12 +32,12 @@ Author: Michael Marshall <michael.marshall@ed.ac.uk>
#include <typeinfo>
using namespace Grid;
using namespace Grid::QCD;
GRID_SERIALIZABLE_ENUM(myenum, undef, red, 1, blue, 2, green, 3);
class myclass: Serializable {
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(myclass,
myenum, e,
std::vector<myenum>, ve,
@ -47,8 +47,8 @@ public:
bool , b,
std::vector<double>, array,
std::vector<std::vector<double> >, twodimarray,
std::vector<std::vector<std::vector<Complex> > >, cmplx3darray,
SpinColourMatrix, scm
std::vector<std::vector<std::vector<Complex> > >, cmplx3darray,
SpinColourMatrix, scm
);
myclass() {}
myclass(int i)
@ -311,8 +311,8 @@ int main(int argc,char **argv)
ioTest<TextWriter, TextReader>("iotest.dat", obj, "text (object) ");
ioTest<TextWriter, TextReader>("iotest.dat", vec, "text (vector of objects)");
//// text
ioTest<JSONWriter, JSONReader>("iotest.json", obj, "JSON (object) ");
ioTest<JSONWriter, JSONReader>("iotest.json", vec, "JSON (vector of objects)");
// ioTest<JSONWriter, JSONReader>("iotest.json", obj, "JSON (object) ");
// ioTest<JSONWriter, JSONReader>("iotest.json", vec, "JSON (vector of objects)");
//// HDF5
#ifdef HAVE_HDF5

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -43,15 +43,6 @@ struct scal {
Gamma::Algebra::GammaT
};
typedef DomainWallFermion<DomainWallVec5dImplR> DomainWallVecFermionR;
typedef ZMobiusFermion<ZDomainWallVec5dImplR> ZMobiusVecFermionR;
typedef MobiusFermion<DomainWallVec5dImplR> MobiusVecFermionR;
typedef MobiusZolotarevFermion<DomainWallVec5dImplR> MobiusZolotarevVecFermionR;
typedef ScaledShamirFermion<DomainWallVec5dImplR> ScaledShamirVecFermionR;
typedef ShamirZolotarevFermion<DomainWallVec5dImplR> ShamirZolotarevVecFermionR;
typedef OverlapWilsonCayleyTanhFermion<DomainWallVec5dImplR> OverlapWilsonCayleyTanhVecFermionR;
typedef OverlapWilsonCayleyZolotarevFermion<DomainWallVec5dImplR> OverlapWilsonCayleyZolotarevVecFermionR;
template<class What>
void TestWhat(What & Ddwf,
GridCartesian * FGrid, GridRedBlackCartesian * FrbGrid,
@ -59,9 +50,6 @@ void TestWhat(What & Ddwf,
RealD mass, RealD M5,
GridParallelRNG *RNG4, GridParallelRNG *RNG5);
template<class This,class That>
void TestMoo(This & Dw, That &sDw);
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
@ -71,7 +59,7 @@ int main (int argc, char ** argv)
const int Ls=16;
std::vector<int> latt4 =GridDefaultLatt();
auto latt4 =GridDefaultLatt();
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(latt4, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
@ -101,11 +89,7 @@ int main (int argc, char ** argv)
std::cout<<GridLogMessage <<"DomainWallFermion vectorised test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
DomainWallVecFermionR sDdwf(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5);
TestMoo(Ddwf,sDdwf);
TestWhat<DomainWallFermionR>(Ddwf,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<DomainWallVecFermionR>(sDdwf,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
RealD b=1.5;// Scale factor b+c=2, b-c=1
RealD c=0.5;
@ -114,75 +98,53 @@ int main (int argc, char ** argv)
std::cout<<GridLogMessage <<"MobiusFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
MobiusFermionR Dmob(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c);
MobiusVecFermionR sDmob(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,b,c);
TestMoo(Dmob,sDmob);
TestWhat<MobiusFermionR>(Dmob,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<MobiusVecFermionR>(sDmob,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"Z-MobiusFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::vector<ComplexD> gamma(Ls,std::complex<double>(1.0,0.0));
ZMobiusFermionR zDmob(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,gamma,b,c);
ZMobiusVecFermionR szDmob(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,gamma,b,c);
TestMoo(zDmob,szDmob);
TestWhat<ZMobiusFermionR>(zDmob,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<ZMobiusVecFermionR>(szDmob,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"MobiusZolotarevFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
MobiusZolotarevFermionR Dzolo(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,b,c,0.1,2.0);
MobiusZolotarevVecFermionR sDzolo(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,b,c,0.1,2.0);
TestMoo(Dzolo,sDzolo);
TestWhat<MobiusZolotarevFermionR>(Dzolo,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<MobiusZolotarevVecFermionR>(sDzolo,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"ScaledShamirFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
ScaledShamirFermionR Dsham(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,2.0);
ScaledShamirVecFermionR sDsham(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,2.0);
TestMoo(Dsham,sDsham);
TestWhat<ScaledShamirFermionR>(Dsham,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<ScaledShamirVecFermionR>(sDsham,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"ShamirZolotarevFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
ShamirZolotarevFermionR Dshamz(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,0.1,2.0);
ShamirZolotarevVecFermionR sDshamz(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,0.1,2.0);
TestMoo(Dshamz,sDshamz);
TestWhat<ShamirZolotarevFermionR>(Dshamz,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<ShamirZolotarevVecFermionR>(sDshamz,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"OverlapWilsonCayleyTanhFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
OverlapWilsonCayleyTanhFermionR Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,1.0);
OverlapWilsonCayleyTanhVecFermionR sDov(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,1.0);
TestMoo(Dov,sDov);
TestWhat<OverlapWilsonCayleyTanhFermionR>(Dov,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<OverlapWilsonCayleyTanhVecFermionR>(sDov,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
std::cout<<GridLogMessage <<"OverlapWilsonCayleyZolotarevFermion test"<<std::endl;
std::cout<<GridLogMessage<<"**************************************************************"<<std::endl;
OverlapWilsonCayleyZolotarevFermionR Dovz(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,0.1,2.0);
OverlapWilsonCayleyZolotarevVecFermionR sDovz(Umu,*sFGrid,*sFrbGrid,*sUGrid,*sUrbGrid,mass,M5,0.1,2.0);
TestMoo(Dovz,sDovz);
TestWhat<OverlapWilsonCayleyZolotarevFermionR>(Dovz,FGrid,FrbGrid,UGrid,mass,M5,&RNG4,&RNG5);
TestWhat<OverlapWilsonCayleyZolotarevVecFermionR>(sDovz,sFGrid,sFrbGrid,sUGrid,mass,M5,&sRNG4,&sRNG5);
std::cout<<GridLogMessage<<"=============================================================="<<std::endl;
@ -201,10 +163,10 @@ void TestWhat(What & Ddwf,
LatticeFermion src (FGrid); random(*RNG5,src);
LatticeFermion phi (FGrid); random(*RNG5,phi);
LatticeFermion chi (FGrid); random(*RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeFermion src_e (FrbGrid);
LatticeFermion src_o (FrbGrid);
@ -324,150 +286,3 @@ void TestWhat(What & Ddwf,
}
template<class This,class That>
void TestMoo(This & Dw, That &sDw)
{
GridBase *sgrid= sDw.FermionGrid();
GridBase *ngrid= Dw.FermionGrid();
int Ls = Dw.Ls;
LatticeFermion ssrc(sgrid);
LatticeFermion nsrc(ngrid);
LatticeFermion zz(ngrid); zz=zero;
LatticeFermion sres(sgrid);
LatticeFermion nres(ngrid);
LatticeFermion ndiff(ngrid);
LatticeFermion sdiff(sgrid);
Gamma g5( Gamma::Algebra::Gamma5 );
std::vector<int> seeds({1,2,3,4,5,7,8});
GridParallelRNG RNG5(ngrid);
RNG5.SeedFixedIntegers(seeds);
random(RNG5,nsrc);
// nsrc = nsrc + g5*nsrc;
// Lattice<iScalar<vInteger> > coor(ngrid);
// LatticeCoordinate(coor,0);//scoor
// nsrc = where(coor==(Integer)0,zz,nsrc);
std::vector<int> latt4(4);
for(int d=0;d<4;d++){
latt4[d] = ngrid->_fdimensions[d+1];
}
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector tmp;
peekSite(tmp,nsrc,site);
pokeSite(tmp,ssrc,site);
}}}}}
sDw.Mooee(ssrc,sres);
Dw.Mooee(nsrc,nres);
sDw.MooeeInternal(ssrc,sdiff,DaggerNo,InverseNo);
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector stmp;
SpinColourVector itmp;
SpinColourVector dtmp;
peekSite(stmp,sres,site);
peekSite(itmp,sdiff,site);
dtmp=itmp-stmp;
if ( norm2(dtmp)>1.0e-6) {
std::cout<<GridLogMessage<<"=============================================================="<<std::endl;
std:: cout << x<<" "<<y<<" "<< z<< " "<<t<<"; s= "<<s<<std::endl;
std:: cout << "stmp "<< stmp <<std::endl;
std:: cout << "itmp "<< itmp <<std::endl;
std::cout<<GridLogMessage<<"=============================================================="<<std::endl;
}
}}}}}
sdiff = sdiff -sres;
std::cout<<GridLogMessage<<" norm MooInternal diff "<<norm2(sdiff)<<std::endl;
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector tmp;
peekSite(tmp,sres,site);
pokeSite(tmp,ndiff,site);
}}}}}
ndiff=ndiff-nres;
std::cout<<GridLogMessage<<" norm Moo diff "<<norm2(ndiff)<<std::endl;
sDw.MooeeDag(ssrc,sres);
Dw.MooeeDag(nsrc,nres);
sDw.MooeeInternal(ssrc,sdiff,DaggerYes,InverseNo);
sdiff = sdiff -sres;
std::cout<<GridLogMessage<<" norm MooInternalDag diff "<<norm2(sdiff)<<std::endl;
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector tmp;
peekSite(tmp,sres,site);
pokeSite(tmp,ndiff,site);
}}}}}
ndiff=ndiff-nres;
std::cout<<GridLogMessage<<" norm MooeeDag diff "<<norm2(ndiff)<<std::endl;
sDw.MooeeInv(ssrc,sres);
Dw.MooeeInv(nsrc,nres);
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector tmp;
peekSite(tmp,sres,site);
pokeSite(tmp,ndiff,site);
}}}}}
ndiff=ndiff-nres;
std::cout<<GridLogMessage<<" norm MooeeInv diff "<<norm2(ndiff)<<std::endl;
sDw.MooeeInvDag(ssrc,sres);
Dw.MooeeInvDag(nsrc,nres);
for(int x=0;x<latt4[0];x++){
for(int y=0;y<latt4[1];y++){
for(int z=0;z<latt4[2];z++){
for(int t=0;t<latt4[3];t++){
for(int s=0;s<Ls;s++){
std::vector<int> site({s,x,y,z,t});
SpinColourVector tmp;
peekSite(tmp,sres,site);
pokeSite(tmp,ndiff,site);
}}}}}
ndiff=ndiff-nres;
std::cout<<GridLogMessage<<" norm MooeeInvDag diff "<<norm2(ndiff)<<std::endl;
std::cout<<GridLogMessage<<"=============================================================="<<std::endl;
}

View File

@ -36,7 +36,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class Fobj,class CComplex,int nbasis>
class LocalCoherenceLanczosScidac : public LocalCoherenceLanczos<Fobj,CComplex,nbasis>
@ -59,7 +58,7 @@ public:
#ifdef HAVE_LIME
assert(this->subspace.size()==nbasis);
emptyUserRecord record;
Grid::QCD::ScidacWriter WR(this->_FineGrid->IsBoss());
Grid::ScidacWriter WR(this->_FineGrid->IsBoss());
WR.open(evecs_file);
for(int k=0;k<nbasis;k++) {
WR.writeScidacFieldRecord(this->subspace[k],record);
@ -87,7 +86,7 @@ public:
std::cout << GridLogIRL<< "checkpointFineRestore: Reading evecs from "<<evecs_file<<std::endl;
emptyUserRecord record;
Grid::QCD::ScidacReader RD ;
Grid::ScidacReader RD ;
RD.open(evecs_file);
for(int k=0;k<nbasis;k++) {
this->subspace[k].checkerboard=this->_checkerboard;
@ -105,7 +104,7 @@ public:
#ifdef HAVE_LIME
int n = this->evec_coarse.size();
emptyUserRecord record;
Grid::QCD::ScidacWriter WR(this->_CoarseGrid->IsBoss());
Grid::ScidacWriter WR(this->_CoarseGrid->IsBoss());
WR.open(evecs_file);
for(int k=0;k<n;k++) {
WR.writeScidacFieldRecord(this->evec_coarse[k],record);
@ -132,7 +131,7 @@ public:
assert(this->evals_coarse.size()==nvec);
emptyUserRecord record;
std::cout << GridLogIRL<< "checkpointCoarseRestore: Reading evecs from "<<evecs_file<<std::endl;
Grid::QCD::ScidacReader RD ;
Grid::ScidacReader RD ;
RD.open(evecs_file);
for(int k=0;k<nvec;k++) {
RD.readScidacFieldRecord(this->evec_coarse[k],record);
@ -169,7 +168,7 @@ int main (int argc, char ** argv) {
std::vector<int> blockSize = Params.blockSize;
std::vector<int> latt({32,32,32,32});
uint64_t vol = Ls*latt[0]*latt[1]*latt[2]*latt[3];
double mat_flop= 2.0*1320.0*vol;
// double mat_flop= 2.0*1320.0*vol;
// Grids
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(latt,
GridDefaultSimd(Nd,vComplex::Nsimd()),
@ -217,8 +216,8 @@ int main (int argc, char ** argv) {
LanczosParams fine =Params.FineParams;
LanczosParams coarse=Params.CoarseParams;
const int Ns1 = fine.Nstop; const int Ns2 = coarse.Nstop;
const int Nk1 = fine.Nk; const int Nk2 = coarse.Nk;
const int Ns1 = fine.Nstop; //const int Ns2 = coarse.Nstop;
const int Nk1 = fine.Nk; //const int Nk2 = coarse.Nk;
const int Nm1 = fine.Nm; const int Nm2 = coarse.Nm;
std::cout << GridLogMessage << "Keep " << fine.Nstop << " fine vectors" << std::endl;

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
@ -47,10 +47,9 @@ int main (int argc, char ** argv)
LatticeComplex ShiftU(&Fine);
LatticeComplex lex(&Fine);
lex=zero;
lex=Zero();
Integer stride =1;
{
double nrm;
LatticeComplex coor(&Fine);
for(int d=0;d<4;d++){
@ -79,7 +78,7 @@ int main (int argc, char ** argv)
ShiftU = Cshift(U,dir,shift); // Shift everything
std::vector<int> coor(4);
Coordinate coor(4);
for(coor[3]=0;coor[3]<latt_size[3];coor[3]++){
for(coor[2]=0;coor[2]<latt_size[2];coor[2]++){
@ -90,7 +89,7 @@ int main (int argc, char ** argv)
double nrm=norm2(U);
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
Integer slex = scoor[0]
@ -101,7 +100,7 @@ int main (int argc, char ** argv)
Complex scm(slex);
nrm = abs(scm-cm()()());
std::vector<int> peer(4);
Coordinate peer(4);
Complex tmp =cm;
Integer index=real(tmp);
Lexicographic::CoorFromIndex(peer,index,latt_size);

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -67,7 +67,7 @@ int main (int argc, char ** argv)
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
LatticeFermionD src(FGrid); random(RNG5,src);
LatticeFermionD result(FGrid); result=zero;
LatticeFermionD result(FGrid); result=Zero();
LatticeGaugeFieldD Umu(UGrid);
LatticeGaugeFieldF Umu_f(UGrid_f);
@ -84,10 +84,10 @@ int main (int argc, char ** argv)
LatticeFermionD result_o(FrbGrid);
LatticeFermionD result_o_2(FrbGrid);
pickCheckerboard(Odd,src_o,src);
result_o.checkerboard = Odd;
result_o = zero;
result_o_2.checkerboard = Odd;
result_o_2 = zero;
result_o.Checkerboard() = Odd;
result_o = Zero();
result_o_2.Checkerboard() = Odd;
result_o_2 = Zero();
SchurDiagMooeeOperator<DomainWallFermionD,LatticeFermionD> HermOpEO(Ddwf);
SchurDiagMooeeOperator<DomainWallFermionF,LatticeFermionF> HermOpEO_f(Ddwf_f);
@ -131,6 +131,6 @@ int main (int argc, char ** argv)
}
#endif
Grid_finalize();
}

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -65,7 +65,7 @@ int main (int argc, char ** argv)
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
LatticeFermionD src(FGrid); random(RNG5,src);
LatticeFermionD result(FGrid); result=zero;
LatticeFermionD result(FGrid); result=Zero();
LatticeGaugeFieldD Umu(UGrid);
LatticeGaugeFieldF Umu_f(UGrid_f);
@ -82,8 +82,8 @@ int main (int argc, char ** argv)
LatticeFermionD src_o(FrbGrid);
LatticeFermionD result_cg(FrbGrid);
pickCheckerboard(Odd,src_o,src);
result_cg.checkerboard = Odd;
result_cg = zero;
result_cg.Checkerboard() = Odd;
result_cg = Zero();
LatticeFermionD result_mcg(result_cg);
LatticeFermionD result_rlcg(result_cg);

View File

@ -0,0 +1,162 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./tests/Test_stencil.cc
Copyright (C) 2015
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
Author: Peter Boyle <peterboyle@Peters-MacBook-Pro-2.local>
Author: paboyle <paboyle@ph.ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/Grid.h>
#include <Grid/stencil/GeneralLocalStencil.h>
using namespace std;
using namespace Grid;
int main(int argc, char ** argv)
{
Grid_init(&argc, &argv);
// typedef LatticeColourMatrix Field;
typedef LatticeComplex Field;
typedef typename Field::vector_object vobj;
typedef typename vobj::scalar_object sobj;
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
double volume = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian rbFine(&Fine);
GridParallelRNG fRNG(&Fine);
// fRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
std::vector<int> seeds({1,2,3,4});
fRNG.SeedFixedIntegers(seeds);
Field Foo(&Fine);
Field Bar(&Fine);
Field Check(&Fine);
Field Diff(&Fine);
LatticeComplex lex(&Fine);
lex = Zero();
random(fRNG,Foo);
gaussian(fRNG,Bar);
for (int i=0;i<simd_layout.size();i++){
std::cout <<" simd layout "<<i<<" = "<<simd_layout[i]<<std::endl;
}
Integer stride =1000;
{
LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){
LatticeCoordinate(coor,d);
lex = lex + coor*stride;
stride=stride/10;
}
Foo=lex;
}
typedef GeneralLocalStencil GeneralStencil;
for(int dir1=0;dir1<4;dir1++){
for(int dir2=0;dir2<4;dir2++){
if ( dir2!= dir1){
for(int disp1=0;disp1<Fine._fdimensions[dir1];disp1++){
for(int disp2=0;disp2<Fine._fdimensions[dir2];disp2++){
std::cout<< std::fixed <<GridLogMessage << "Using stencil to shift dim "<<dir1<< " by "<<disp1<<std::endl;
std::cout<< std::fixed <<GridLogMessage << " and dim "<<dir2<< " by "<<disp2<<std::endl;
// start to test the Cartesian npoint stencil infrastructure
int npoint=1;
Coordinate shift(Nd);
for(int d=0;d<Nd;d++) shift[d]=0;
shift[dir1]=disp1;
shift[dir2]=disp2;
std::vector<Coordinate> shifts(npoint,shift);
GeneralLocalStencil gStencil(&Fine,shifts);
Bar = Cshift(Foo,dir1,disp1);
Bar = Cshift(Bar,dir2,disp2);
// Implement a stencil code that should agree with cshift!
for(int i=0;i<Check.Grid()->oSites();i++){
auto SE = gStencil.GetEntry(0,i);
auto check = Check.View();
auto foo = Foo.View();
// Encapsulate in a general wrapper
check[i] = foo[SE->_offset]; auto tmp=check[i];
if (SE->_permute & 0x1 ) { permute(check[i],tmp,0); tmp=check[i];}
if (SE->_permute & 0x2 ) { permute(check[i],tmp,1); tmp=check[i];}
if (SE->_permute & 0x4 ) { permute(check[i],tmp,2); tmp=check[i];}
if (SE->_permute & 0x8 ) { permute(check[i],tmp,3); tmp=check[i];}
}
Real nrmC = norm2(Check);
Real nrmB = norm2(Bar);
Diff = Check-Bar;
Real nrm = norm2(Diff);
std::cout<<GridLogMessage<<"N2diff ="<<nrm<<" "<<nrmC<<" " <<nrmB<<std::endl;
Coordinate coor(4);
for(coor[3]=0;coor[3]<latt_size[3]/mpi_layout[3];coor[3]++){
for(coor[2]=0;coor[2]<latt_size[2]/mpi_layout[2];coor[2]++){
for(coor[1]=0;coor[1]<latt_size[1]/mpi_layout[1];coor[1]++){
for(coor[0]=0;coor[0]<latt_size[0]/mpi_layout[0];coor[0]++){
RealD diff;
sobj check,bar;
peekSite(check,Check,coor);
peekSite(bar,Bar,coor);
sobj ddiff;
ddiff = check -bar;
diff =norm2(ddiff);
if ( diff > 0){
std::cout <<"Coor (" << coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]
<<") " <<check<<" vs "<<bar<<std::endl;
}
}}}}
if (nrm > 1.0e-4) {
auto check = Check.View();
auto bar = Bar.View();
for(int i=0;i<check.size();i++){
std::cout << i<<" Check "<<check[i]<< "\n"<<i<<" Bar "<<bar[i]<<std::endl;
}
}
if (nrm > 1.0e-4) exit(-1);
}}
}
}}
Grid_finalize();
}

View File

@ -28,9 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
/* END LEGAL */
#include <Grid/Grid.h>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
class funcPlus {
public:
@ -106,7 +104,7 @@ public:
// norm2,
// Reduce,
//
// mac,mult,sub,add, vone,vzero,vcomplex_i, =zero,
// mac,mult,sub,add, vone,vzero,vcomplex_i, =Zero(),
// vset,vsplat,vstore,vstream,vload, scalar*vec, vec*scalar
// unary -,
// *= , -=, +=
@ -129,10 +127,10 @@ void Tester(const functor &func)
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
std::vector<scal> result(Nsimd);
std::vector<scal> reference(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
ExtractBuffer<scal> result(Nsimd);
ExtractBuffer<scal> reference(Nsimd);
std::vector<vec,alignedAllocator<vec> > buf(3);
vec & v_input1 = buf[0];
@ -186,10 +184,10 @@ void IntTester(const functor &func)
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
std::vector<scal> result(Nsimd);
std::vector<scal> reference(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
ExtractBuffer<scal> result(Nsimd);
ExtractBuffer<scal> reference(Nsimd);
std::vector<vec,alignedAllocator<vec> > buf(3);
vec & v_input1 = buf[0];
@ -244,8 +242,8 @@ void ReductionTester(const functor &func)
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
reduced result(0);
reduced reference(0);
reduced tmp;
@ -290,8 +288,8 @@ void IntReductionTester(const functor &func)
{
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
reduced result(0);
reduced reference(0);
reduced tmp;
@ -335,7 +333,7 @@ public:
int n;
funcPermute(int _n) { n=_n;};
template<class vec> void operator()(vec &rr,vec &i1,vec &i2) const { permute(rr,i1,n);}
template<class scal> void apply(std::vector<scal> &rr,std::vector<scal> &in) const {
template<class scal> void apply(ExtractBuffer<scal> &rr,ExtractBuffer<scal> &in) const {
int sz=in.size();
int msk = sz>>(n+1);
for(int i=0;i<sz;i++){
@ -350,10 +348,10 @@ public:
int n;
funcExchange(int _n) { n=_n;};
template<class vec> void operator()(vec &r1,vec &r2,vec &i1,vec &i2) const { exchange(r1,r2,i1,i2,n);}
template<class scal> void apply(std::vector<scal> &r1,
std::vector<scal> &r2,
std::vector<scal> &in1,
std::vector<scal> &in2) const
template<class scal> void apply(ExtractBuffer<scal> &r1,
ExtractBuffer<scal> &r2,
ExtractBuffer<scal> &in1,
ExtractBuffer<scal> &in2) const
{
int sz=in1.size();
int msk = sz>>(n+1);
@ -376,7 +374,7 @@ public:
int n;
funcRotate(int _n) { n=_n;};
template<class vec> void operator()(vec &rr,vec &i1,vec &i2) const { rr=rotate(i1,n);}
template<class scal> void apply(std::vector<scal> &rr,std::vector<scal> &in) const {
template<class scal> void apply(ExtractBuffer<scal> &rr,ExtractBuffer<scal> &in) const {
int sz = in.size();
for(int i=0;i<sz;i++){
rr[i] = in[(i+n)%sz];
@ -394,10 +392,10 @@ void PermTester(const functor &func)
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
std::vector<scal> result(Nsimd);
std::vector<scal> reference(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
ExtractBuffer<scal> result(Nsimd);
ExtractBuffer<scal> reference(Nsimd);
std::vector<vec,alignedAllocator<vec> > buf(3);
vec & v_input1 = buf[0];
@ -460,14 +458,14 @@ void ExchangeTester(const functor &func)
int Nsimd = vec::Nsimd();
std::vector<scal> input1(Nsimd);
std::vector<scal> input2(Nsimd);
std::vector<scal> result1(Nsimd);
std::vector<scal> result2(Nsimd);
std::vector<scal> reference1(Nsimd);
std::vector<scal> reference2(Nsimd);
std::vector<scal> test1(Nsimd);
std::vector<scal> test2(Nsimd);
ExtractBuffer<scal> input1(Nsimd);
ExtractBuffer<scal> input2(Nsimd);
ExtractBuffer<scal> result1(Nsimd);
ExtractBuffer<scal> result2(Nsimd);
ExtractBuffer<scal> reference1(Nsimd);
ExtractBuffer<scal> reference2(Nsimd);
ExtractBuffer<scal> test1(Nsimd);
ExtractBuffer<scal> test2(Nsimd);
std::vector<vec,alignedAllocator<vec> > buf(6);
vec & v_input1 = buf[0];
@ -513,6 +511,7 @@ void ExchangeTester(const functor &func)
}
}
// assert(found==1);
assert(found==1||found==0);
}
for(int i=0;i<Nsimd;i++){
int found=0;
@ -523,6 +522,7 @@ void ExchangeTester(const functor &func)
}
}
// assert(found==1);
assert(found==1||found==0);
}
/*
@ -547,9 +547,25 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
{
std::cout << " Constructing Test({1,2,3,4,5,6}) " << std::endl;
Coordinate Test({1,2,3,4,5,6});
std::cout << " Test({1,2,3,4,5,6}) = " << Test <<std::endl;
}
/*
{
Coordinate Test = {1,2,3,4} ;
std::cout << " Test = {1,2,3,4} " << Test <<std::endl;
}
{
Coordinate Test {1,2,3,4};
std::cout << " Test {1,2,3,4} " << Test <<std::endl;
}
*/
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
std::vector<int> seeds({1,2,3,4});

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main(int argc, char ** argv) {
Grid_init(&argc, &argv);
@ -41,9 +41,9 @@ int main(int argc, char ** argv) {
typedef typename Field::vector_object vobj;
typedef typename vobj::scalar_object sobj;
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
double volume = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
@ -61,7 +61,7 @@ int main(int argc, char ** argv) {
Field Diff(&Fine);
LatticeComplex lex(&Fine);
lex = zero;
lex = Zero();
random(fRNG,Foo);
gaussian(fRNG,Bar);
@ -70,7 +70,6 @@ int main(int argc, char ** argv) {
}
Integer stride =1000;
{
double nrm;
LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){
@ -81,7 +80,7 @@ int main(int argc, char ** argv) {
Foo=lex;
}
typedef CartesianStencil<vobj,vobj> Stencil;
typedef CartesianStencil<vobj,vobj,int> Stencil;
for(int dir=0;dir<4;dir++){
for(int disp=0;disp<Fine._fdimensions[dir];disp++){
@ -91,8 +90,8 @@ int main(int argc, char ** argv) {
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
Stencil myStencil(&Fine,npoint,0,directions,displacements);
std::vector<int> ocoor(4);
Stencil myStencil(&Fine,npoint,0,directions,displacements,0);
Coordinate ocoor(4);
for(int o=0;o<Fine.oSites();o++){
Fine.oCoorFromOindex(ocoor,o);
ocoor[dir]=(ocoor[dir]+disp)%Fine._rdimensions[dir];
@ -104,20 +103,22 @@ int main(int argc, char ** argv) {
Bar = Cshift(Foo,dir,disp);
// Implement a stencil code that should agree with cshift!
for(int i=0;i<Check._grid->oSites();i++){
for(int i=0;i<Check.Grid()->oSites();i++){
int permute_type;
StencilEntry *SE;
SE = myStencil.GetEntry(permute_type,0,i);
auto check = Check.View();
auto foo = Foo.View();
if ( SE->_is_local && SE->_permute )
permute(Check._odata[i],Foo._odata[SE->_offset],permute_type);
permute(check[i],foo[SE->_offset],permute_type);
else if (SE->_is_local)
Check._odata[i] = Foo._odata[SE->_offset];
check[i] = foo[SE->_offset];
else {
Check._odata[i] = myStencil.CommBuf()[SE->_offset];
// std::cout << " receive "<<i<<" " << Check._odata[i]<<std::endl;
// std::cout << " Foo "<<i<<" " << Foo._odata[i]<<std::endl;
check[i] = myStencil.CommBuf()[SE->_offset];
// std::cout << " receive "<<i<<" " << Check[i]<<std::endl;
// std::cout << " Foo "<<i<<" " << Foo[i]<<std::endl;
}
}
@ -127,7 +128,7 @@ int main(int argc, char ** argv) {
Real nrm = norm2(Diff);
std::cout<<GridLogMessage<<"N2diff ="<<nrm<<" "<<nrmC<<" " <<nrmB<<std::endl;
std::vector<int> coor(4);
Coordinate coor(4);
for(coor[3]=0;coor[3]<latt_size[3]/mpi_layout[3];coor[3]++){
for(coor[2]=0;coor[2]<latt_size[2]/mpi_layout[2];coor[2]++){
for(coor[1]=0;coor[1]<latt_size[1]/mpi_layout[1];coor[1]++){
@ -150,8 +151,10 @@ int main(int argc, char ** argv) {
}}}}
if (nrm > 1.0e-4) {
for(int i=0;i<Check._odata.size();i++){
std::cout << i<<" Check.odata "<<Check._odata[i]<< "\n"<<i<<" Bar.odata "<<Bar._odata[i]<<std::endl;
auto check = Check.View();
auto bar = Bar.View();
for(int i=0;i<check.size();i++){
std::cout << i<<" Check "<<check[i]<< "\n"<<i<<" Bar "<<bar[i]<<std::endl;
}
}
if (nrm > 1.0e-4) exit(-1);
@ -178,10 +181,10 @@ int main(int argc, char ** argv) {
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
Stencil EStencil(&rbFine,npoint,Even,directions,displacements);
Stencil OStencil(&rbFine,npoint,Odd,directions,displacements);
Stencil EStencil(&rbFine,npoint,Even,directions,displacements,0);
Stencil OStencil(&rbFine,npoint,Odd,directions,displacements,0);
std::vector<int> ocoor(4);
Coordinate ocoor(4);
for(int o=0;o<Fine.oSites();o++){
Fine.oCoorFromOindex(ocoor,o);
ocoor[dir]=(ocoor[dir]+disp)%Fine._rdimensions[dir];
@ -192,41 +195,45 @@ int main(int argc, char ** argv) {
Bar = Cshift(Foo,dir,disp);
if ( disp & 0x1 ) {
ECheck.checkerboard = Even;
OCheck.checkerboard = Odd;
ECheck.Checkerboard() = Even;
OCheck.Checkerboard() = Odd;
} else {
ECheck.checkerboard = Odd;
OCheck.checkerboard = Even;
ECheck.Checkerboard() = Odd;
OCheck.Checkerboard() = Even;
}
// Implement a stencil code that should agree with that darn cshift!
EStencil.HaloExchange(EFoo,compress);
for(int i=0;i<OCheck._grid->oSites();i++){
for(int i=0;i<OCheck.Grid()->oSites();i++){
int permute_type;
StencilEntry *SE;
SE = EStencil.GetEntry(permute_type,0,i);
// std::cout << "Even source "<< i<<" -> " <<SE->_offset << " "<< SE->_is_local<<std::endl;
auto ocheck = OCheck.View();
auto efoo = EFoo.View();
if ( SE->_is_local && SE->_permute )
permute(OCheck._odata[i],EFoo._odata[SE->_offset],permute_type);
permute(ocheck[i],efoo[SE->_offset],permute_type);
else if (SE->_is_local)
OCheck._odata[i] = EFoo._odata[SE->_offset];
ocheck[i] = efoo[SE->_offset];
else
OCheck._odata[i] = EStencil.CommBuf()[SE->_offset];
ocheck[i] = EStencil.CommBuf()[SE->_offset];
}
OStencil.HaloExchange(OFoo,compress);
for(int i=0;i<ECheck._grid->oSites();i++){
for(int i=0;i<ECheck.Grid()->oSites();i++){
int permute_type;
StencilEntry *SE;
SE = OStencil.GetEntry(permute_type,0,i);
// std::cout << "ODD source "<< i<<" -> " <<SE->_offset << " "<< SE->_is_local<<std::endl;
auto echeck = ECheck.View();
auto ofoo = OFoo.View();
if ( SE->_is_local && SE->_permute )
permute(ECheck._odata[i],OFoo._odata[SE->_offset],permute_type);
permute(echeck[i],ofoo[SE->_offset],permute_type);
else if (SE->_is_local)
ECheck._odata[i] = OFoo._odata[SE->_offset];
echeck[i] = ofoo[SE->_offset];
else
ECheck._odata[i] = OStencil.CommBuf()[SE->_offset];
echeck[i] = OStencil.CommBuf()[SE->_offset];
}
setCheckerboard(Check,ECheck);
@ -238,7 +245,7 @@ int main(int argc, char ** argv) {
Real nrm = norm2(Diff);
std::cout<<GridLogMessage<<"RB N2diff ="<<nrm<<" "<<nrmC<<" " <<nrmB<<std::endl;
std::vector<int> coor(4);
Coordinate coor(4);
for(coor[3]=0;coor[3]<latt_size[3]/mpi_layout[3];coor[3]++){
for(coor[2]=0;coor[2]<latt_size[2]/mpi_layout[2];coor[2]++){
for(coor[1]=0;coor[1]<latt_size[1]/mpi_layout[1];coor[1]++){

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
/* For Metropolis */
@ -59,10 +59,10 @@ int main (int argc, char ** argv)
Grid_init(&argc,&argv);
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
std::vector<int> latt_size ({16,16,16,32});
std::vector<int> clatt_size ({4,4,4,8});
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
Coordinate latt_size ({16,16,16,32});
Coordinate clatt_size ({4,4,4,8});
int orthodir=3;
int orthosz =latt_size[orthodir];
@ -84,7 +84,7 @@ int main (int argc, char ** argv)
// Painful ; fix syntactical niceness : to check reader
LatticeComplex LinkTrace(&Fine);
LinkTrace=zero;
LinkTrace=Zero();
for(int mu=0;mu<Nd;mu++){
LinkTrace = LinkTrace + trace(U[mu]);
}
@ -110,7 +110,7 @@ int main (int argc, char ** argv)
LatticeComplex Plaq(&Fine);
LatticeComplex cPlaq(&Coarse);
Plaq = zero;
Plaq = Zero();
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
Plaq = Plaq + trace(PeriodicBC::CovShiftForward(U[mu],mu,U[nu])*adj(PeriodicBC::CovShiftForward(U[nu],nu,U[mu])));
@ -127,7 +127,7 @@ int main (int argc, char ** argv)
TComplex Plaq_T_sum;
Plaq_T_sum=zero;
Plaq_T_sum=Zero();
for(int t=0;t<Nt;t++){
Plaq_T_sum = Plaq_T_sum+Plaq_T[t];
Complex Pt=TensorRemove(Plaq_T[t]);

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
/* For Metropolis */
@ -54,7 +54,7 @@ public:
void RectPlaq(const std::vector<LatticeColourMatrix> &U, LatticeComplex &RectPlaqValue )
{
RectPlaqValue=zero;
RectPlaqValue=Zero();
// 12 * vol loops
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
@ -76,10 +76,10 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
std::vector<int> latt_size ({16,16,16,32});
std::vector<int> clatt_size ({4,4,4,8});
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
Coordinate latt_size ({16,16,16,32});
Coordinate clatt_size ({4,4,4,8});
int orthodir=3;
int orthosz =latt_size[orthodir];
@ -101,7 +101,7 @@ int main (int argc, char ** argv)
// Painful ; fix syntactical niceness : to check reader
LatticeComplex LinkTrace(&Fine);
LinkTrace=zero;
LinkTrace=Zero();
for(int mu=0;mu<Nd;mu++){
LinkTrace = LinkTrace + trace(U[mu]);
}
@ -109,7 +109,7 @@ int main (int argc, char ** argv)
LatticeComplex Plaq(&Fine);
LatticeComplex cPlaq(&Coarse);
Plaq = zero;
Plaq = Zero();
for(int mu=1;mu<Nd;mu++){
for(int nu=0;nu<mu;nu++){
Plaq = Plaq + trace(PeriodicBC::CovShiftForward(U[mu],mu,U[nu])*adj(PeriodicBC::CovShiftForward(U[nu],nu,U[mu])));
@ -134,7 +134,7 @@ int main (int argc, char ** argv)
// Rect Plaq Calc Deriv
LatticeComplex RectPlaq_d(&Fine);
RectPlaq_d = zero;
RectPlaq_d = Zero();
LatticeColourMatrix ds_U(&Fine);
LatticeColourMatrix left_2(&Fine);
LatticeColourMatrix upper_l(&Fine);
@ -151,7 +151,7 @@ int main (int argc, char ** argv)
// //
for(int mu=0;mu<Nd;mu++){
ds_U=zero; // dS / dUmu
ds_U=Zero(); // dS / dUmu
for(int nu=0;nu<Nd;nu++){
@ -275,7 +275,7 @@ int main (int argc, char ** argv)
TComplex Plaq_T_sum;
Plaq_T_sum=zero;
Plaq_T_sum=Zero();
for(int t=0;t<Nt;t++){
Plaq_T_sum = Plaq_T_sum+Plaq_T[t];
Complex Pt=TensorRemove(Plaq_T[t]);

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -60,8 +60,8 @@ int main (int argc, char ** argv)
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
LatticeFermion src(FGrid); random(RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid);
LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu);

View File

@ -30,7 +30,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -56,7 +56,7 @@ int main (int argc, char ** argv)
assert(argc >= 5);
std::vector<int> latt(4,0);
Coordinate latt(4,0);
latt[0] = toint(argv[1]);
latt[1] = toint(argv[2]);
latt[2] = toint(argv[3]);
@ -65,7 +65,7 @@ int main (int argc, char ** argv)
const int Ls= toint(argv[5]);
std::cout << "Lattice size (" << latt[0] << "," << latt[1] << "," << latt[2] << "," << latt[3] << ") Ls=" << Ls << std::endl;
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplexD::Nsimd());
Coordinate simd_layout = GridDefaultSimd(Nd,vComplexD::Nsimd());
std::cout << "SIMD layout (" << simd_layout[0] << "," << simd_layout[1] << "," << simd_layout[2] << "," << simd_layout[3] << ")" << std::endl;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(latt, simd_layout,GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
@ -85,8 +85,8 @@ int main (int argc, char ** argv)
LatticeType src_o(FrbGrid);
pickCheckerboard(Odd,src_o,src);
std::vector<int> site(5);
std::vector<int> cbsite(5);
Coordinate site(5);
Coordinate cbsite(5);
typedef typename GridTypeMapper<LatticeType::vector_object>::scalar_object sobj;
// std::cout << "sizeof(vobj) " << sizeof(LatticeType::vector_object) << std::endl;
@ -98,7 +98,7 @@ int main (int argc, char ** argv)
for(site[3]=0;site[3]<latt[2];site[3]++){
for(site[2]=0;site[2]<latt[1];site[2]++){
for(site[1]=0;site[1]<latt[0];site[1]++){
if(src_o._grid->CheckerBoard(site) != src_o.checkerboard)
if(src_o.Grid()->CheckerBoard(site) != src_o.Checkerboard())
continue;
std::cout << "Site (" << site[0] << "," << site[1] << "," << site[2] << "," << site[3] << "," << site[4] << ")" << std::endl;
@ -128,7 +128,7 @@ int main (int argc, char ** argv)
// LatticeFermion result(FGrid); result=zero;
// LatticeFermion result(FGrid); result=Zero();
// LatticeGaugeField Umu(UGrid);
// SU3::HotConfiguration(RNG4,Umu);
@ -145,7 +145,7 @@ int main (int argc, char ** argv)
// LatticeFermion src_o(FrbGrid);
// LatticeFermion result_o(FrbGrid);
// pickCheckerboard(Odd,src_o,src);
// result_o=zero;
// result_o=Zero();
// SchurDiagMooeeOperator<DomainWallFermionR,LatticeFermion> HermOpEO(Ddwf);
// ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);

View File

@ -29,7 +29,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class d>
struct scal {
@ -107,10 +106,10 @@ void TestWhat(What & Ddwf,
LatticeFermion src (FGrid); random(*RNG5,src);
LatticeFermion phi (FGrid); random(*RNG5,phi);
LatticeFermion chi (FGrid); random(*RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeFermion src_e (FrbGrid);
LatticeFermion src_o (FrbGrid);

View File

@ -30,7 +30,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
#define POWER10
@ -38,12 +37,12 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
Coordinate latt_size = GridDefaultLatt();
int Nd = latt_size.size();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
std::vector<int> mask(Nd,1);
Coordinate mask(Nd,1);
mask[0]=0;
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
@ -60,10 +59,9 @@ int main (int argc, char ** argv)
LatticeComplex ShiftUe(&RBFine);
LatticeComplex ShiftUo(&RBFine);
LatticeComplex lex(&Fine);
lex=zero;
lex=Zero();
Integer stride =1;
{
double nrm;
LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){
@ -84,10 +82,11 @@ int main (int argc, char ** argv)
pickCheckerboard(Odd,Uo,U);
// std::cout<<GridLogMessage << U<<std::endl;
std::cout<<GridLogMessage<< U <<std::endl;
std::cout<<GridLogMessage << "U " <<norm2(U)<<std::endl;
std::cout<<GridLogMessage << "Ue " <<norm2(Ue)<<std::endl;
std::cout<<GridLogMessage << "Uo " <<norm2(Uo)<<std::endl;
TComplex cm;
TComplex cmeo;
for(int dir=0;dir<Nd;dir++){
@ -116,7 +115,7 @@ int main (int argc, char ** argv)
err = ShiftU - rbShiftU;
std::cout<< "\terror " <<norm2(err)<<std::endl;
std::vector<int> coor(4);
Coordinate coor(4);
std::cout<<GridLogMessage << " Checking the non-checkerboard shift "<<shift <<" dir "<<dir <<" ... ";
for(coor[3]=0;coor[3]<latt_size[3];coor[3]++){
@ -128,17 +127,17 @@ int main (int argc, char ** argv)
///////// double nrm=norm2(U);
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
#ifndef POWER10
std::vector<int> powers=latt_size;
Coordinate powers=latt_size;
Integer slex = scoor[0]
+ latt_size[0]*scoor[1]
+ latt_size[0]*latt_size[1]*scoor[2]
+ latt_size[0]*latt_size[1]*latt_size[2]*scoor[3];
#else
std::vector<int> powers({1,10,100,1000});
Coordinate powers({1,10,100,1000});
Integer slex = scoor[0]
+ 10 *scoor[1]
+ 100 *scoor[2]
@ -147,7 +146,7 @@ int main (int argc, char ** argv)
Complex scm(slex);
double nrm = abs(scm-cm()()());
std::vector<int> peer(4);
Coordinate peer(4);
Complex ctmp = cm;
Integer index=real(ctmp);
Lexicographic::CoorFromIndex(peer,index,powers);
@ -176,23 +175,23 @@ int main (int argc, char ** argv)
Integer checkerboard = RBFine.CheckerBoard(coor);
if ( checkerboard == ShiftUo.checkerboard ) {
if ( checkerboard == ShiftUo.Checkerboard() ) {
peekSite(cmeo,ShiftUo,coor);
} else {
peekSite(cmeo,ShiftUe,coor);
}
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
#ifndef POWER10
std::vector<int> powers=latt_size;
Coordinate powers=latt_size;
Integer slex = scoor[0]
+ latt_size[0]*scoor[1]
+ latt_size[0]*latt_size[1]*scoor[2]
+ latt_size[0]*latt_size[1]*latt_size[2]*scoor[3];
#else
std::vector<int> powers({1,10,100,1000});
Coordinate powers({1,10,100,1000});
Integer slex = scoor[0]
+ 10 *scoor[1]
+ 100 *scoor[2]
@ -200,7 +199,7 @@ int main (int argc, char ** argv)
#endif
Complex scm(slex);
std::vector<int> peer(4);
Coordinate peer(4);
Complex ctmp=cmeo;
Integer index=real(ctmp);
Lexicographic::CoorFromIndex(peer,index,powers);
@ -210,7 +209,7 @@ int main (int argc, char ** argv)
std::cout << " coor "<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] \n ";
std::cout << "shift "<< shift <<" dir "<<dir<< " checker board "<< checkerboard << " ";
std::cout << "Uo cb = " << ShiftUo.checkerboard << " Ue cb= "<<ShiftUe.checkerboard<<std::endl;
std::cout << "Uo cb = " << ShiftUo.Checkerboard() << " Ue cb= "<<ShiftUe.Checkerboard()<<std::endl;
std::cout<<"EOFAIL shift "<< shift<<" in dir "<< dir
<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] = "

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
#define POWER10
@ -38,12 +38,12 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
Coordinate latt_size = GridDefaultLatt();
int Nd = latt_size.size();
std::vector<int> simd_layout( { vComplex::Nsimd(),1,1,1});
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate simd_layout( { vComplex::Nsimd(),1,1,1});
Coordinate mpi_layout = GridDefaultMpi();
std::vector<int> mask(Nd,1);
Coordinate mask(Nd,1);
mask[0]=0;
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
@ -60,10 +60,9 @@ int main (int argc, char ** argv)
LatticeComplex ShiftUe(&RBFine);
LatticeComplex ShiftUo(&RBFine);
LatticeComplex lex(&Fine);
lex=zero;
lex=Zero();
Integer stride =1;
{
double nrm;
LatticeComplex coor(&Fine);
for(int d=0;d<Nd;d++){
@ -117,7 +116,7 @@ int main (int argc, char ** argv)
err = ShiftU - rbShiftU;
std::cout<< "\terror " <<norm2(err)<<std::endl;
std::vector<int> coor(4);
Coordinate coor(4);
std::cout<<GridLogMessage << " Checking the non-checkerboard shift "<< shift << " dir "<<dir <<"... ";
for(coor[3]=0;coor[3]<latt_size[3];coor[3]++){
@ -129,17 +128,17 @@ int main (int argc, char ** argv)
///////// double nrm=norm2(U);
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
#ifdef POWER10
std::vector<int> powers({1,10,100,1000});
Coordinate powers({1,10,100,1000});
Integer slex = scoor[3]
+ 10 *scoor[2]
+ 100 *scoor[1]
+ 1000 *scoor[0];
#else
std::vector<int> powers=latt_size;
Coordinate powers=latt_size;
Integer slex = scoor[0]
+ latt_size[0]*scoor[1]
+ latt_size[0]*latt_size[1]*scoor[2]
@ -149,7 +148,7 @@ int main (int argc, char ** argv)
Complex scm(slex);
double nrm = abs(scm-cm()()());
std::vector<int> peer(4);
Coordinate peer(4);
Complex ctmp = cm;
Integer index=real(ctmp);
Lexicographic::CoorFromIndex(peer,index,powers);
@ -181,25 +180,25 @@ int main (int argc, char ** argv)
// std::cout << " coor "<<" ["<<coor[0]<<","<<coor[1]<<","<<coor[2]<<","<<coor[3]<<"] \n ";
// std::cout << "shift "<< shift <<" dir "<<dir<< " checker board "<< checkerboard << " ";
// std::cout << "Uo " << ShiftUo.checkerboard << " Ue "<<ShiftUe.checkerboard<<std::endl;
if ( checkerboard == ShiftUo.checkerboard ) {
// std::cout << "Uo " << ShiftUo.Checkerboard() << " Ue "<<ShiftUe.Checkerboard()<<std::endl;
if ( checkerboard == ShiftUo.Checkerboard() ) {
peekSite(cmeo,ShiftUo,coor);
} else {
peekSite(cmeo,ShiftUe,coor);
}
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
#ifdef POWER10
std::vector<int> powers({1,10,100,1000});
Coordinate powers({1,10,100,1000});
Integer slex = scoor[3]
+ 10 *scoor[2]
+ 100 *scoor[1]
+ 1000 *scoor[0];
#else
std::vector<int> powers = latt_size;
Coordinate powers = latt_size;
Integer slex = scoor[0]
+ latt_size[0]*scoor[1]
+ latt_size[0]*latt_size[1]*scoor[2]
@ -207,7 +206,7 @@ int main (int argc, char ** argv)
#endif
Complex scm(slex);
std::vector<int> peer(4);
Coordinate peer(4);
Complex ctmp=cmeo;
Integer index=real(ctmp);
Lexicographic::CoorFromIndex(peer,index,powers);

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout( { vComplex::Nsimd(),1,1,1});
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout( { vComplex::Nsimd(),1,1,1});
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
@ -46,10 +46,9 @@ int main (int argc, char ** argv)
LatticeComplex U(&Fine);
LatticeComplex ShiftU(&Fine);
LatticeComplex lex(&Fine);
lex=zero;
lex=Zero();
Integer stride =1;
{
double nrm;
LatticeComplex coor(&Fine);
for(int d=0;d<4;d++){
@ -76,7 +75,7 @@ int main (int argc, char ** argv)
std::cout << "ShiftU[0]" << ShiftU[0]<<std::endl;
std::cout << "ShiftU[1]" << ShiftU[1]<<std::endl;
*/
std::vector<int> coor(4);
Coordinate coor(4);
for(coor[3]=0;coor[3]<latt_size[3];coor[3]++){
for(coor[2]=0;coor[2]<latt_size[2];coor[2]++){
@ -87,7 +86,7 @@ int main (int argc, char ** argv)
double nrm=norm2(U);
std::vector<int> scoor(coor);
Coordinate scoor(coor);
scoor[dir] = (scoor[dir]+shift)%latt_size[dir];
Integer slex = scoor[0]
@ -98,7 +97,7 @@ int main (int argc, char ** argv)
Complex scm(slex);
nrm = abs(scm-cm()()());
std::vector<int> peer(4);
Coordinate peer(4);
Complex tmp =cm;
Integer index=real(tmp);
Lexicographic::CoorFromIndex(peer,index,latt_size);

View File

@ -32,7 +32,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -69,18 +69,18 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5, src);
LatticeFermion phi (FGrid); random(RNG5, phi);
LatticeFermion chi (FGrid); random(RNG5, chi);
LatticeFermion result(FGrid); result = zero;
LatticeFermion ref (FGrid); ref = zero;
LatticeFermion tmp (FGrid); tmp = zero;
LatticeFermion err (FGrid); err = zero;
LatticeFermion result(FGrid); result = Zero();
LatticeFermion ref (FGrid); ref = Zero();
LatticeFermion tmp (FGrid); tmp = Zero();
LatticeFermion err (FGrid); err = Zero();
LatticeGaugeField Umu (UGrid); SU3::HotConfiguration(RNG4, Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
Umu = zero;
Umu = Zero();
for(int nn=0; nn<Nd; nn++){
random(RNG4, U[nn]);
if(nn>0){ U[nn] = zero; }
if(nn>0){ U[nn] = Zero(); }
PokeIndex<LorentzIndex>(Umu, U[nn], nn);
}

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -68,19 +68,19 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5,src);
LatticeFermion phi (FGrid); random(RNG5,phi);
LatticeFermion chi (FGrid); random(RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(RNG4,U[nn]);
if ( nn>0 )
U[nn]=zero;
U[nn]=Zero();
PokeIndex<LorentzIndex>(Umu,U[nn],nn);
}

View File

@ -1,136 +0,0 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./tests/Test_dwf_even_odd.cc
Copyright (C) 2015
Author: Peter Boyle <paboyle@ph.ed.ac.uk>
Author: paboyle <paboyle@ph.ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/Grid.h>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class d>
struct scal {
d internal;
};
Gamma::Algebra Gmu [] = {
Gamma::Algebra::GammaX,
Gamma::Algebra::GammaY,
Gamma::Algebra::GammaZ,
Gamma::Algebra::GammaT
};
typedef WilsonFermion5D<DomainWallVec5dImplR> WilsonFermion5DR;
typedef WilsonFermion5D<DomainWallVec5dImplF> WilsonFermion5DF;
typedef WilsonFermion5D<DomainWallVec5dImplD> WilsonFermion5DD;
typedef WilsonFermion5D<WilsonImplR> WilsonFermion5D_OKR;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
int threads = GridThread::GetThreads();
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
const int Ls=32;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
GridCartesian * sUGrid = SpaceTimeGrid::makeFourDimDWFGrid(GridDefaultLatt(),GridDefaultMpi());
GridRedBlackCartesian * sUrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(sUGrid);
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimDWFGrid(Ls,UGrid);
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimDWFRedBlackGrid(Ls,UGrid);
std::vector<int> seeds4({1,2,3,4});
std::vector<int> seeds5({5,6,7,8});
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
LatticeFermion src (FGrid); random(RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid);
LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
/*
Umu=zero;
for(int nn=0;nn<Nd;nn++){
random(RNG4,U[nn]);
PokeIndex<LorentzIndex>(Umu,U[nn],nn);
}
*/
RealD mass=0.1;
RealD M5 =1.8;
typename WilsonFermion5DR::ImplParams params;
WilsonFermion5DR Dw(Umu,*FGrid,*FrbGrid,*sUGrid,*sUrbGrid,M5,params);
Dw.Dhop(src,result,0);
std::cout << "Norm src = "<<norm2(src)<<" Norm res = "<<norm2(result) << std::endl;
GridCartesian * FokGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
GridRedBlackCartesian * FokrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
WilsonFermion5D_OKR Dok(Umu,*FokGrid,*FokrbGrid,*UGrid,*UrbGrid,M5,params);
LatticeFermion src_ok (FokGrid);
LatticeFermion ref_ok(FokGrid);
LatticeFermion result_ok(FokGrid);
for(int lidx=0;lidx<FGrid->lSites();lidx++){
std::vector<int> lcoor;
FGrid->LocalIndexToLocalCoor(lidx,lcoor);
SpinColourVector siteSrc;
peekLocalSite(siteSrc,src,lcoor);
pokeLocalSite(siteSrc,src_ok,lcoor);
peekLocalSite(siteSrc,result,lcoor);
pokeLocalSite(siteSrc,result_ok,lcoor);
}
Dok.Dhop(src_ok,ref_ok,0);
std::cout << "Reference = "<<norm2(src_ok)<<" res = "<<norm2(ref_ok) << std::endl;
ref_ok = ref_ok - result_ok;
std::cout << "Result = "<<norm2(result_ok)<< std::endl;
std::cout << "Reference diff = "<<norm2(ref_ok)<< std::endl;
Grid_finalize();
}

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -38,9 +38,9 @@ int main (int argc, char ** argv)
int threads = GridThread::GetThreads();
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout( { vComplexD::Nsimd(),1,1,1});
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout( { vComplexD::Nsimd(),1,1,1});
Coordinate mpi_layout = GridDefaultMpi();
int vol = 1;
for(int d=0;d<latt_size.size();d++){
@ -60,7 +60,7 @@ int main (int argc, char ** argv)
LatticeSpinMatrixD S(&GRID);
LatticeSpinMatrixD Stilde(&GRID);
std::vector<int> p({1,3,2,3});
Coordinate p({1,3,2,3});
one = ComplexD(1.0,0.0);
zz = ComplexD(0.0,0.0);
@ -71,7 +71,7 @@ int main (int argc, char ** argv)
std::cout<<"*************************************************"<<std::endl;
std::cout<<"Testing Fourier from of known plane wave "<<std::endl;
std::cout<<"*************************************************"<<std::endl;
C=zero;
C=Zero();
for(int mu=0;mu<4;mu++){
RealD TwoPiL = M_PI * 2.0/ latt_size[mu];
LatticeCoordinate(coor,mu);
@ -80,7 +80,7 @@ int main (int argc, char ** argv)
C = exp(C*ci);
Csav = C;
S=zero;
S=Zero();
S = S+C;
FFT theFFT(&GRID);
@ -92,12 +92,12 @@ int main (int argc, char ** argv)
theFFT.FFT_dim(Ctilde,Ctilde,2,FFT::forward); std::cout << theFFT.MFlops()<<" Mflops "<<std::endl;
theFFT.FFT_dim(Ctilde,Ctilde,3,FFT::forward); std::cout << theFFT.MFlops()<<" Mflops "<<std::endl;
// C=zero;
// C=Zero();
// Ctilde = where(abs(Ctilde)<1.0e-10,C,Ctilde);
TComplexD cVol;
cVol()()() = vol;
Cref=zero;
Cref=Zero();
pokeSite(cVol,Cref,p);
// std::cout <<"Ctilde "<< Ctilde <<std::endl;
// std::cout <<"Cref "<< Cref <<std::endl;
@ -121,9 +121,9 @@ int main (int argc, char ** argv)
theFFT.FFT_dim(Stilde,S,3,FFT::forward); std::cout << theFFT.MFlops()<<" mflops "<<std::endl;
SpinMatrixD Sp;
Sp = zero; Sp = Sp+cVol;
Sp = Zero(); Sp = Sp+cVol;
S=zero;
S=Zero();
pokeSite(Sp,S,p);
S= S-Stilde;
@ -139,7 +139,7 @@ int main (int argc, char ** argv)
LatticeGaugeFieldD Umu(&GRID);
SU3::ColdConfiguration(pRNG,Umu); // Unit gauge
// Umu=zero;
// Umu=Zero();
////////////////////////////////////////////////////
// Wilson test
////////////////////////////////////////////////////
@ -225,13 +225,13 @@ int main (int argc, char ** argv)
Gamma::Algebra::GammaT,
Gamma::Algebra::Gamma5
};
LatticeFermionD Kinetic(FGrid); Kinetic = zero;
LatticeFermionD Kinetic(FGrid); Kinetic = Zero();
LatticeComplexD kmu(FGrid);
LatticeInteger scoor(FGrid);
LatticeComplexD sk (FGrid); sk = zero;
LatticeComplexD sk2(FGrid); sk2= zero;
LatticeComplexD W(FGrid); W= zero;
// LatticeComplexD a(FGrid); a= zero;
LatticeComplexD sk (FGrid); sk = Zero();
LatticeComplexD sk2(FGrid); sk2= Zero();
LatticeComplexD W(FGrid); W= Zero();
// LatticeComplexD a(FGrid); a= Zero();
LatticeComplexD one(FGrid); one =ComplexD(1.0,0.0);
ComplexD ci(0.0,1.0);
@ -294,8 +294,8 @@ int main (int argc, char ** argv)
LatticeFermionD ref(&GRID);
LatticeFermionD diff(&GRID);
std::vector<int> point(4,0);
src=zero;
Coordinate point(4,0);
src=Zero();
SpinColourVectorD ferm; gaussian(sRNG,ferm);
pokeSite(ferm,src,point);
@ -314,9 +314,9 @@ int main (int argc, char ** argv)
Gamma G5(Gamma::Algebra::Gamma5);
LatticeFermionD src5(FGrid); src5=zero;
LatticeFermionD src5(FGrid); src5=Zero();
LatticeFermionD tmp5(FGrid);
LatticeFermionD result5(FGrid); result5=zero;
LatticeFermionD result5(FGrid); result5=Zero();
LatticeFermionD result4(&GRID);
const int sdir=0;
@ -374,8 +374,8 @@ int main (int argc, char ** argv)
LatticeFermionD ref(&GRID);
LatticeFermionD diff(&GRID);
std::vector<int> point(4,0);
src=zero;
Coordinate point(4,0);
src=Zero();
SpinColourVectorD ferm; gaussian(sRNG,ferm);
pokeSite(ferm,src,point);
@ -394,9 +394,9 @@ int main (int argc, char ** argv)
Gamma G5(Gamma::Algebra::Gamma5);
LatticeFermionD src5(FGrid); src5=zero;
LatticeFermionD src5(FGrid); src5=Zero();
LatticeFermionD tmp5(FGrid);
LatticeFermionD result5(FGrid); result5=zero;
LatticeFermionD result5(FGrid); result5=Zero();
LatticeFermionD result4(&GRID);
const int sdir=0;
@ -449,8 +449,8 @@ int main (int argc, char ** argv)
typedef Photon<QEDGimplTypesD> QEDGaction;
QEDGaction Maxwell(QEDGaction::FEYNMAN_L);
QEDGaction::GaugeField Prop(&GRID);Prop=zero;
QEDGaction::GaugeField Source(&GRID);Source=zero;
QEDGaction::GaugeField Prop(&GRID);Prop=Zero();
QEDGaction::GaugeField Source(&GRID);Source=Zero();
Maxwell.FreePropagator (Source,Prop);
std::cout << " MaxwellFree propagator\n";

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -39,9 +39,9 @@ int main (int argc, char ** argv)
int threads = GridThread::GetThreads();
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout( { vComplex::Nsimd(),1,1,1});
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout( { vComplex::Nsimd(),1,1,1});
Coordinate mpi_layout = GridDefaultMpi();
int vol = 1;
for(int d=0;d<latt_size.size();d++){

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -38,9 +38,9 @@ int main (int argc, char ** argv)
int threads = GridThread::GetThreads();
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout( { vComplexF::Nsimd(),1,1,1});
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout( { vComplexF::Nsimd(),1,1,1});
Coordinate mpi_layout = GridDefaultMpi();
int vol = 1;
for(int d=0;d<latt_size.size();d++){
@ -57,14 +57,14 @@ int main (int argc, char ** argv)
LatticeSpinMatrixF S(&Fine);
LatticeSpinMatrixF Stilde(&Fine);
std::vector<int> p({1,2,3,2});
Coordinate p({1,2,3,2});
one = ComplexF(1.0,0.0);
zz = ComplexF(0.0,0.0);
ComplexF ci(0.0,1.0);
C=zero;
C=Zero();
for(int mu=0;mu<4;mu++){
RealD TwoPiL = M_PI * 2.0/ latt_size[mu];
LatticeCoordinate(coor,mu);
@ -73,7 +73,7 @@ int main (int argc, char ** argv)
C = exp(C*ci);
S=zero;
S=Zero();
S = S+C;
FFT theFFT(&Fine);
@ -84,12 +84,12 @@ int main (int argc, char ** argv)
theFFT.FFT_dim(Ctilde,Ctilde,2,FFT::forward); std::cout << theFFT.MFlops()<<std::endl;
theFFT.FFT_dim(Ctilde,Ctilde,3,FFT::forward); std::cout << theFFT.MFlops()<<std::endl;
// C=zero;
// C=Zero();
// Ctilde = where(abs(Ctilde)<1.0e-10,C,Ctilde);
TComplexF cVol;
cVol()()() = vol;
C=zero;
C=Zero();
pokeSite(cVol,C,p);
C=C-Ctilde;
std::cout << "diff scalar "<<norm2(C) << std::endl;
@ -101,9 +101,9 @@ int main (int argc, char ** argv)
theFFT.FFT_dim(Stilde,Stilde,3,FFT::forward); std::cout << theFFT.MFlops()<<" "<<theFFT.USec() <<std::endl;
SpinMatrixF Sp;
Sp = zero; Sp = Sp+cVol;
Sp = Zero(); Sp = Sp+cVol;
S=zero;
S=Zero();
pokeSite(Sp,S,p);
S= S-Stilde;

View File

@ -29,9 +29,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
/* END LEGAL */
#include <Grid/Grid.h>
using namespace std;
using namespace Grid;
using namespace QCD;
static constexpr double tolerance = 1.0e-6;
static std::array<SpinMatrix, Gamma::nGamma> testAlgebra;
@ -66,28 +64,28 @@ void createTestAlgebra(void)
SpinMatrix testg5;
const Complex I(0., 1.), mI(0., -1.);
testg[0] = zero;
testg[0] = Zero();
testg[0]()(0, 3) = I;
testg[0]()(1, 2) = I;
testg[0]()(2, 1) = mI;
testg[0]()(3, 0) = mI;
std::cout << GridLogMessage << "test GammaX= " << std::endl;
print(testg[0]);
testg[1] = zero;
testg[1] = Zero();
testg[1]()(0, 3) = -1.;
testg[1]()(1, 2) = 1.;
testg[1]()(2, 1) = 1.;
testg[1]()(3, 0) = -1.;
std::cout << GridLogMessage << "test GammaY= " << std::endl;
print(testg[1]);
testg[2] = zero;
testg[2] = Zero();
testg[2]()(0, 2) = I;
testg[2]()(1, 3) = mI;
testg[2]()(2, 0) = mI;
testg[2]()(3, 1) = I;
std::cout << GridLogMessage << "test GammaZ= " << std::endl;
print(testg[2]);
testg[3] = zero;
testg[3] = Zero();
testg[3]()(0, 2) = 1.;
testg[3]()(1, 3) = 1.;
testg[3]()(2, 0) = 1.;
@ -142,7 +140,6 @@ void checkGamma(const Gamma::Algebra a, GridSerialRNG &rng)
SpinVector v;
SpinMatrix m, &testg = testAlgebra[a];
Gamma g(a);
bool pass = true;
random(rng, v);
random(rng, m);
@ -161,7 +158,6 @@ void checkProd(const Gamma::Algebra a, const Gamma::Algebra b)
{
SpinMatrix gm, testg = testAlgebra[a]*testAlgebra[b];
Gamma g = Gamma(a)*Gamma(b);
bool pass = true;
std::cout << GridLogMessage << "Checking " << Gamma::name[a] << " * "
<< Gamma::name[b] << ": ";
@ -175,7 +171,6 @@ void checkAdj(const Gamma::Algebra a)
{
SpinMatrix gm, testg = adj(testAlgebra[a]);
Gamma g(adj(Gamma(a)));
bool pass = true;
std::cout << GridLogMessage << "Checking adj(" << Gamma::name[a] << "): ";
gm = 1.0;
@ -217,7 +212,6 @@ void checkGammaL(const Gamma::Algebra a, GridSerialRNG &rng)
SpinVector v;
SpinMatrix m, &testg = testAlgebra[a], pl;
GammaL gl(a);
bool pass = true;
random(rng, v);
random(rng, m);
@ -238,9 +232,9 @@ int main(int argc, char *argv[])
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridSerialRNG sRNG;

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
//typedef GparityDomainWallFermionD GparityDiracOp;
//typedef DomainWallFermionD StandardDiracOp;
@ -84,18 +84,18 @@ int main (int argc, char ** argv)
//const int L =4;
//std::vector<int> latt_2f(Nd,L);
std::vector<int> latt_2f = GridDefaultLatt();
std::vector<int> latt_1f(latt_2f); latt_1f[nu] = 2*latt_2f[nu];
Coordinate latt_2f = GridDefaultLatt();
Coordinate latt_1f(latt_2f); latt_1f[nu] = 2*latt_2f[nu];
int L = latt_2f[nu];
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplexType::Nsimd());
Coordinate simd_layout = GridDefaultSimd(Nd,vComplexType::Nsimd());
std::cout << GridLogMessage << "SIMD layout: ";
for(int i=0;i<simd_layout.size();i++) std::cout << simd_layout[i] << " ";
std::cout << std::endl;
std::vector<int> mpi_layout = GridDefaultMpi(); //node layout
Coordinate mpi_layout = GridDefaultMpi(); //node layout
GridCartesian * UGrid_1f = SpaceTimeGrid::makeFourDimGrid(latt_1f, simd_layout, mpi_layout);
GridRedBlackCartesian * UrbGrid_1f = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid_1f);
@ -127,7 +127,7 @@ int main (int argc, char ** argv)
tmpsrc=src*2.0;
PokeIndex<0>(src_2f,tmpsrc,1);
StandardFermionField result_1f(FGrid_1f); result_1f=zero;
StandardFermionField result_1f(FGrid_1f); result_1f=Zero();
StandardGaugeField Umu_1f(UGrid_1f);
Replicate(Umu_2f,Umu_1f);
@ -166,7 +166,7 @@ int main (int argc, char ** argv)
StandardFermionField src_o_1f(FrbGrid_1f);
StandardFermionField result_o_1f(FrbGrid_1f);
pickCheckerboard(Odd,src_o_1f,src_1f);
result_o_1f=zero;
result_o_1f=Zero();
SchurDiagMooeeOperator<StandardDiracOp,StandardFermionField> HermOpEO(Ddwf);
ConjugateGradient<StandardFermionField> CG(1.0e-8,10000);
@ -258,18 +258,18 @@ int main (int argc, char ** argv)
}
GparityFermionField result_2f(FGrid_2f); result_2f=zero;
GparityFermionField result_2f(FGrid_2f); result_2f=Zero();
GparityFermionField src_o_2f(FrbGrid_2f);
GparityFermionField result_o_2f(FrbGrid_2f);
pickCheckerboard(Odd,src_o_2f,src_2f);
result_o_2f=zero;
result_o_2f=Zero();
ConjugateGradient<GparityFermionField> CG2f(1.0e-8,10000);
SchurDiagMooeeOperator<GparityDiracOp,GparityFermionField> HermOpEO2f(GPDdwf);
CG2f(HermOpEO2f,src_o_2f,result_o_2f);
std::cout << "2f cb "<<result_o_2f.checkerboard<<std::endl;
std::cout << "1f cb "<<result_o_1f.checkerboard<<std::endl;
std::cout << "2f cb "<<result_o_2f.Checkerboard()<<std::endl;
std::cout << "1f cb "<<result_o_1f.Checkerboard()<<std::endl;
std::cout << " result norms " <<norm2(result_o_2f)<<" " <<norm2(result_o_1f)<<std::endl;
@ -278,14 +278,14 @@ int main (int argc, char ** argv)
StandardFermionField res0 (FGrid_2f);
StandardFermionField res1 (FGrid_2f);
res0=zero;
res1=zero;
res0=Zero();
res1=Zero();
res0o = PeekIndex<0>(result_o_2f,0);
res1o = PeekIndex<0>(result_o_2f,1);
std::cout << "res cb "<<res0o.checkerboard<<std::endl;
std::cout << "res cb "<<res1o.checkerboard<<std::endl;
std::cout << "res cb "<<res0o.Checkerboard()<<std::endl;
std::cout << "res cb "<<res1o.Checkerboard()<<std::endl;
setCheckerboard(res0,res0o);
setCheckerboard(res1,res1o);
@ -298,7 +298,7 @@ int main (int argc, char ** argv)
replica = where( xcoor_1f5 >= Integer(L), replica1,replica0 );
replica0 = zero;
replica0 = Zero();
setCheckerboard(replica0,result_o_1f);
std::cout << "Norm2 solutions is " <<norm2(replica)<<" "<< norm2(replica0)<<std::endl;

View File

@ -30,15 +30,15 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -57,10 +57,10 @@ int main (int argc, char ** argv)
FermionField src (&Grid); random(pRNG,src);
FermionField phi (&Grid); random(pRNG,phi);
FermionField chi (&Grid); random(pRNG,chi);
FermionField result(&Grid); result=zero;
FermionField ref(&Grid); ref=zero;
FermionField tmp(&Grid); tmp=zero;
FermionField err(&Grid); tmp=zero;
FermionField result(&Grid); result=Zero();
FermionField ref(&Grid); ref=Zero();
FermionField tmp(&Grid); tmp=Zero();
FermionField err(&Grid); tmp=Zero();
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid);
@ -70,7 +70,7 @@ int main (int argc, char ** argv)
}
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(pRNG,U[nn]);
std::cout<<GridLogMessage<<"U[nn]"<<norm2(U[nn])<<std::endl;

View File

@ -42,7 +42,7 @@ directory
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main(int argc, char** argv) {
Grid_init(&argc, &argv);
@ -110,7 +110,7 @@ int main(int argc, char** argv) {
AdjointRep<Nc> AdjRep(grid);
// AdjointRepresentation has the predefined number of colours Nc
Representations<FundamentalRepresentation, AdjointRepresentation, TwoIndexSymmetricRepresentation> RepresentationTypes(grid);
// Representations<FundamentalRepresentation, AdjointRepresentation, TwoIndexSymmetricRepresentation> RepresentationTypes(grid);
LatticeGaugeField U(grid), V(grid);
@ -121,7 +121,7 @@ int main(int argc, char** argv) {
// Test group structure
// (U_f * V_f)_r = U_r * V_r
LatticeGaugeField UV(grid);
UV = zero;
UV = Zero();
for (int mu = 0; mu < Nd; mu++) {
SU<Nc>::LatticeMatrix Umu = peekLorentz(U,mu);
SU<Nc>::LatticeMatrix Vmu = peekLorentz(V,mu);
@ -139,7 +139,7 @@ int main(int argc, char** argv) {
typename AdjointRep<Nc>::LatticeField Vr = AdjRep.U; // V_r
typename AdjointRep<Nc>::LatticeField UrVr(grid);
UrVr = zero;
UrVr = Zero();
for (int mu = 0; mu < Nd; mu++) {
typename AdjointRep<Nc>::LatticeMatrix Urmu = peekLorentz(Ur,mu);
typename AdjointRep<Nc>::LatticeMatrix Vrmu = peekLorentz(Vr,mu);
@ -200,7 +200,7 @@ int main(int argc, char** argv) {
// Tranform to the adjoint representation
U = zero; // fill this with only one direction
U = Zero(); // fill this with only one direction
pokeLorentz(U,Ufund,0); // the representation transf acts on full gauge fields
AdjRep.update_representation(U);
@ -315,7 +315,7 @@ int main(int argc, char** argv) {
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2);
LatticeGaugeField UV2(grid);
UV2 = zero;
UV2 = Zero();
for (int mu = 0; mu < Nd; mu++) {
SU<Nc>::LatticeMatrix Umu2 = peekLorentz(U2,mu);
SU<Nc>::LatticeMatrix Vmu2 = peekLorentz(V2,mu);
@ -332,7 +332,7 @@ int main(int argc, char** argv) {
typename TwoIndexRep< Nc, Symmetric >::LatticeField Vr2 = TIndexRep.U; // V_r
typename TwoIndexRep< Nc, Symmetric >::LatticeField Ur2Vr2(grid);
Ur2Vr2 = zero;
Ur2Vr2 = Zero();
for (int mu = 0; mu < Nd; mu++) {
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Urmu2 = peekLorentz(Ur2,mu);
typename TwoIndexRep< Nc, Symmetric >::LatticeMatrix Vrmu2 = peekLorentz(Vr2,mu);
@ -393,7 +393,7 @@ int main(int argc, char** argv) {
// Tranform to the 2Index Sym representation
U = zero; // fill this with only one direction
U = Zero(); // fill this with only one direction
pokeLorentz(U,Ufund2,0); // the representation transf acts on full gauge fields
TIndexRep.update_representation(U);
@ -425,7 +425,7 @@ int main(int argc, char** argv) {
SU<Nc>::HotConfiguration<LatticeGaugeField>(gridRNG, V2A);
LatticeGaugeField UV2A(grid);
UV2A = zero;
UV2A = Zero();
for (int mu = 0; mu < Nd; mu++) {
SU<Nc>::LatticeMatrix Umu2A = peekLorentz(U2,mu);
SU<Nc>::LatticeMatrix Vmu2A = peekLorentz(V2,mu);
@ -442,7 +442,7 @@ int main(int argc, char** argv) {
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Vr2A = TIndexRepA.U; // V_r
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeField Ur2Vr2A(grid);
Ur2Vr2A = zero;
Ur2Vr2A = Zero();
for (int mu = 0; mu < Nd; mu++) {
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Urmu2A = peekLorentz(Ur2A,mu);
typename TwoIndexRep< Nc, AntiSymmetric >::LatticeMatrix Vrmu2A = peekLorentz(Vr2A,mu);
@ -503,7 +503,7 @@ int main(int argc, char** argv) {
// Tranform to the 2Index Sym representation
U = zero; // fill this with only one direction
U = Zero(); // fill this with only one direction
pokeLorentz(U,Ufund2A,0); // the representation transf acts on full gauge fields
TIndexRepA.update_representation(U);

View File

@ -32,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
/*
Grid_main.cc(232): error: no suitable user-defined conversion from
@ -58,9 +57,9 @@ auto peekDumKopf(const vobj &rhs, int i) -> decltype(peekIndex<3>(rhs, 0)) {
int main(int argc, char **argv) {
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4, vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4, vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
latt_size.resize(4);
@ -180,7 +179,7 @@ int main(int argc, char **argv) {
std::cout << "Norm2 LatticeReal : "<< norm2(BarReal) << std::endl;
std::cout << "Norm2 LatticeComplex : "<< norm2(BarComplex) << std::endl;
exit(0);
// exit(0);
TComplex tr = trace(cmat);
@ -388,7 +387,7 @@ int main(int argc, char **argv) {
std::vector<int> coor(4);
for(int d=0;d<4;d++) coor[d] = 0;
peekSite(cmat,Foo,coor);
Foo = zero;
Foo = Zero();
pokeSite(cmat,Foo,coor);
}
random(Foo);
@ -402,14 +401,14 @@ int main(int argc, char **argv) {
Fine._ldimensions[0] * Fine._ldimensions[1] * Fine._ldimensions[2];
LatticeInteger lex(&Fine);
lex = zero;
lex = Zero();
for (int d = 0; d < 4; d++) {
LatticeInteger coor(&Fine);
LatticeCoordinate(coor, d);
lex = lex + coor * mm[d];
}
// Bar = zero;
// Bar = Zero();
// Bar = where(lex<Integer(10),Foo,Bar);
cout << "peeking sites..\n";
@ -449,7 +448,7 @@ int main(int argc, char **argv) {
double t0, t1, flops;
double bytes;
int ncall = 5000;
int Nc = Grid::QCD::Nc;
int Nc = Grid::Nc;
LatticeGaugeField U(&Fine);
// LatticeColourMatrix Uy = peekLorentz(U,1);
@ -515,7 +514,6 @@ int main(int argc, char **argv) {
double nrm = 0;
LatticeColourMatrix deriv(&Fine);
double half = 0.5;
deriv = 0.5 * Cshift(Foo, 0, 1) - 0.5 * Cshift(Foo, 0, -1);
for (int dir = 0; dir < 4; dir++) {
@ -533,7 +531,7 @@ int main(int argc, char **argv) {
bShifted = Cshift(rFoo, dir, shift); // Shift red->black
rShifted = Cshift(bFoo, dir, shift); // Shift black->red
ShiftedCheck = zero;
ShiftedCheck = Zero();
setCheckerboard(ShiftedCheck, bShifted); // Put them all together
setCheckerboard(ShiftedCheck,
rShifted); // and check the results (later)
@ -547,7 +545,7 @@ int main(int argc, char **argv) {
coor[1]++) {
for (coor[0] = 0; coor[0] < latt_size[0] / mpi_layout[0];
coor[0]++) {
std::complex<Grid::Real> diff;
Complex diff;
std::vector<int> shiftcoor = coor;
shiftcoor[dir] = (shiftcoor[dir] + shift + latt_size[dir]) %

View File

@ -32,7 +32,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -69,18 +69,18 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5, src);
LatticeFermion phi (FGrid); random(RNG5, phi);
LatticeFermion chi (FGrid); random(RNG5, chi);
LatticeFermion result(FGrid); result = zero;
LatticeFermion ref (FGrid); ref = zero;
LatticeFermion tmp (FGrid); tmp = zero;
LatticeFermion err (FGrid); err = zero;
LatticeFermion result(FGrid); result = Zero();
LatticeFermion ref (FGrid); ref = Zero();
LatticeFermion tmp (FGrid); tmp = Zero();
LatticeFermion err (FGrid); err = Zero();
LatticeGaugeField Umu (UGrid); SU3::HotConfiguration(RNG4, Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
Umu = zero;
Umu = Zero();
for(int nn=0; nn<Nd; nn++){
random(RNG4, U[nn]);
if(nn>0){ U[nn] = zero; }
if(nn>0){ U[nn] = Zero(); }
PokeIndex<LorentzIndex>(Umu, U[nn], nn);
}

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -68,19 +68,19 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5,src);
LatticeFermion phi (FGrid); random(RNG5,phi);
LatticeFermion chi (FGrid); random(RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeGaugeField Umu(UGrid); random(RNG4,Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(RNG4,U[nn]);
if ( nn>0 )
U[nn]=zero;
U[nn]=Zero();
PokeIndex<LorentzIndex>(Umu,U[nn],nn);
}

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
#include <Grid/Grid.h>
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -67,7 +67,7 @@ int main (int argc, char ** argv)
neg = -pos;
zz = ComplexD(0.0,0.0);
Charge=zero;
Charge=Zero();
// Parallel plate capacitor
{
@ -90,7 +90,7 @@ int main (int argc, char ** argv)
std::vector<LatticeComplexD> k(4,&GRID);
LatticeComplexD ksq(&GRID);
ksq=zero;
ksq=Zero();
for(int mu=0;mu<nd;mu++) {
Integer L=latt_size[mu];

View File

@ -29,7 +29,6 @@ See the full license in the file "LICENSE" in the top level distribution directo
#include <Grid/Grid.h>
using namespace Grid;
using namespace QCD;
typedef PeriodicGaugeImpl<QedGImplR> QedPeriodicGImplR;
typedef PhotonR::GaugeField EmField;
@ -45,9 +44,9 @@ int main(int argc, char *argv[])
std::cout << GridLogMessage << "Grid initialized" << std::endl;
// QED stuff
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4, vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4, vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian grid(latt_size,simd_layout,mpi_layout);
GridParallelRNG pRNG(&grid);
PhotonR photon(&grid, PhotonR::Gauge::coulomb, PhotonR::ZmScheme::qedL);
@ -77,7 +76,7 @@ int main(int argc, char *argv[])
std::cout << GridLogMessage << "Spatial zero-mode norm 2" << std::endl;
sliceSum(a, zm, grid.Nd() - 1);
for (unsigned int t = 0; t < latt_size.back(); ++t)
for (unsigned int t = 0; t < latt_size.size(); ++t)
{
std::cout << GridLogMessage << "t = " << t << " " << std::sqrt(norm2(zm[t])) << std::endl;
}
@ -85,7 +84,7 @@ int main(int argc, char *argv[])
// Calculate divergence
EmComp diva(&grid), amu(&grid);
diva = zero;
diva = Zero();
for (unsigned int mu = 0; mu < grid.Nd(); ++mu)
{
amu = peekLorentz(a, mu);

View File

@ -30,7 +30,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -58,7 +58,6 @@ int main (int argc, char ** argv)
// SU3 colour operatoions
LatticeColourMatrix link(grid);
LatticeColourMatrix staple(grid);
int mu=0;
// Apply heatbath to the link
RealD beta=6.0;
@ -75,8 +74,8 @@ int main (int argc, char ** argv)
for( int cb=0;cb<2;cb++ ) {
one.checkerboard=subsets[cb];
mask= zero;
one.Checkerboard()=subsets[cb];
mask= Zero();
setCheckerboard(mask,one);
// std::cout<<GridLogMessage<<mask<<std::endl;

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(4,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);

View File

@ -30,15 +30,15 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -58,10 +58,10 @@ int main (int argc, char ** argv)
typename ImprovedStaggeredFermionR::ImplParams params;
FermionField src (&Grid); random(pRNG,src);
FermionField result(&Grid); result=zero;
FermionField ref(&Grid); ref=zero;
FermionField tmp(&Grid); tmp=zero;
FermionField err(&Grid); tmp=zero;
FermionField result(&Grid); result=Zero();
FermionField ref(&Grid); ref=Zero();
FermionField tmp(&Grid); tmp=Zero();
FermionField err(&Grid); tmp=Zero();
FermionField phi (&Grid); random(pRNG,phi);
FermionField chi (&Grid); random(pRNG,chi);
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
@ -82,7 +82,7 @@ int main (int argc, char ** argv)
*/
}
ref = zero;
ref = Zero();
RealD mass=0.1;
RealD c1=9.0/8.0;
@ -90,7 +90,7 @@ int main (int argc, char ** argv)
RealD u0=1.0;
{ // Simple improved staggered implementation
ref = zero;
ref = Zero();
RealD c1tad = 0.5*c1/u0;
RealD c2tad = 0.5*c2/u0/u0/u0;

View File

@ -30,15 +30,14 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
std::cout << GridLogMessage << "Making s innermost grids"<<std::endl;
@ -69,10 +68,10 @@ int main (int argc, char ** argv)
random(pRNG5,src);
FermionField result(FGrid); result=zero;
FermionField ref(FGrid); ref=zero;
FermionField tmp(FGrid); tmp=zero;
FermionField err(FGrid); tmp=zero;
FermionField result(FGrid); result=Zero();
FermionField ref(FGrid); ref=Zero();
FermionField tmp(FGrid); tmp=Zero();
FermionField err(FGrid); tmp=Zero();
FermionField phi (FGrid); random(pRNG5,phi);
FermionField chi (FGrid); random(pRNG5,chi);
@ -89,9 +88,11 @@ int main (int argc, char ** argv)
// replicate across fifth dimension
////////////////////////////////////
LatticeGaugeField Umu5d(FGrid);
for(int ss=0;ss<Umu._grid->oSites();ss++){
auto umu5d = Umu5d.View();
auto umu = Umu.View();
for(int ss=0;ss<Umu.Grid()->oSites();ss++){
for(int s=0;s<Ls;s++){
Umu5d._odata[Ls*ss+s] = Umu._odata[ss];
umu5d[Ls*ss+s] = umu[ss];
}
}
@ -107,7 +108,7 @@ int main (int argc, char ** argv)
RealD u0=1.0;
{ // Simple improved staggered implementation
ref = zero;
ref = Zero();
RealD c1tad = 0.5*c1/u0;
RealD c2tad = 0.5*c2/u0/u0/u0;

View File

@ -30,15 +30,16 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
#if 0
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=16;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
@ -70,15 +71,15 @@ int main (int argc, char ** argv)
FermionField src (FGrid);
random(pRNG5,src);
/*
std::vector<int> site({0,1,2,0,0});
ColourVector cv = zero;
Coordinate site({0,1,2,0,0});
ColourVector cv = Zero();
cv()()(0)=1.0;
src = zero;
src = Zero();
pokeSite(cv,src,site);
*/
FermionField result(FGrid); result=zero;
FermionField tmp(FGrid); tmp=zero;
FermionField err(FGrid); tmp=zero;
FermionField result(FGrid); result=Zero();
FermionField tmp(FGrid); tmp=Zero();
FermionField err(FGrid); tmp=Zero();
FermionField phi (FGrid); random(pRNG5,phi);
FermionField chi (FGrid); random(pRNG5,chi);
@ -88,7 +89,7 @@ int main (int argc, char ** argv)
/*
for(int mu=1;mu<4;mu++){
auto tmp = PeekIndex<LorentzIndex>(Umu,mu);
tmp = zero;
tmp = Zero();
PokeIndex<LorentzIndex>(Umu,tmp,mu);
}
*/
@ -129,9 +130,9 @@ int main (int argc, char ** argv)
std::cout<<GridLogMessage << "Calling vectorised staggered operator"<<std::endl;
#ifdef AVX512
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptInlineAsm;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptInlineAsm;
#else
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptGeneric;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptGeneric;
#endif
t0=usecond();
@ -150,9 +151,9 @@ int main (int argc, char ** argv)
FermionField ssrc (sFGrid); localConvert(src,ssrc);
FermionField sresult(sFGrid); sresult=zero;
FermionField sresult(sFGrid); sresult=Zero();
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptHandUnroll;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptHandUnroll;
t0=usecond();
for(int i=0;i<ncall1;i++){
sDs.Dhop(ssrc,sresult,0);
@ -167,9 +168,9 @@ int main (int argc, char ** argv)
#ifdef AVX512
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptInlineAsm;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptInlineAsm;
#else
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptGeneric;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptGeneric;
#endif
err = tmp-result;
@ -193,4 +194,5 @@ int main (int argc, char ** argv)
Grid_finalize();
#endif
}

View File

@ -30,15 +30,15 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
#if 0
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
const int Ls=16;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi());
@ -76,9 +76,9 @@ int main (int argc, char ** argv)
src = zero;
pokeSite(cv,src,site);
*/
FermionField result(FGrid); result=zero;
FermionField tmp(FGrid); tmp=zero;
FermionField err(FGrid); tmp=zero;
FermionField result(FGrid); result=Zero();
FermionField tmp(FGrid); tmp=Zero();
FermionField err(FGrid); tmp=Zero();
FermionField phi (FGrid); random(pRNG5,phi);
FermionField chi (FGrid); random(pRNG5,chi);
@ -88,7 +88,7 @@ int main (int argc, char ** argv)
/*
for(int mu=1;mu<4;mu++){
auto tmp = PeekIndex<LorentzIndex>(Umu,mu);
tmp = zero;
tmp = Zero();
PokeIndex<LorentzIndex>(Umu,tmp,mu);
}
*/
@ -129,9 +129,9 @@ int main (int argc, char ** argv)
std::cout<<GridLogMessage << "Calling vectorised staggered operator"<<std::endl;
#ifdef AVX512
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptInlineAsm;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptInlineAsm;
#else
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptGeneric;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptGeneric;
#endif
t0=usecond();
@ -150,9 +150,9 @@ int main (int argc, char ** argv)
FermionField ssrc (sFGrid); localConvert(src,ssrc);
FermionField sresult(sFGrid); sresult=zero;
FermionField sresult(sFGrid); sresult=Zero();
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptHandUnroll;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptHandUnroll;
t0=usecond();
for(int i=0;i<ncall1;i++){
sDs.Dhop(ssrc,sresult,0);
@ -167,9 +167,9 @@ int main (int argc, char ** argv)
#ifdef AVX512
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptInlineAsm;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptInlineAsm;
#else
QCD::StaggeredKernelsStatic::Opt=QCD::StaggeredKernelsStatic::OptGeneric;
StaggeredKernelsStatic::Opt=StaggeredKernelsStatic::OptGeneric;
#endif
err = tmp-result;
@ -193,4 +193,5 @@ int main (int argc, char ** argv)
Grid_finalize();
#endif
}

View File

@ -29,15 +29,14 @@
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main(int argc, char **argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -59,17 +58,17 @@ int main(int argc, char **argv)
FermionField src(&Grid);
random(pRNG, src);
FermionField result(&Grid);
result = zero;
result = Zero();
FermionField result2(&Grid);
result2 = zero;
result2 = Zero();
FermionField ref(&Grid);
ref = zero;
ref = Zero();
FermionField tmp(&Grid);
tmp = zero;
tmp = Zero();
FermionField err(&Grid);
err = zero;
err = Zero();
FermionField err2(&Grid);
err2 = zero;
err2 = Zero();
FermionField phi(&Grid);
random(pRNG, phi);
FermionField chi(&Grid);
@ -214,9 +213,9 @@ int main(int argc, char **argv)
std::cout << GridLogMessage << "= Testing gauge covariance Clover term with EO preconditioning " << std::endl;
std::cout << GridLogMessage << "================================================================" << std::endl;
chi = zero;
phi = zero;
tmp = zero;
chi = Zero();
phi = Zero();
tmp = Zero();
pickCheckerboard(Even, chi_e, chi);
pickCheckerboard(Odd, chi_o, chi);
pickCheckerboard(Even, phi_e, phi);
@ -236,9 +235,9 @@ int main(int argc, char **argv)
LatticeColourMatrix Omega(&Grid);
LatticeColourMatrix ShiftedOmega(&Grid);
LatticeGaugeField U_prime(&Grid);
U_prime = zero;
U_prime = Zero();
LatticeColourMatrix U_prime_mu(&Grid);
U_prime_mu = zero;
U_prime_mu = Zero();
SU<Nc>::LieRandomize(pRNG2, Omega, 1.0);
for (int mu = 0; mu < Nd; mu++)
{
@ -269,8 +268,8 @@ int main(int argc, char **argv)
std::cout << GridLogMessage << "= Testing gauge covariance Clover term w/o EO preconditioning " << std::endl;
std::cout << GridLogMessage << "================================================================" << std::endl;
chi = zero;
phi = zero;
chi = Zero();
phi = Zero();
WilsonFermionR Dw(Umu, Grid, RBGrid, mass, params);
Dw.ImportGauge(Umu);
@ -293,9 +292,9 @@ int main(int argc, char **argv)
std::cout << GridLogMessage << "= Testing Mooee(csw=0) Clover to reproduce Mooee Wilson " << std::endl;
std::cout << GridLogMessage << "==========================================================" << std::endl;
chi = zero;
phi = zero;
err = zero;
chi = Zero();
phi = Zero();
err = Zero();
WilsonCloverFermionR Dwc_csw0(Umu, Grid, RBGrid, mass, 0.0, 0.0, anis, params); // <-- Notice: csw=0
Dwc_csw0.ImportGauge(Umu);
@ -323,9 +322,9 @@ int main(int argc, char **argv)
std::cout << GridLogMessage << "= Testing EO operator is equal to the unprec " << std::endl;
std::cout << GridLogMessage << "==========================================================" << std::endl;
chi = zero;
phi = zero;
err = zero;
chi = Zero();
phi = Zero();
err = Zero();
pickCheckerboard(Even, phi_e, phi);
pickCheckerboard(Odd, phi_o, phi);

View File

@ -29,7 +29,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class d>
struct scal {
@ -47,9 +46,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -66,11 +65,12 @@ int main (int argc, char ** argv)
LatticeFermion src (&Grid); random(pRNG,src);
LatticeFermion phi (&Grid); random(pRNG,phi);
LatticeFermion chi (&Grid); random(pRNG,chi);
LatticeFermion result(&Grid); result=zero;
LatticeFermion ref(&Grid); ref=zero;
LatticeFermion tmp(&Grid); tmp=zero;
LatticeFermion err(&Grid); tmp=zero;
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
LatticeFermion result(&Grid); result=Zero();
LatticeFermion ref(&Grid); ref=Zero();
LatticeFermion tmp(&Grid); tmp=Zero();
LatticeFermion err(&Grid); tmp=Zero();
LatticeGaugeField Umu(&Grid);
SU3::HotConfiguration(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid);
double volume=1;
@ -79,7 +79,7 @@ int main (int argc, char ** argv)
}
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(pRNG,U[nn]);
std::cout<<GridLogMessage<<"U[nn]"<<norm2(U[nn])<<std::endl;

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -48,9 +48,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -67,10 +67,10 @@ int main (int argc, char ** argv)
LatticeFermion src (&Grid); random(pRNG,src);
LatticeFermion phi (&Grid); random(pRNG,phi);
LatticeFermion chi (&Grid); random(pRNG,chi);
LatticeFermion result(&Grid); result=zero;
LatticeFermion ref(&Grid); ref=zero;
LatticeFermion tmp(&Grid); tmp=zero;
LatticeFermion err(&Grid); tmp=zero;
LatticeFermion result(&Grid); result=Zero();
LatticeFermion ref(&Grid); ref=Zero();
LatticeFermion tmp(&Grid); tmp=Zero();
LatticeFermion err(&Grid); tmp=Zero();
LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu);
std::vector<LatticeColourMatrix> U(4,&Grid);
@ -80,7 +80,7 @@ int main (int argc, char ** argv)
}
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(pRNG,U[nn]);
std::cout<<GridLogMessage<<"U[nn]"<<norm2(U[nn])<<std::endl;

View File

@ -30,7 +30,6 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class d>
struct scal {
@ -52,7 +51,6 @@ int main (int argc, char ** argv)
int threads = GridThread::GetThreads();
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
const int Ls=10;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
@ -68,25 +66,25 @@ int main (int argc, char ** argv)
LatticeFermion src (FGrid); random(RNG5,src);
LatticeFermion phi (FGrid); random(RNG5,phi);
LatticeFermion chi (FGrid); random(RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeGaugeField Umu(UGrid); random(RNG4,Umu);
std::vector<LatticeColourMatrix> U(4,UGrid);
// Only one non-zero (y)
Umu=zero;
Umu=Zero();
for(int nn=0;nn<Nd;nn++){
random(RNG4,U[nn]);
if ( nn>0 )
U[nn]=zero;
U[nn]=Zero();
PokeIndex<LorentzIndex>(Umu,U[nn],nn);
}
RealD mass=0.1;
RealD M5 =1.8;
std::vector < std::complex<double> > omegas;
std::vector < ComplexD > omegas;
#if 0
for(int i=0;i<Ls;i++){
double imag = 0.;
@ -107,9 +105,25 @@ int main (int argc, char ** argv)
omegas.push_back( std::complex<double>(0.0686324988446592,0.0550658530827402) );
omegas.push_back( std::complex<double>(0.0686324988446592,-0.0550658530827402) );
#endif
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,1.,0.);
// DomainWallFermionR Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
/*
argument types are: (Grid::LatticeGaugeField,
Grid::GridCartesian,
Grid::GridRedBlackCartesian,
Grid::GridCartesian,
Grid::GridRedBlackCartesian,
Grid::RealD,
Grid::RealD,
std::__1::vector<std::__1::complex<double>,
std::__1::allocator<std::__1::complex<double>>>, double, double)
ZMobiusFermion(GaugeField &_Umu,
GridCartesian &FiveDimGrid,
GridRedBlackCartesian &FiveDimRedBlackGrid,
GridCartesian &FourDimGrid,
GridRedBlackCartesian &FourDimRedBlackGrid,
RealD _mass,RealD _M5,
std::vector<ComplexD> &gamma, RealD b,RealD c,const ImplParams &p= ImplParams()) :
*/
ZMobiusFermionR Ddwf(Umu, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mass, M5, omegas,RealD(1.),RealD(0.));
LatticeFermion src_e (FrbGrid);
LatticeFermion src_o (FrbGrid);

View File

@ -30,19 +30,9 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
template<class d>
struct scal {
d internal;
};
Gamma::Algebra Gmu [] = {
Gamma::Algebra::GammaX,
Gamma::Algebra::GammaY,
Gamma::Algebra::GammaZ,
Gamma::Algebra::GammaT
};
template<class What>
void TestCGinversions(What & Ddwf,
@ -184,7 +174,7 @@ int main (int argc, char ** argv)
std::cout<<GridLogMessage <<"======================"<<std::endl;
std::cout<<GridLogMessage <<"OverlapWilsonCayleyTanhFermion test"<<std::endl;
std::cout<<GridLogMessage <<"======================"<<std::endl;
OverlapWilsonCayleyTanhFermionR Dov (Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,1.0);
OverlapWilsonCayleyTanhFermionR Dov(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,1.0);
OverlapWilsonCayleyTanhFermionF DovF(UmuF,*FGridF,*FrbGridF,*UGridF,*UrbGridF,mass,M5,1.0);
TestCGinversions<OverlapWilsonCayleyTanhFermionR>(Dov,Umu,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5);
TestReconstruct5DFA<OverlapWilsonCayleyTanhFermionR,OverlapWilsonCayleyTanhFermionF>(Dov,DovF,Umu,FGrid,FrbGrid,UGrid,UrbGrid,mass,M5,&RNG4,&RNG5);
@ -225,7 +215,7 @@ void TestCGunprec(What & Ddwf,
GridParallelRNG *RNG5)
{
LatticeFermion src (FGrid); random(*RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion result(FGrid); result=Zero();
MdagMLinearOperator<What,LatticeFermion> HermOp(Ddwf);
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
@ -244,7 +234,7 @@ void TestCGprec(What & Ddwf,
LatticeFermion src_o(FrbGrid);
LatticeFermion result_o(FrbGrid);
pickCheckerboard(Odd,src_o,src);
result_o=zero;
result_o=Zero();
SchurDiagMooeeOperator<What,LatticeFermion> HermOpEO(Ddwf);
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
@ -261,7 +251,7 @@ void TestReconstruct5D(What & Ddwf,
GridParallelRNG *RNG5)
{
LatticeFermion src4 (UGrid); random(*RNG4,src4);
LatticeFermion res4 (UGrid); res4 = zero;
LatticeFermion res4 (UGrid); res4 = Zero();
LatticeFermion src (FGrid);
LatticeFermion src_NE(FGrid);
@ -332,7 +322,7 @@ void TestReconstruct5DFA(What & Ddwf,
GridParallelRNG *RNG5)
{
LatticeFermion src4 (UGrid); random(*RNG4,src4);
LatticeFermion res4 (UGrid); res4 = zero;
LatticeFermion res4 (UGrid); res4 = Zero();
LatticeFermion src (FGrid);
LatticeFermion src_NE(FGrid);
@ -402,7 +392,7 @@ void TestCGschur(What & Ddwf,
GridParallelRNG *RNG5)
{
LatticeFermion src (FGrid); random(*RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion result(FGrid); result=Zero();
ConjugateGradient<LatticeFermion> CG(1.0e-8,10000);
SchurRedBlackDiagMooeeSolve<LatticeFermion> SchurSolver(CG);

View File

@ -30,7 +30,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
@ -58,7 +58,7 @@ int main (int argc, char ** argv)
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
// Construct a coarsened grid
std::vector<int> clatt = GridDefaultLatt();
Coordinate clatt = GridDefaultLatt();
for(int d=0;d<clatt.size();d++){
clatt[d] = clatt[d]/2;
}
@ -73,19 +73,19 @@ int main (int argc, char ** argv)
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
LatticeFermion src(FGrid); random(RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid);
LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu);
#if 0
std::vector<LatticeColourMatrix> U(4,UGrid);
Umu=zero;
Umu=Zero();
Complex cone(1.0,0.0);
for(int nn=0;nn<Nd;nn++){
if(1) {
if (nn>2) { U[nn]=zero; std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; }
if (nn>2) { U[nn]=Zero(); std::cout<<GridLogMessage << "zeroing gauge field in dir "<<nn<<std::endl; }
else { U[nn]=cone; std::cout<<GridLogMessage << "unit gauge field in dir "<<nn<<std::endl; }
}
pokeIndex<LorentzIndex>(Umu,U[nn],nn);
@ -120,6 +120,7 @@ int main (int argc, char ** argv)
MdagMLinearOperator<DomainWallFermionR,LatticeFermion> HermDefOp(Ddwf);
typedef Aggregation<vSpinColourVector,vTComplex,nbasis> Subspace;
Subspace Aggregates(Coarse5d,FGrid,cb);
Aggregates.CreateSubspaceRandom(RNG5);
@ -143,7 +144,7 @@ int main (int argc, char ** argv)
blockPromote(c_src,err,subspace);
prom=zero;
prom=Zero();
for(int b=0;b<nbasis;b++){
prom=prom+subspace[b];
}

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class d>
struct scal {
@ -127,10 +127,10 @@ void TestWhat(What & Ddwf,
LatticeFermion src (FGrid); random(*RNG5,src);
LatticeFermion phi (FGrid); random(*RNG5,phi);
LatticeFermion chi (FGrid); random(*RNG5,chi);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion tmp(FGrid); tmp=zero;
LatticeFermion err(FGrid); tmp=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid); tmp=Zero();
LatticeFermion err(FGrid); tmp=Zero();
LatticeFermion src_e (FrbGrid);
LatticeFermion src_o (FrbGrid);

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
@ -46,7 +46,7 @@ int main (int argc, char ** argv)
///////////////////////////////////////////////////
// Construct a coarsened grid; utility for this?
///////////////////////////////////////////////////
std::vector<int> clatt = GridDefaultLatt();
Coordinate clatt = GridDefaultLatt();
for(int d=0;d<clatt.size();d++){
clatt[d] = clatt[d]/2;
}
@ -61,8 +61,8 @@ int main (int argc, char ** argv)
GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds);
LatticeFermion src(FGrid); gaussian(RNG5,src);
LatticeFermion result(FGrid); result=zero;
LatticeFermion ref(FGrid); ref=zero;
LatticeFermion result(FGrid); result=Zero();
LatticeFermion ref(FGrid); ref=Zero();
LatticeFermion tmp(FGrid);
LatticeFermion err(FGrid);
LatticeGaugeField Umu(UGrid);
@ -74,7 +74,7 @@ int main (int argc, char ** argv)
// SU3::ColdConfiguration(RNG4,Umu);
// SU3::TepidConfiguration(RNG4,Umu);
// SU3::HotConfiguration(RNG4,Umu);
// Umu=zero;
// Umu=Zero();
RealD mass=0.1;
RealD M5=1.5;
@ -99,14 +99,13 @@ int main (int argc, char ** argv)
Subspace Aggregates(Coarse5d,FGrid,cb);
Aggregates.CreateSubspace(RNG5,HermDefOp);
LittleDiracOperator LittleDiracOp(*Coarse5d);
LittleDiracOp.CoarsenOperator(FGrid,HermIndefOp,Aggregates);
CoarseVector c_src (Coarse5d);
CoarseVector c_res (Coarse5d);
gaussian(CRNG,c_src);
c_res=zero;
c_res=Zero();
std::cout<<GridLogMessage << "**************************************************"<< std::endl;
std::cout<<GridLogMessage << "Solving mdagm-CG on coarse space "<< std::endl;

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
RealD InverseApproximation(RealD x){
return 1.0/x;

View File

@ -38,7 +38,7 @@ Author: David Murphy <dmurphy@phys.columbia.edu>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
// Parameters for test
const std::vector<int> grid_dim = { 8, 8, 8, 8 };

View File

@ -38,7 +38,7 @@ Author: David Murphy <dmurphy@phys.columbia.edu>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
typedef GparityWilsonImplR FermionImplPolicy;
typedef GparityDomainWallEOFAFermionR FermionAction;

View File

@ -38,7 +38,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
// Parameters for test
const std::vector<int> grid_dim = { 8, 8, 8, 8 };

View File

@ -38,7 +38,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
typedef GparityWilsonImplR FermionImplPolicy;
typedef GparityMobiusEOFAFermionR FermionAction;

View File

@ -31,7 +31,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
// parameters for test
const std::vector<int> grid_dim = { 8, 8, 8, 8 };
@ -178,7 +178,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pminus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_L.Omega(spProj_Phi, tmp[0], -1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_L, tmp[1], tmp[0]);
Deofa_L.Omega(tmp[0], tmp[1], -1, 1);
rw_eofa[hit] = -k*innerProduct(spProj_Phi,tmp[1]).real();
@ -187,7 +187,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pplus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_R.Omega(spProj_Phi, tmp[0], 1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_R, tmp[1], tmp[0]);
Deofa_R.Omega(tmp[0], tmp[1], 1, 1);
rw_eofa[hit] += k*innerProduct(spProj_Phi,tmp[1]).real();

View File

@ -31,7 +31,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
typedef typename GparityDomainWallFermionR::FermionField FermionField;
@ -181,7 +181,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pminus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_L.Omega(spProj_Phi, tmp[0], -1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_L, tmp[1], tmp[0]);
Deofa_L.Omega(tmp[0], tmp[1], -1, 1);
rw_eofa[hit] = -k*innerProduct(spProj_Phi,tmp[1]).real();
@ -190,7 +190,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pplus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_R.Omega(spProj_Phi, tmp[0], 1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_R, tmp[1], tmp[0]);
Deofa_R.Omega(tmp[0], tmp[1], 1, 1);
rw_eofa[hit] += k*innerProduct(spProj_Phi,tmp[1]).real();

View File

@ -31,7 +31,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
// parameters for test
const std::vector<int> grid_dim = { 8, 8, 8, 8 };
@ -185,7 +185,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pminus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_L.Omega(spProj_Phi, tmp[0], -1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_L, tmp[1], tmp[0]);
Deofa_L.Dtilde(tmp[0], tmp[1]);
Deofa_L.Omega(tmp[1], tmp[0], -1, 1);
@ -195,7 +195,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pplus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_R.Omega(spProj_Phi, tmp[0], 1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_R, tmp[1], tmp[0]);
Deofa_R.Dtilde(tmp[0], tmp[1]);
Deofa_R.Omega(tmp[1], tmp[0], 1, 1);

View File

@ -31,7 +31,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
typedef typename GparityDomainWallFermionR::FermionField FermionField;
@ -188,7 +188,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pminus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_L.Omega(spProj_Phi, tmp[0], -1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_L, tmp[1], tmp[0]);
Deofa_L.Dtilde(tmp[0], tmp[1]);
Deofa_L.Omega(tmp[1], tmp[0], -1, 1);
@ -198,7 +198,7 @@ int main(int argc, char **argv)
for(int s=0; s<Ls; ++s){ axpby_ssp_pplus(spProj_Phi, 0.0, Phi, 1.0, Phi, s, s); }
Deofa_R.Omega(spProj_Phi, tmp[0], 1, 0);
G5R5(tmp[1], tmp[0]);
tmp[0] = zero;
tmp[0] = Zero();
SchurSolver(Deofa_R, tmp[1], tmp[0]);
Deofa_R.Dtilde(tmp[0], tmp[1]);
Deofa_R.Omega(tmp[1], tmp[0], 1, 1);

View File

@ -29,7 +29,6 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
@ -38,13 +37,13 @@ int main (int argc, char ** argv)
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
Coordinate latt_size = GridDefaultLatt();
int nd = latt_size.size();
int ndm1 = nd-1;
std::vector<int> simd_layout = GridDefaultSimd(nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
std::vector<int> mpi_split (mpi_layout.size(),1);
Coordinate simd_layout = GridDefaultSimd(nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
Coordinate mpi_split (mpi_layout.size(),1);
std::cout << " Full " << GridCmdVectorIntToString(latt_size) << " subgrid" <<std::endl;
std::cout << " Full " << GridCmdVectorIntToString(mpi_layout) << " sub communicator"<<std::endl;
@ -54,9 +53,9 @@ int main (int argc, char ** argv)
simd_layout,
mpi_layout);
std::vector<int> latt_m = latt_size; latt_m[nd-1] = 1;
std::vector<int> mpi_m = mpi_layout; mpi_m [nd-1] = 1;
std::vector<int> simd_m = GridDefaultSimd(ndm1,vComplex::Nsimd()); simd_m.push_back(1);
Coordinate latt_m = latt_size; latt_m[nd-1] = 1;
Coordinate mpi_m = mpi_layout; mpi_m [nd-1] = 1;
Coordinate simd_m = GridDefaultSimd(ndm1,vComplex::Nsimd()); simd_m.push_back(1);
std::cout << " Requesting " << GridCmdVectorIntToString(latt_m)<< " subgrid" <<std::endl;
@ -88,7 +87,7 @@ int main (int argc, char ** argv)
auto local_latt = GridN->LocalDimensions();
Full_cpy = zero;
Full_cpy = Zero();
std::vector<int> seeds({1,2,3,4});
GridParallelRNG RNG(GridN); RNG.SeedFixedIntegers(seeds);

View File

@ -1,494 +0,0 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./tests/Test_zmm.cc
Copyright (C) 2015
Author: paboyle <paboyle@ph.ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/Grid.h>
#ifdef TEST_ZMM
int main(int argc,char **argv)
{
return 0;
}
#if 0
#include <simd/Intel512wilson.h>
using namespace Grid;
using namespace Grid::QCD;
void ZmulF(void *ptr1,void *ptr2,void *ptr3);
void Zmul(void *ptr1,void *ptr2,void *ptr3);
void WilsonDslashAvx512(void *ptr1,void *ptr2,void *ptr3);
void WilsonDslashAvx512F(void *ptr1,void *ptr2,void *ptr3);
void TimesIAvx512F(void *ptr1,void *ptr3);
void TimesIAvx512(void *ptr1,void *ptr3);
void TimesMinusIAvx512F(void *ptr1,void *ptr3);
void TimesMinusIAvx512(void *ptr1,void *ptr3);
int main(int argc,char **argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt4 = GridDefaultLatt();
const int Ls=16;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(latt4, GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
int threads = GridThread::GetThreads();
std::vector<int> seeds4({1,2,3,4});
std::vector<int> seeds5({5,6,7,8});
GridSerialRNG sRNG; sRNG.SeedFixedIntegers(seeds4);
vColourMatrixD mat;
vHalfSpinColourVectorD vec;
vHalfSpinColourVectorD vec1;
vHalfSpinColourVectorD vec2;
vHalfSpinColourVectorD vec3;
vHalfSpinColourVectorD matvec;
vHalfSpinColourVectorD ref;
vComplexD err;
random(sRNG,vec1);
vec1 = std::complex<double>(0.1,3.0);
random(sRNG,vec2);
vec2=2.0;
random(sRNG,vec3);
//std::cout << "Zmul vec1"<<vec1<<" &vec1 "<<& vec1<<std::endl;
//std::cout << "Zmul vec2"<<vec2<<" &vec2 "<<& vec2<<std::endl;
//std::cout << "Zmul vec3"<<vec3<<" &vec3 "<<& vec3<<std::endl;
for(int sp=0;sp<2;sp++){
for(int co=0;co<3;co++){
ref()(sp)(co) = vec1()(sp)(co)*vec2()(sp)(co);
}}
Zmul((void *)&vec1,(void *)&vec2,(void *)&vec3);
//std::cout << "Zmul vec3"<<vec3<<" &vec3 "<<& vec3<<std::endl;
//std::cout << "Zmul \n\t ref "<<ref<<"\n\t vec3"<<vec3 <<std::endl;
ref = ref - vec3;
err = TensorRemove(innerProduct(ref,ref));
std::cout <<"Zmul diff "<< Reduce(err)<<std::endl;
random(sRNG,mat);
mat = zero;
mat()()(0,0) = 1.0;
random(sRNG,vec);
ref = mat*vec;
WilsonDslashAvx512((void *)&vec, (void *)&mat,(void *)&matvec);
//std::cout << ref <<std::endl;
//std::cout << matvec<<std::endl;
ref = ref - matvec;
err = TensorRemove(innerProduct(ref,ref));
std::cout <<"Double SU3 x 2spin diff "<< Reduce(err)<<std::endl;
vColourMatrixF matF;
vHalfSpinColourVectorF vec1F;
vHalfSpinColourVectorF vec2F;
vHalfSpinColourVectorF vec3F;
vHalfSpinColourVectorF vecF;
vHalfSpinColourVectorF matvecF;
vHalfSpinColourVectorF refF;
vComplexF errF;
random(sRNG,matF);
matF = zero;
matF()()(0,0)=1.0;
random(sRNG,vecF);
refF = matF*vecF;
WilsonDslashAvx512F((void *)&vecF, (void *)&matF,(void *)&matvecF);
//std::cout << refF <<std::endl;
//std::cout << matvecF<<std::endl;
refF = refF-matvecF;
errF = TensorRemove(innerProduct(refF,refF));
std::cout <<"Single SU3 x 2spin diff "<< Reduce(errF)<<std::endl;
TimesIAvx512F((void *)&vecF,(void *)&matvecF);
//std::cout << timesI(vecF)<<std::endl;
//std::cout << matvecF<<std::endl;
refF = timesI(vecF)-matvecF;
errF = TensorRemove(innerProduct(refF,refF));
std::cout <<" timesI single diff "<< Reduce(errF)<<std::endl;
TimesIAvx512((void *)&vec,(void *)&matvec);
//std::cout << timesI(vec)<<std::endl;
//std::cout << matvec<<std::endl;
ref = timesI(vec)-matvec;
err = TensorRemove(innerProduct(ref,ref));
std::cout <<" timesI double diff "<< Reduce(err)<<std::endl;
TimesMinusIAvx512F((void *)&vecF,(void *)&matvecF);
//std::cout << timesMinusI(vecF)<<std::endl;
//std::cout << matvecF<<std::endl;
refF = timesMinusI(vecF)-matvecF;
errF = TensorRemove(innerProduct(refF,refF));
std::cout <<" timesMinusI single diff "<< Reduce(errF)<<std::endl;
TimesMinusIAvx512((void *)&vec,(void *)&matvec);
//std::cout << timesMinusI(vec)<<std::endl;
//std::cout << matvec<<std::endl;
ref = timesMinusI(vec)-matvec;
err = TensorRemove(innerProduct(ref,ref));
std::cout <<" timesMinusI double diff "<< Reduce(err)<<std::endl;
LatticeFermion src (FGrid);
LatticeFermion tmp (FGrid);
LatticeFermion srce(FrbGrid);
LatticeFermion resulto(FrbGrid); resulto=zero;
LatticeFermion resulta(FrbGrid); resulta=zero;
LatticeFermion diff(FrbGrid);
LatticeGaugeField Umu(UGrid);
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
random(RNG5,src);
#if 1
SU3::HotConfiguration(RNG4,Umu);
#else
int mmu=2;
std::vector<LatticeColourMatrix> U(4,UGrid);
for(int mu=0;mu<Nd;mu++){
U[mu] = PeekIndex<LorentzIndex>(Umu,mu);
if ( mu!=mmu ) U[mu] = zero;
if ( mu==mmu ) U[mu] = 1.0;
PokeIndex<LorentzIndex>(Umu,U[mu],mu);
}
#endif
pickCheckerboard(Even,srce,src);
RealD mass=0.1;
RealD M5 =1.8;
DomainWallFermionR Dw(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5);
std::cout<<GridLogMessage << "Calling Dw"<<std::endl;
int ncall=50;
double t0=usecond();
for(int i=0;i<ncall;i++){
Dw.DhopOE(srce,resulto,0);
}
double t1=usecond();
double volume=Ls; for(int mu=0;mu<Nd;mu++) volume=volume*latt4[mu];
double flops=1344*volume/2;
std::cout<<GridLogMessage << "Called Dw"<<std::endl;
std::cout<<GridLogMessage << "norm result "<< norm2(resulto)<<std::endl;
std::cout<<GridLogMessage << "mflop/s = "<< flops*ncall/(t1-t0)<<std::endl;
QCD::WilsonFermion5DStatic::AsmOptDslash=1;
t0=usecond();
for(int i=0;i<ncall;i++){
Dw.DhopOE(srce,resulta,0);
}
t1=usecond();
#if 1
for(int i=0;i< PerformanceCounter::NumTypes(); i++ ){
Dw.DhopOE(srce,resulta,0);
PerformanceCounter Counter(i);
Counter.Start();
Dw.DhopOE(srce,resulta,0);
Counter.Stop();
Counter.Report();
}
#endif
//resulta = (-0.5) * resulta;
std::cout<<GridLogMessage << "Called Asm Dw"<<std::endl;
std::cout<<GridLogMessage << "norm result "<< norm2(resulta)<<std::endl;
std::cout<<GridLogMessage << "mflop/s = "<< flops*ncall/(t1-t0)<<std::endl;
diff = resulto-resulta;
std::cout<<GridLogMessage << "diff "<< norm2(diff)<<std::endl;
std::cout<<std::endl;
#if 0
std::cout<<"=========== result Grid ============="<<std::endl;
std::cout<<std::endl;
tmp = zero;
setCheckerboard(tmp,resulto);
std::cout<<tmp<<std::endl;
std::cout<<std::endl;
std::cout<<"=========== result ASM ============="<<std::endl;
std::cout<<std::endl;
tmp = zero;
setCheckerboard(tmp,resulta);
std::cout<<tmp<<std::endl;
#endif
}
#include <simd/Intel512double.h>
#define zz Z0
void Zmul(void *ptr1,void *ptr2,void *ptr3)
{
__asm__ ("mov $0xAAAA, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k6 " : : :);
__asm__ ("mov $0x5555, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k7 " : : :);
#define CC result_00
LOAD64(%r9,ptr1);
LOAD64(%r8,ptr2);
LOAD64(%r10,ptr3)
__asm__ (
VLOAD(0,%r8,CC)
ZLOAD(0,%r9,Chi_00,Z0)
ZMUL(Chi_00,Z0,CC,UChi_00,Z1)
//VSTORE(0,%r10,UChi_00)
//VSTORE(1,%r10,Z1)
ZEND1(UChi_00,Z1,Z0)
//VSTORE(2,%r10,UChi_00)
ZEND2(UChi_00,Z1,Z0)
//VSTORE(3,%r10,UChi_00)
VSTORE(0,%r10,UChi_00)
VLOAD(1,%r8,CC)
ZLOAD(1,%r9,Chi_01,Z0)
ZMUL(Chi_01,Z0,CC,UChi_01,Z1)
ZEND1(UChi_01,Z1,Z0)
ZEND2(UChi_01,Z1,Z0)
VSTORE(1,%r10,UChi_01)
VLOAD(2,%r8,CC)
ZLOAD(2,%r9,Chi_02,Z0)
ZMUL(Chi_02,Z0,CC,UChi_02,Z1)
ZEND1(UChi_02,Z1,Z0)
ZEND2(UChi_02,Z1,Z0)
VSTORE(2,%r10,UChi_02)
VLOAD(3,%r8,CC)
ZLOAD(3,%r9,Chi_10,Z0)
ZMUL(Chi_10,Z0,CC,UChi_10,Z1)
ZEND1(UChi_10,Z1,Z0)
ZEND2(UChi_10,Z1,Z0)
VSTORE(3,%r10,UChi_10)
VLOAD(4,%r8,CC)
ZLOAD(4,%r9,Chi_11,Z0)
ZMUL(Chi_11,Z0,CC,UChi_11,Z1)
ZEND1(UChi_11,Z1,Z0)
ZEND2(UChi_11,Z1,Z0)
VSTORE(4,%r10,UChi_11)
VLOAD(5,%r8,CC)
ZLOAD(5,%r9,Chi_12,Z0)
ZMUL(Chi_12,Z0,CC,UChi_12,Z1)
ZEND1(UChi_12,Z1,Z0)
ZEND2(UChi_12,Z1,Z0)
VSTORE(5,%r10,UChi_12)
);
}
void TimesMinusIAvx512(void *ptr1,void *ptr3)
{
__asm__ ("mov $0xAAAA, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k6 " : : :);
__asm__ ("mov $0x5555, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k7 " : : :);
MASK_REGS;
LOAD_CHI(ptr1);
__asm__ (
VZERO(zz)
VTIMESMINUSI(Chi_00,UChi_00,zz)
VTIMESMINUSI(Chi_01,UChi_01,zz)
VTIMESMINUSI(Chi_02,UChi_02,zz)
VTIMESMINUSI(Chi_10,UChi_10,zz)
VTIMESMINUSI(Chi_11,UChi_11,zz)
VTIMESMINUSI(Chi_12,UChi_12,zz)
);
SAVE_UCHI(ptr3);
}
void TimesIAvx512(void *ptr1,void *ptr3)
{
__asm__ ("mov $0xAAAA, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k6 " : : :);
__asm__ ("mov $0x5555, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k7 " : : :);
MASK_REGS;
LOAD_CHI(ptr1);
__asm__ (
VZERO(zz)
VTIMESI(Chi_00,UChi_00,zz)
VTIMESI(Chi_01,UChi_01,zz)
VTIMESI(Chi_02,UChi_02,zz)
VTIMESI(Chi_10,UChi_10,zz)
VTIMESI(Chi_11,UChi_11,zz)
VTIMESI(Chi_12,UChi_12,zz)
);
SAVE_UCHI(ptr3);
}
void WilsonDslashAvx512(void *ptr1,void *ptr2,void *ptr3)
{
int return_address;
// prototype computed goto to eliminate ABI save restore on call/return in
// generated assembly.
static void * table[] = { &&save, &&mult };
MASK_REGS;
LOAD_CHI(ptr1);
return_address = 0;
goto mult;
save:
SAVE_UCHI(ptr3);
return;
mult:
MULT_2SPIN(ptr2);
goto *table[return_address];
}
#include <simd/Intel512single.h>
void ZmulF(void *ptr1,void *ptr2,void *ptr3)
{
__asm__ ("mov $0xAAAA, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k6 " : : :);
__asm__ ("mov $0x5555, %%eax " : : :"%eax");
__asm__ ("kmovw %%eax, %%k7 " : : :);
MASK_REGS;
ZLOAD(0,ptr1,Chi_00,Z0);
ZLOAD(1,ptr1,Chi_01,Z1);
ZLOAD(2,ptr1,Chi_02,Z2);
ZLOAD(3,ptr1,Chi_10,Z3);
ZLOAD(4,ptr1,Chi_11,Z4);
ZLOAD(5,ptr1,Chi_12,Z5);
VLOAD(0,ptr2,Chi_20);
VLOAD(1,ptr2,Chi_21);
VLOAD(2,ptr2,Chi_22);
VLOAD(3,ptr2,Chi_30);
VLOAD(4,ptr2,Chi_31);
VLOAD(5,ptr2,Chi_32);
ZMUL(Chi_00,Z0,Chi_20,UChi_00,UChi_20);
ZMUL(Chi_01,Z1,Chi_21,UChi_01,UChi_21);
ZMUL(Chi_02,Z2,Chi_22,UChi_02,UChi_22);
ZMUL(Chi_10,Z3,Chi_23,UChi_10,UChi_30);
ZMUL(Chi_11,Z4,Chi_24,UChi_11,UChi_31);
ZMUL(Chi_12,Z5,Chi_25,UChi_12,UChi_32);
ZEND1(UChi_00,UChi_20,Z0);
ZEND1(UChi_01,UChi_21,Z1);
ZEND1(UChi_02,UChi_22,Z2);
ZEND1(UChi_10,UChi_30,Z3);
ZEND1(UChi_11,UChi_31,Z4);
ZEND1(UChi_12,UChi_32,Z5);
ZEND2(UChi_00,UChi_20,Z0);
ZEND2(UChi_01,UChi_21,Z1);
ZEND2(UChi_02,UChi_22,Z2);
ZEND2(UChi_10,UChi_30,Z3);
ZEND2(UChi_11,UChi_31,Z4);
ZEND2(UChi_12,UChi_32,Z5);
SAVE_UCHI(ptr3);
}
void TimesMinusIAvx512F(void *ptr1,void *ptr3)
{
MASK_REGS;
LOAD_CHI(ptr1);
__asm__ (
VZERO(zz)
VTIMESMINUSI(Chi_00,UChi_00,zz)
VTIMESMINUSI(Chi_01,UChi_01,zz)
VTIMESMINUSI(Chi_02,UChi_02,zz)
VTIMESMINUSI(Chi_10,UChi_10,zz)
VTIMESMINUSI(Chi_11,UChi_11,zz)
VTIMESMINUSI(Chi_12,UChi_12,zz)
);
SAVE_UCHI(ptr3);
}
void TimesIAvx512F(void *ptr1,void *ptr3)
{
MASK_REGS;
LOAD_CHI(ptr1);
__asm__ (
VZERO(zz)
VTIMESI(Chi_00,UChi_00,zz)
VTIMESI(Chi_01,UChi_01,zz)
VTIMESI(Chi_02,UChi_02,zz)
VTIMESI(Chi_10,UChi_10,zz)
VTIMESI(Chi_11,UChi_11,zz)
VTIMESI(Chi_12,UChi_12,zz)
);
SAVE_UCHI(ptr3);
}
void WilsonDslashAvx512F(void *ptr1,void *ptr2,void *ptr3)
{
MASK_REGS;
LOAD_CHI(ptr1);
MULT_ADDSUB_2SPIN(ptr2);
//MULT_2SPIN(ptr2);
SAVE_UCHI(ptr3);
return;
}
#endif
#else
int main(int argc, char **argv)
{
std::cerr << "error: no ZMM test for the selected architecture" << std::endl;
return 1;
}
#endif

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
template<class vobj>
class LinearOperator {
@ -81,10 +81,10 @@ class LinearOperatorJacobi : public LinearOperator<vobj>
vobj *nbr;
if ( local && perm ){
permute(tmp,src._odata[offset],ptype);
permute(tmp,src[offset],ptype);
nbr = &tmp;
} else if (local) {
nbr = &src._odata[offset];
nbr = &src[offset];
} else {
nbr = &comm_buf[offset];
}
@ -182,18 +182,18 @@ int main (int argc, char ** argv)
Bar = Cshift(Foo,dir,disp);
// Implement a stencil code that should agree with cshift!
for(int i=0;i<Check._grid->oSites();i++){
for(int i=0;i<Check.Grid()->oSites();i++){
int offset = myStencil._offsets [0][i];
int local = myStencil._is_local[0][i];
int permute_type = myStencil._permute_type[0];
int perm =myStencil._permute[0][i];
if ( local && perm )
permute(Check._odata[i],Foo._odata[offset],permute_type);
permute(Check[i],Foo[offset],permute_type);
else if (local)
Check._odata[i] = Foo._odata[offset];
Check[i] = Foo[offset];
else
Check._odata[i] = comm_buf[offset];
Check[i] = comm_buf[offset];
}

View File

@ -29,15 +29,14 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=9;
@ -99,18 +98,20 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
auto U_v = U.View();
thread_foreach( i,mom_v,{
Uprime_v[i](mu) =
U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
});
}
Dcf.ImportGauge(Uprime);
@ -123,7 +124,7 @@ int main (int argc, char ** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
@ -46,18 +46,7 @@ int main (int argc, char ** argv)
GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
// Want a different conf at every run
// First create an instance of an engine.
std::random_device rnd_device;
// Specify the engine and distribution.
std::mt19937 mersenne_engine(rnd_device());
std::uniform_int_distribution<int> dist(1, 100);
auto gen = std::bind(dist, mersenne_engine);
std::vector<int> seeds4(4);
generate(begin(seeds4), end(seeds4), gen);
//std::vector<int> seeds4({1,2,3,5});
std::vector<int> seeds4({1,2,3,5});
std::vector<int> seeds5({5,6,7,8});
GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5);
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
@ -110,18 +99,21 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach( i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
Ddwf.ImportGauge(Uprime);
@ -134,7 +126,7 @@ int main (int argc, char ** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;
@ -152,6 +144,7 @@ int main (int argc, char ** argv)
ComplexD dSpred = sum(dS);
std::cout << std::setprecision(14);
std::cout << GridLogMessage << " S "<<S<<std::endl;
std::cout << GridLogMessage << " Sprime "<<Sprime<<std::endl;
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;

View File

@ -31,15 +31,15 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char** argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls = 8;
@ -84,10 +84,7 @@ int main (int argc, char** argv)
DomainWallEOFAFermionR Rop(U, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mb, mf, mb, -1.0, 1, M5);
OneFlavourRationalParams Params(0.95, 100.0, 5000, 1.0e-12, 12);
ConjugateGradient<LatticeFermion> CG(1.0e-12, 5000);
assert(0 && "MM 2019/06/19 Inserted four extra parameters to make this test compile. Needs to be fixed properly");
ExactOneFlavourRatioPseudoFermionAction<WilsonImplR> Meofa(Lop, Rop, CG,
CG, CG, CG, CG, // Inserted this line to make this test compile. Needs attention to make sure it works
Params, true);
ExactOneFlavourRatioPseudoFermionAction<WilsonImplR> Meofa(Lop, Rop, CG, CG, CG, CG, CG, Params, true);
Meofa.refresh(U, RNG5);
RealD S = Meofa.S(U); // pdag M p
@ -113,13 +110,20 @@ int main (int argc, char** argv)
PokeIndex<LorentzIndex>(mom, mommu, mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin(); i<mom.end(); i++){
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt + mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
/*Ddwf.ImportGauge(Uprime);
@ -133,7 +137,7 @@ int main (int argc, char** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid);
dS = zero;
dS = Zero();
for(int mu=0; mu<Nd; mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU, mu);
mommu = Ta(mommu)*2.0;

View File

@ -29,7 +29,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
@ -37,9 +37,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
@ -105,7 +105,6 @@ int main (int argc, char ** argv)
RealD dt = 0.0001;
RealD Hmom = 0.0;
RealD Hmomprime = 0.0;
RealD Hmompp = 0.0;
LatticeColourMatrix mommu(UGrid);
LatticeColourMatrix forcemu(UGrid);
LatticeGaugeField mom(UGrid);
@ -120,18 +119,20 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
std::cout << GridLogMessage <<"Initial mom hamiltonian is "<< Hmom <<std::endl;
@ -157,9 +158,9 @@ int main (int argc, char ** argv)
std::cout << GridLogMessage<< " dsdumu + dag " << norm2(mommu)<<std::endl;
}
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dSmom(UGrid); dSmom = zero;
LatticeComplex dSmom2(UGrid); dSmom2 = zero;
LatticeComplex dS(UGrid); dS = Zero();
LatticeComplex dSmom(UGrid); dSmom = Zero();
LatticeComplex dSmom2(UGrid); dSmom2 = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;

View File

@ -31,7 +31,6 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
typedef GparityWilsonImplR FermionImplPolicy;
typedef GparityDomainWallEOFAFermionR FermionAction;
@ -41,9 +40,9 @@ int main (int argc, char** argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls = 8;
@ -89,10 +88,7 @@ int main (int argc, char** argv)
FermionAction Rop(U, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mb, mf, mb, -1.0, 1, M5, params);
OneFlavourRationalParams Params(0.95, 100.0, 5000, 1.0e-12, 12);
ConjugateGradient<FermionField> CG(1.0e-12, 5000);
assert(0 && "MM 2019/06/19 Inserted four extra parameters to make this test compile. Needs to be fixed properly");
ExactOneFlavourRatioPseudoFermionAction<FermionImplPolicy> Meofa(Lop, Rop, CG,
CG, CG, CG, CG, // Inserted this line to make this test compile. Needs attention to make sure it works
Params, true);
ExactOneFlavourRatioPseudoFermionAction<FermionImplPolicy> Meofa(Lop, Rop, CG, CG, CG, CG, CG, Params, true);
Meofa.refresh(U, RNG5);
RealD S = Meofa.S(U); // pdag M p
@ -118,13 +114,20 @@ int main (int argc, char** argv)
PokeIndex<LorentzIndex>(mom, mommu, mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin(); i<mom.end(); i++){
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt + mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
/*Ddwf.ImportGauge(Uprime);
@ -138,7 +141,7 @@ int main (int argc, char** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid);
dS = zero;
dS = Zero();
for(int mu=0; mu<Nd; mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU, mu);
mommu = Ta(mommu)*2.0;

View File

@ -29,15 +29,14 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -55,10 +54,11 @@ int main (int argc, char ** argv)
SU3::HotConfiguration(pRNG,U);
double beta = 1.0;
double c1 = 0.331;
//ConjugatePlaqPlusRectangleActionR Action(beta,c1);
ConjugateWilsonGaugeActionR Action(beta);
// double c1 = 0.331;
//ConjugatePlaqPlusRectangleActionR Action(beta,c1);
//WilsonGaugeActionR Action(beta);
ComplexD S = Action.S(U);
@ -85,9 +85,12 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){ // exp(pmu dt) * Umu
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt ;
}
auto Uprime_v = Uprime.View();
auto U_v = U.View();
auto mom_v = mom.View();
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
});
}
ComplexD Sprime = Action.S(Uprime);
@ -96,7 +99,7 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
LatticeComplex dS(&Grid); dS = zero;
LatticeComplex dS(&Grid); dS = Zero();
for(int mu=0;mu<Nd;mu++){

View File

@ -29,7 +29,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
@ -37,9 +37,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -60,7 +60,7 @@ int main (int argc, char ** argv)
double c1 = 0.331;
ConjugatePlaqPlusRectangleActionR Action(beta,c1);
// ConjugateWilsonGaugeActionR Action(beta);
//ConjugateWilsonGaugeActionR Action(beta);
//WilsonGaugeActionR Action(beta);
ComplexD S = Action.S(U);
@ -73,7 +73,7 @@ int main (int argc, char ** argv)
////////////////////////////////////
// Modify the gauge field a little
////////////////////////////////////
RealD dt = 0.0001;
RealD dt = 0.01;
LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid);
@ -87,9 +87,12 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){ // exp(pmu dt) * Umu
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt ;
}
auto mom_v = mom.View();
auto Uprime_v= Uprime.View();
auto U_v = U.View();
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
});
}
ComplexD Sprime = Action.S(Uprime);
@ -98,7 +101,7 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
LatticeComplex dS(&Grid); dS = zero;
LatticeComplex dS(&Grid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
@ -119,7 +122,7 @@ int main (int argc, char ** argv)
std::cout << GridLogMessage << " Sprime "<<Sprime<<std::endl;
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
std::cout << GridLogMessage << "pred dS "<< dSpred <<std::endl;
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-1 ) ;
std::cout<< GridLogMessage << "Done" <<std::endl;
Grid_finalize();
}

View File

@ -29,7 +29,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
@ -37,9 +37,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
@ -105,18 +105,19 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
auto U_v = U.View();
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
});
}
Ddwf.ImportGauge(Uprime);
@ -128,7 +129,7 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;
@ -165,19 +166,19 @@ int main (int argc, char ** argv)
//
// Gparity --- deriv is pc Uc dSdUc + p U dSdU
//
// Pmu = zero;
// Pmu = Zero();
// for(int mu=0;mu<Nd;mu++){
// SU<Ncol>::GaussianFundamentalLieAlgebraMatrix(pRNG, Pmu);
// PokeIndex<LorentzIndex>(P, Pmu, mu);
// }
//
//
// GridBase *grid = out._grid;
// GridBase *grid = out.Grid();
// LatticeReal ca (grid);
// LatticeMatrix la (grid);
// Complex ci(0.0,scale);
// Matrix ta;
// out=zero;
// out=Zero();
// for(int a=0;a<generators();a++){
// gaussian(pRNG,ca);
// generator(a,ta);

View File

@ -29,26 +29,20 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
const int Ls=8;
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(),
GridDefaultSimd(Nd,vComplex::Nsimd()),
GridDefaultMpi());
GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
GridCartesian * FGrid = UGrid;
GridRedBlackCartesian * FrbGrid = UrbGrid;
std::vector<int> seeds4({1,2,3,4});
GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4);
@ -69,7 +63,6 @@ int main (int argc, char ** argv)
// Unmodified matrix element
////////////////////////////////////
RealD mass=0.01;
RealD M5=1.8;
const int nu = 3;
std::vector<int> twists(Nd,0); twists[nu] = 1;
@ -106,17 +99,21 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
});
}
Wil.ImportGauge(Uprime);
@ -134,7 +131,7 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(UdSdU,mommu,mu);
}
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
forcemu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu = PeekIndex<LorentzIndex>(mom,mu);

View File

@ -29,17 +29,14 @@ Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
#define parallel_for PARALLEL_FOR_LOOP for
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -114,7 +111,7 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
LatticeComplex dS(&Grid); dS = zero;
LatticeComplex dS(&Grid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
auto UdSdUmu = PeekIndex<LorentzIndex>(UdSdU,mu);
@ -150,7 +147,7 @@ int main (int argc, char ** argv)
// Prediciton
dS = zero;
dS = Zero();
for(int mu=0;mu<Nd;mu++){
auto dSdPmu = PeekIndex<LorentzIndex>(UdSdP,mu);
auto Pmu = PeekIndex<LorentzIndex>(P,mu);

View File

@ -29,15 +29,15 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
@ -101,18 +101,19 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
auto U_v = U.View();
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
});
}
Ddwf.ImportGauge(Uprime);
@ -125,7 +126,7 @@ int main (int argc, char ** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;

View File

@ -31,15 +31,15 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
int main (int argc, char** argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls = 8;
@ -86,7 +86,7 @@ int main (int argc, char** argv)
MobiusEOFAFermionR Rop(U, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mb, mf, mb, -1.0, 1, M5, b, c);
OneFlavourRationalParams Params(0.95, 100.0, 5000, 1.0e-12, 12);
ConjugateGradient<LatticeFermion> CG(1.0e-12, 5000);
ExactOneFlavourRatioPseudoFermionAction<WilsonImplR> Meofa(Lop, Rop, CG, Params, false);
ExactOneFlavourRatioPseudoFermionAction<WilsonImplR> Meofa(Lop, Rop, CG, CG, CG, CG, CG, Params, false);
Meofa.refresh(U, RNG5);
RealD S = Meofa.S(U); // pdag M p
@ -112,13 +112,20 @@ int main (int argc, char** argv)
PokeIndex<LorentzIndex>(mom, mommu, mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin(); i<mom.end(); i++){
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt + mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
/*Ddwf.ImportGauge(Uprime);
@ -132,7 +139,7 @@ int main (int argc, char** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid);
dS = zero;
dS = Zero();
for(int mu=0; mu<Nd; mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU, mu);
mommu = Ta(mommu)*2.0;

View File

@ -31,7 +31,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
typedef GparityWilsonImplR FermionImplPolicy;
typedef GparityMobiusEOFAFermionR FermionAction;
@ -41,9 +41,9 @@ int main (int argc, char** argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls = 8;
@ -91,7 +91,7 @@ int main (int argc, char** argv)
FermionAction Rop(U, *FGrid, *FrbGrid, *UGrid, *UrbGrid, mb, mf, mb, -1.0, 1, M5, b, c, params);
OneFlavourRationalParams Params(0.95, 100.0, 5000, 1.0e-12, 12);
ConjugateGradient<FermionField> CG(1.0e-12, 5000);
ExactOneFlavourRatioPseudoFermionAction<FermionImplPolicy> Meofa(Lop, Rop, CG, Params, false);
ExactOneFlavourRatioPseudoFermionAction<FermionImplPolicy> Meofa(Lop, Rop, CG, CG, CG, CG, CG, Params, false);
Meofa.refresh(U, RNG5);
RealD S = Meofa.S(U); // pdag M p
@ -115,15 +115,17 @@ int main (int argc, char** argv)
SU3::GaussianFundamentalLieAlgebraMatrix(RNG4, mommu); // Traceless antihermitian momentum; gaussian in lie alg
PokeIndex<LorentzIndex>(mom, mommu, mu);
auto U_v = U.View();
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
// fourth order exponential approx
parallel_for(auto i=mom.begin(); i<mom.end(); i++){
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt + mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
thread_foreach( i, mom_v,{
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt + mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
});
}
/*Ddwf.ImportGauge(Uprime);
@ -137,7 +139,7 @@ int main (int argc, char** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid);
dS = zero;
dS = Zero();
for(int mu=0; mu<Nd; mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU, mu);
mommu = Ta(mommu)*2.0;

View File

@ -29,7 +29,7 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
@ -37,9 +37,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=9;
@ -101,18 +101,19 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
auto U_v = U.View();
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
});
}
Dpf.ImportGauge(Uprime);
@ -125,7 +126,7 @@ int main (int argc, char ** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;

View File

@ -29,7 +29,7 @@ Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
;
@ -37,9 +37,9 @@ int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -73,7 +73,7 @@ int main (int argc, char ** argv)
////////////////////////////////////
// Modify the gauge field a little
////////////////////////////////////
RealD dt = 0.0001;
RealD dt = 0.002;
LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid);
@ -87,15 +87,12 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){ // exp(pmu dt) * Umu
Uprime[i](mu) = U[i](mu) + mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
auto Uprime_v = Uprime.View();
auto U_v = U.View();
auto mom_v = mom.View();
thread_foreach(i,mom_v,{ // exp(pmu dt) * Umu
Uprime_v[i](mu) = U_v[i](mu) + mom_v[i](mu)*U_v[i](mu)*dt ;
});
}
ComplexD Sprime = Action.S(Uprime);
@ -104,7 +101,7 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
LatticeComplex dS(&Grid); dS = zero;
LatticeComplex dS(&Grid); dS = Zero();
for(int mu=0;mu<Nd;mu++){

View File

@ -29,17 +29,14 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -93,7 +90,6 @@ int main (int argc, char ** argv)
RealD dt = 0.0001;
RealD Hmom = 0.0;
RealD Hmomprime = 0.0;
RealD Hmompp = 0.0;
LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid);
LatticeGaugeField mom(&Grid);
@ -109,16 +105,18 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++) {
Uprime[i](mu) = U[i](mu);
Uprime[i](mu) += mom[i](mu)*U[i](mu)*dt ;
Uprime[i](mu) += mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0);
Uprime[i](mu) += mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0);
Uprime[i](mu) += mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0);
Uprime[i](mu) += mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0);
Uprime[i](mu) += mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
}
auto U_v = U.View();
auto mom_v = mom.View();
auto Uprime_v = Uprime.View();
thread_foreach( i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu);
Uprime_v[i](mu) += mom_v[i](mu)*U_v[i](mu)*dt ;
Uprime_v[i](mu) += mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0);
Uprime_v[i](mu) += mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0);
Uprime_v[i](mu) += mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0);
Uprime_v[i](mu) += mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0);
Uprime_v[i](mu) += mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0);
});
}
std::cout << GridLogMessage <<"Initial mom hamiltonian is "<< Hmom <<std::endl;
@ -131,7 +129,6 @@ int main (int argc, char ** argv)
// Use derivative to estimate dS
//////////////////////////////////////////////
for(int mu=0;mu<Nd;mu++){
std::cout << "" <<std::endl;
mommu = PeekIndex<LorentzIndex>(mom,mu);
@ -144,9 +141,9 @@ int main (int argc, char ** argv)
std::cout << GridLogMessage<< " dsdumu + dag " << norm2(mommu)<<std::endl;
}
LatticeComplex dS(&Grid); dS = zero;
LatticeComplex dSmom(&Grid); dSmom = zero;
LatticeComplex dSmom2(&Grid); dSmom2 = zero;
LatticeComplex dS(&Grid); dS = Zero();
LatticeComplex dSmom(&Grid); dSmom = Zero();
LatticeComplex dSmom2(&Grid); dSmom2 = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);

View File

@ -29,15 +29,14 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main(int argc, char **argv)
{
Grid_init(&argc, &argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
auto latt_size = GridDefaultLatt();
auto simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
GridRedBlackCartesian RBGrid(&Grid);
@ -63,9 +62,8 @@ int main(int argc, char **argv)
LatticeGaugeField U(&Grid);
std::vector<int> site = {0, 0, 0, 0};
SU3::HotConfiguration(pRNG, U);
//SU3::ColdConfiguration(pRNG, U);// Clover term zero
//SU3::ColdConfiguration(pRNG, U);// Clover term Zero()
////////////////////////////////////
// Unmodified matrix element
@ -94,7 +92,7 @@ int main(int argc, char **argv)
RealD dt = 0.00005;
RealD Hmom = 0.0;
RealD Hmomprime = 0.0;
RealD Hmompp = 0.0;
// RealD Hmompp = 0.0;
LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid);
LatticeGaugeField mom(&Grid);
@ -107,10 +105,13 @@ int main(int argc, char **argv)
Hmom -= real(sum(trace(mommu * mommu)));
PokeIndex<LorentzIndex>(mom, mommu, mu);
parallel_for(int ss = 0; ss < mom._grid->oSites(); ss++)
auto Uprime_v = Uprime.View();
auto U_v = U.View();
auto mom_v = mom.View();
thread_foreach(ss,mom_v,
{
Uprime[ss]._internal[mu] = ProjectOnGroup(Exponentiate(mom[ss]._internal[mu], dt, 12) * U[ss]._internal[mu]);
}
Uprime_v[ss]._internal[mu] = ProjectOnGroup(Exponentiate(mom_v[ss]._internal[mu], dt, 12) * U_v[ss]._internal[mu]);
});
}
std::cout << GridLogMessage << "Initial mom hamiltonian is " << Hmom << std::endl;
@ -125,11 +126,11 @@ int main(int argc, char **argv)
//////////////////////////////////////////////
LatticeComplex dS(&Grid);
dS = zero;
dS = Zero();
LatticeComplex dSmom(&Grid);
dSmom = zero;
dSmom = Zero();
LatticeComplex dSmom2(&Grid);
dSmom2 = zero;
dSmom2 = Zero();
for (int mu = 0; mu < Nd; mu++)
{

View File

@ -29,15 +29,14 @@ Author: Peter Boyle <paboyle@ph.ed.ac.uk>
using namespace std;
using namespace Grid;
using namespace Grid::QCD;
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
std::vector<int> latt_size = GridDefaultLatt();
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
std::vector<int> mpi_layout = GridDefaultMpi();
Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi();
const int Ls=8;
@ -70,7 +69,7 @@ int main (int argc, char ** argv)
RealD b=0.5;
RealD c=0.5;
std::vector < std::complex<double> > omegas;
std::vector < ComplexD > omegas;
omegas.push_back( std::complex<double>(1.45806438985048,-0) );
omegas.push_back( std::complex<double>(1.18231318389348,-0) );
omegas.push_back( std::complex<double>(0.830951166685955,-0) );
@ -101,7 +100,7 @@ int main (int argc, char ** argv)
////////////////////////////////////
// Modify the gauge field a little
////////////////////////////////////
RealD dt = 0.0001;
RealD dt = 0.001;
LatticeColourMatrix mommu(UGrid);
LatticeColourMatrix forcemu(UGrid);
@ -115,18 +114,20 @@ int main (int argc, char ** argv)
PokeIndex<LorentzIndex>(mom,mommu,mu);
// fourth order exponential approx
parallel_for(auto i=mom.begin();i<mom.end();i++){
Uprime[i](mu) =
U[i](mu)
+ mom[i](mu)*U[i](mu)*dt
+ mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt/2.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt/6.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt/24.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *mom[i](mu) *U[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
}
auto mom_v = mom.View();
auto U_v = U.View();
auto Uprime_v = Uprime.View();
thread_foreach(i,mom_v,{
Uprime_v[i](mu) = U_v[i](mu)
+ mom_v[i](mu)*U_v[i](mu)*dt
+ mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt/2.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt/6.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt/24.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt/120.0)
+ mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *mom_v[i](mu) *U_v[i](mu)*(dt*dt*dt*dt*dt*dt/720.0)
;
});
}
Ddwf.ImportGauge(Uprime);
@ -139,7 +140,7 @@ int main (int argc, char ** argv)
//////////////////////////////////////////////
LatticeComplex dS(UGrid); dS = zero;
LatticeComplex dS(UGrid); dS = Zero();
for(int mu=0;mu<Nd;mu++){
mommu = PeekIndex<LorentzIndex>(UdSdU,mu);
mommu=Ta(mommu)*2.0;

View File

@ -33,7 +33,7 @@ directory
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -1,153 +0,0 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Source file: ./tests/Test_hmc_WilsonFermionGauge.cc
Copyright (C) 2015
Author: Peter Boyle <pabobyle@ph.ed.ac.uk>
Author: neo <cossu@post.kek.jp>
Author: Guido Cossu <guido.cossu@ed.ac.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
See the full license in the file "LICENSE" in the top level distribution
directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/Grid.h>
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();
// here make a routine to print all the relevant information on the run
std::cout << GridLogMessage << "Grid is setup to use " << threads << " threads" << std::endl;
// Typedefs to simplify notation
typedef GenericHMCRunner<MinimumNorm2> HMCWrapper; // Uses the default minimum norm
typedef DomainWallVec5dImplR FermionImplPolicy;
typedef DomainWallFermion<FermionImplPolicy> FermionAction;
typedef typename FermionAction::FermionField FermionField;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;
// Grid from the command line
TheHMC.Resources.AddFourDimGrid("gauge");
// Possibile to create the module by hand
// hardcoding parameters or using a Reader
// Checkpointer definition
CheckpointerParameters CPparams;
CPparams.config_prefix = "ckpoint_EODWF_lat";
CPparams.rng_prefix = "ckpoint_EODWF_rng";
CPparams.saveInterval = 5;
CPparams.format = "IEEE64BIG";
TheHMC.Resources.LoadNerscCheckpointer(CPparams);
RNGModuleParameters RNGpar;
RNGpar.serial_seeds = "1 2 3 4 5";
RNGpar.parallel_seeds = "6 7 8 9 10";
TheHMC.Resources.SetRNGSeeds(RNGpar);
// Construct observables
// here there is too much indirection
typedef PlaquetteMod<HMCWrapper::ImplPolicy> PlaqObs;
TheHMC.Resources.AddObservable<PlaqObs>();
//////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// Collect actions, here use more encapsulation
// need wrappers of the fermionic classes
// that have a complex construction
// standard
RealD beta = 5.6 ;
WilsonGaugeActionR Waction(beta);
const int Ls = 8;
auto GridPtr = TheHMC.Resources.GetCartesian();
auto GridRBPtr = TheHMC.Resources.GetRBCartesian();
auto FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,GridPtr);
auto FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,GridPtr);
auto sUGrid = SpaceTimeGrid::makeFourDimDWFGrid(GridDefaultLatt(),GridDefaultMpi());
auto sUrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(sUGrid);
// temporarily need a gauge field
LatticeGaugeField U(GridPtr);
Real mass = 0.04;
Real pv = 1.0;
RealD M5 = 1.5;
FermionAction DenOp(U,*FGrid,*FrbGrid,*sUGrid,*sUrbGrid,mass,M5);
FermionAction NumOp(U,*FGrid,*FrbGrid,*sUGrid,*sUrbGrid,pv,M5);
double StoppingCondition = 1.0e-8;
double MaxCGIterations = 10000;
ConjugateGradient<FermionField> CG(StoppingCondition,MaxCGIterations);
TwoFlavourEvenOddRatioPseudoFermionAction<FermionImplPolicy> Nf2(NumOp, DenOp,CG,CG);
// Set smearing (true/false), default: false
Nf2.is_smeared = false;
// Collect actions
ActionLevel<HMCWrapper::Field> Level1(1);
Level1.push_back(&Nf2);
ActionLevel<HMCWrapper::Field> Level2(4);
Level2.push_back(&Waction);
TheHMC.TheAction.push_back(Level1);
TheHMC.TheAction.push_back(Level2);
/////////////////////////////////////////////////////////////
// HMC parameters are serialisable
TheHMC.Parameters.MD.MDsteps = 20;
TheHMC.Parameters.MD.trajL = 1.0;
TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
// Reset performance counters
NumOp.ZeroCounters();
DenOp.ZeroCounters();
TheHMC.Run(); // no smearing
std::cout << GridLogMessage << "Numerator report, Pauli-Villars term : " << std::endl;
NumOp.Report();
std::cout << GridLogMessage << "Denominator report, Dw(m) term (includes CG) : " << std::endl;
DenOp.Report();
Grid_finalize();
} // main

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -73,7 +73,7 @@ namespace Grid{
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();
@ -86,8 +86,8 @@ int main(int argc, char **argv) {
typedef MobiusFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField;
// Serialiser
//typedef Grid::XmlReader Serialiser;
typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//typedef Grid::JSONReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

View File

@ -79,7 +79,7 @@ namespace Grid{
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();
@ -92,8 +92,8 @@ int main(int argc, char **argv) {
typedef MobiusFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField;
// Serialiser
//typedef Grid::XmlReader Serialiser;
typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//typedef Grid::JSONReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

View File

@ -30,7 +30,6 @@ directory
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -30,7 +30,7 @@ directory
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -32,7 +32,7 @@
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -32,9 +32,9 @@ namespace Grid{
// Put this section in a separate header
// ifdefs ?? Local makefile suggestion , policy as make parameter
typedef QCD::PeriodicGimplR ImplementationPolicy;
typedef QCD::WilsonImplR FermionImplementationPolicy;
typedef QCD::NoHirep RepresentationPolicy;
typedef PeriodicGimplR ImplementationPolicy;
typedef WilsonImplR FermionImplementationPolicy;
typedef NoHirep RepresentationPolicy;
typedef Grid::XmlReader Serialiser;
// Register all object names
@ -44,7 +44,7 @@ typedef Grid::XmlReader Serialiser;
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);

View File

@ -30,7 +30,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -31,7 +31,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -30,7 +30,7 @@ Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -31,7 +31,7 @@ directory
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -29,7 +29,7 @@ See the full license in the file "LICENSE" in the top level distribution directo
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();

View File

@ -45,7 +45,7 @@ class ScalarActionParameters : Serializable {
}
using namespace Grid;
using namespace Grid::QCD;
;
template <class Impl>
class MagMeas : public HmcObservable<typename Impl::Field> {
@ -88,7 +88,8 @@ public:
};
int main(int argc, char **argv) {
typedef Grid::JSONReader Serialiser;
//typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();
@ -126,7 +127,7 @@ int main(int argc, char **argv) {
ScalarGrid.set_rb(new GridRedBlackCartesian(ScalarGrid.get_full()));
TheHMC.Resources.AddGrid("scalar", ScalarGrid);
std::cout << "Lattice size : " << GridDefaultLatt() << std::endl;
ScalarActionParameters SPar(Reader);
// Checkpointer definition

View File

@ -69,7 +69,6 @@ namespace Grid{
int main(int argc, char **argv)
{
using namespace Grid;
using namespace Grid::QCD;
typedef Representations< FundamentalRepresentation, TwoIndexAntiSymmetricRepresentation > TheRepresentations;
@ -83,7 +82,8 @@ int main(int argc, char **argv)
typedef WilsonTwoIndexAntiSymmetricImplR FermionImplPolicy; // gauge field implemetation for the pseudofermions
typedef WilsonCloverTwoIndexAntiSymmetricFermionR FermionAction; // type of lattice fermions (Wilson, DW, ...)
typedef typename FermionAction::FermionField FermionField;
typedef Grid::JSONReader Serialiser;
//typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

View File

@ -69,7 +69,7 @@ namespace Grid{
int main(int argc, char **argv)
{
using namespace Grid;
using namespace Grid::QCD;
typedef Representations< FundamentalRepresentation, TwoIndexSymmetricRepresentation > TheRepresentations;
@ -83,7 +83,8 @@ int main(int argc, char **argv)
typedef WilsonTwoIndexSymmetricImplR FermionImplPolicy; // gauge field implemetation for the pseudofermions
typedef WilsonCloverTwoIndexSymmetricFermionR FermionAction; // type of lattice fermions (Wilson, DW, ...)
typedef typename FermionAction::FermionField FermionField;
typedef Grid::JSONReader Serialiser;
//typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

View File

@ -69,7 +69,7 @@ namespace Grid{
int main(int argc, char **argv)
{
using namespace Grid;
using namespace Grid::QCD;
Grid_init(&argc, &argv);
int threads = GridThread::GetThreads();
@ -81,7 +81,7 @@ int main(int argc, char **argv)
typedef WilsonImplR FermionImplPolicy;
typedef WilsonCloverFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField;
typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

View File

@ -70,7 +70,7 @@ namespace Grid{
int main(int argc, char **argv) {
using namespace Grid;
using namespace Grid::QCD;
// Here change the allowed (higher) representations
typedef Representations< FundamentalRepresentation, TwoIndexAntiSymmetricRepresentation> TheRepresentations;
@ -91,7 +91,7 @@ int main(int argc, char **argv) {
typedef WilsonCloverTwoIndexAntiSymmetricFermionR ASymmFermionAction;
typedef typename ASymmFermionAction::FermionField ASymmFermionField;
typedef Grid::JSONReader Serialiser;
typedef Grid::XmlReader Serialiser;
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
HMCWrapper TheHMC;

Some files were not shown because too many files have changed in this diff Show More