From 1cc25837b2aa622494bf468c02e791aabb30cca7 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Wed, 10 Jun 2015 12:26:25 +0100 Subject: [PATCH] Updates to ldop tests --- .gitignore | 3 +- INSTALL | 2 +- configure | 13 +-- tests/Test_cayley_ldop_cr.cc | 17 +--- tests/Test_cayley_ldop_cr_chebyshev.cc | 124 +++++++++++++++++++++++++ 5 files changed, 137 insertions(+), 22 deletions(-) create mode 100644 tests/Test_cayley_ldop_cr_chebyshev.cc diff --git a/.gitignore b/.gitignore index be00eb30..a68020a3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *~ errs *# +INSTALL # Precompiled Headers *.gch @@ -78,4 +79,4 @@ config.status .Spotlight-V100 .Trashes ehthumbs.db -Thumbs.db \ No newline at end of file +Thumbs.db diff --git a/INSTALL b/INSTALL index f812f5a2..80a61507 120000 --- a/INSTALL +++ b/INSTALL @@ -1 +1 @@ -/usr/share/automake-1.14/INSTALL \ No newline at end of file +/opt/local/share/automake-1.15/INSTALL \ No newline at end of file diff --git a/configure b/configure index 702a52db..07b99339 100755 --- a/configure +++ b/configure @@ -2574,7 +2574,7 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- -am__api_version='1.14' +am__api_version='1.15' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2746,8 +2746,8 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in @@ -2766,7 +2766,7 @@ else $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi -if test x"${install_sh}" != xset; then +if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -3094,8 +3094,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # mkdir_p='$(MKDIR_P)' -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' @@ -3154,6 +3154,7 @@ END fi + ac_config_headers="$ac_config_headers lib/GridConfig.h" # Check whether --enable-silent-rules was given. diff --git a/tests/Test_cayley_ldop_cr.cc b/tests/Test_cayley_ldop_cr.cc index afa773b2..698bbb28 100644 --- a/tests/Test_cayley_ldop_cr.cc +++ b/tests/Test_cayley_ldop_cr.cc @@ -64,21 +64,10 @@ int main (int argc, char ** argv) //random(RNG4,Umu); NerscField header; - std::string file("./ckpoint_lat.400"); + std::string file("./ckpoint_lat.4000"); readNerscConfiguration(Umu,header,file); -#if 0 - LatticeColourMatrix U(UGrid); - Complex cone(1.0,0.0); - for(int nn=0;nn(Umu,U,nn); - } - } -#endif - RealD mass=0.5; + RealD mass=0.01; RealD M5=1.8; DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); @@ -100,7 +89,7 @@ int main (int argc, char ** argv) // filter(HermIndefOp,noise,subspace[b]); // inverse iteration MdagMLinearOperator HermDefOp(Ddwf); - ConjugateGradient CG(1.0e-5,10000); + ConjugateGradient CG(1.0e-4,10000); for(int i=0;i<4;i++){ diff --git a/tests/Test_cayley_ldop_cr_chebyshev.cc b/tests/Test_cayley_ldop_cr_chebyshev.cc new file mode 100644 index 00000000..091b8eff --- /dev/null +++ b/tests/Test_cayley_ldop_cr_chebyshev.cc @@ -0,0 +1,124 @@ +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + + +template +struct scal { + d internal; +}; + +Gamma::GammaMatrix Gmu [] = { + Gamma::GammaX, + Gamma::GammaY, + Gamma::GammaZ, + Gamma::GammaT +}; + +double lowpass(double x) +{ + return pow(x*x,-2); +} + +int main (int argc, char ** argv) +{ + Grid_init(&argc,&argv); + + Chebyshev filter(-120.0, 120.0,256, lowpass); + ofstream csv(std::string("filter.dat"),std::ios::out|std::ios::trunc); + filter.csv(csv); + csv.close(); + + const int Ls=8; + + GridCartesian * UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplexF::Nsimd()),GridDefaultMpi()); + GridRedBlackCartesian * UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid); + + GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid); + GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid); + + // Construct a coarsened grid + std::vector clatt = GridDefaultLatt(); + for(int d=0;d seeds4({1,2,3,4}); + std::vector seeds5({5,6,7,8}); + std::vector cseeds({5,6,7,8}); + GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5); + GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); + GridParallelRNG CRNG(Coarse5d);CRNG.SeedFixedIntegers(cseeds); + + LatticeFermion src(FGrid); gaussian(RNG5,src); + LatticeFermion result(FGrid); result=zero; + LatticeFermion ref(FGrid); ref=zero; + LatticeFermion tmp(FGrid); + LatticeFermion err(FGrid); + LatticeGaugeField Umu(UGrid); gaussian(RNG4,Umu); + + + //random(RNG4,Umu); + NerscField header; + std::string file("./ckpoint_lat.400"); + readNerscConfiguration(Umu,header,file); + +#if 0 + LatticeColourMatrix U(UGrid); + Complex cone(1.0,0.0); + for(int nn=0;nn(Umu,U,nn); + } + } +#endif + RealD mass=0.5; + RealD M5=1.8; + + DomainWallFermion Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + Gamma5R5HermitianLinearOperator HermIndefOp(Ddwf); + + const int nbasis = 8; + std::vector subspace(nbasis,FGrid); + LatticeFermion noise(FGrid); + LatticeFermion ms(FGrid); + for(int b=0;b LittleDiracOperator; + typedef LittleDiracOperator::CoarseVector CoarseVector; + + LittleDiracOperator LittleDiracOp(*Coarse5d); + LittleDiracOp.CoarsenOperator(FGrid,HermIndefOp,subspace); + + CoarseVector c_src (Coarse5d); + CoarseVector c_res (Coarse5d); + gaussian(CRNG,c_src); + c_res=zero; + + std::cout << "Solving MCR on coarse space "<< std::endl; + HermitianLinearOperator HermIndefLdop(LittleDiracOp); + ConjugateResidual MCR(1.0e-8,10000); + MCR(HermIndefLdop,c_src,c_res); + + std::cout << "Done "<< std::endl; + Grid_finalize(); +}