From 389e0a77bd201cc6351b7b556dcc6f28e5b6aa05 Mon Sep 17 00:00:00 2001 From: Azusa Yamaguchi Date: Tue, 29 Nov 2016 13:13:56 +0000 Subject: [PATCH] Staggerd Fermion 5D --- benchmarks/Benchmark_staggered.cc | 4 +-- lib/qcd/action/Actions.h | 5 +++ lib/qcd/action/fermion/FermionOperatorImpl.h | 34 ++++++++++++------- .../fermion/ImprovedStaggeredFermion.cc | 22 +++++++----- .../action/fermion/ImprovedStaggeredFermion.h | 15 ++++---- lib/qcd/action/fermion/StaggeredKernels.cc | 4 +-- tests/core/Test_cf_coarsen_support.cc | 2 +- tests/core/Test_contfrac_even_odd.cc | 2 +- tests/core/Test_dwf_even_odd.cc | 2 +- tests/core/Test_dwf_rb5d.cc | 2 +- tests/core/Test_gpwilson_even_odd.cc | 2 +- tests/core/Test_wilson_even_odd.cc | 2 +- tests/core/Test_wilson_tm_even_odd.cc | 2 +- tests/debug/Test_cayley_coarsen_support.cc | 2 +- tests/debug/Test_cayley_even_odd.cc | 2 +- tests/debug/Test_cayley_even_odd_vec.cc | 2 +- tests/debug/Test_zmm.cc | 2 +- tests/solver/Test_cf_cr_unprec.cc | 2 +- tests/solver/Test_contfrac_cg.cc | 2 +- tests/solver/Test_dwf_cg_schur.cc | 2 +- tests/solver/Test_dwf_cg_unprec.cc | 2 +- tests/solver/Test_dwf_cr_unprec.cc | 2 +- tests/solver/Test_wilson_cg_prec.cc | 2 +- tests/solver/Test_wilson_cg_schur.cc | 2 +- tests/solver/Test_wilson_cg_unprec.cc | 2 +- tests/solver/Test_wilson_cr_unprec.cc | 2 +- 26 files changed, 72 insertions(+), 52 deletions(-) diff --git a/benchmarks/Benchmark_staggered.cc b/benchmarks/Benchmark_staggered.cc index 53b8e222..121dc0d5 100644 --- a/benchmarks/Benchmark_staggered.cc +++ b/benchmarks/Benchmark_staggered.cc @@ -2,7 +2,7 @@ Grid physics library, www.github.com/paboyle/Grid - Source file: ./benchmarks/Benchmark_wilson.cc + Source file: ./benchmarks/Benchmark_staggered.cc Copyright (C) 2015 @@ -112,7 +112,7 @@ int main (int argc, char ** argv) RealD c1=9.0/8.0; RealD c2=-1.0/24.0; RealD u0=1.0; - ImprovedStaggeredFermionR Ds(Umu,Grid,RBGrid,mass,c1,c2,u0,params); + ImprovedStaggeredFermionR Ds(Umu,Umu,Grid,RBGrid,mass,c1,c2,u0,params); std::cout< ConjugateSymanzikGaugeAction //#include #include +#include #include // Cayley types #include @@ -264,6 +265,10 @@ typedef ImprovedStaggeredFermion ImprovedStaggeredFermionR; typedef ImprovedStaggeredFermion ImprovedStaggeredFermionF; typedef ImprovedStaggeredFermion ImprovedStaggeredFermionD; +typedef ImprovedStaggeredFermion5D ImprovedStaggeredFermion5DR; +typedef ImprovedStaggeredFermion5D ImprovedStaggeredFermion5DF; +typedef ImprovedStaggeredFermion5D ImprovedStaggeredFermion5DD; + }} /////////////////////////////////////////////////////////////////////////////// // G5 herm -- this has to live in QCD since dirac matrix is not in the broader sector of code diff --git a/lib/qcd/action/fermion/FermionOperatorImpl.h b/lib/qcd/action/fermion/FermionOperatorImpl.h index cc1370e8..42f89157 100644 --- a/lib/qcd/action/fermion/FermionOperatorImpl.h +++ b/lib/qcd/action/fermion/FermionOperatorImpl.h @@ -561,11 +561,13 @@ PARALLEL_FOR_LOOP } inline void DoubleStore(GridBase *GaugeGrid, - DoubledGaugeField &Uds, DoubledGaugeField &UUUds, // for Naik term - const GaugeField &Umu) { + DoubledGaugeField &Uds, + const GaugeField &Uthin, + const GaugeField &Ufat) { conformable(Uds._grid, GaugeGrid); - conformable(Umu._grid, GaugeGrid); + conformable(Uthin._grid, GaugeGrid); + conformable(Ufat._grid, GaugeGrid); GaugeLinkField U(GaugeGrid); GaugeLinkField UU(GaugeGrid); GaugeLinkField UUU(GaugeGrid); @@ -589,24 +591,32 @@ PARALLEL_FOR_LOOP if ( mu == 2 ) phases = where( mod(lin_z,2)==(Integer)0, phases,-phases); if ( mu == 3 ) phases = where( mod(lin_t,2)==(Integer)0, phases,-phases); - U = PeekIndex(Umu, mu); + // 1 hop based on fat links + U = PeekIndex(Ufat, mu); + Udag = adj( Cshift(U, mu, -1)); + + U = U *phases; + Udag = Udag *phases; + + PokeIndex(Uds, U, mu); + PokeIndex(Uds, Udag, mu + 4); + + // 3 hop based on thin links. Crazy huh ? + U = PeekIndex(Uthin, mu); UU = Gimpl::CovShiftForward(U,mu,U); UUU= Gimpl::CovShiftForward(U,mu,UU); - U = U *phases; - UUU = UUU *phases; + UUUdag = adj( Cshift(UUU, mu, -3)); + + UUU = UUU *phases; + UUUdag = UUUdag *phases; - PokeIndex(Uds, U, mu); PokeIndex(UUUds, UUU, mu); + PokeIndex(UUUds, UUUdag, mu+4); std::cout << GridLogMessage << " Created the treble links for staggered Naik term" <(Uds, Udag, mu + 4); - PokeIndex(UUUds, UUUdag, mu+4); - } } diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc b/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc index bf9eb8bd..42dff5b2 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion.cc @@ -41,7 +41,7 @@ ImprovedStaggeredFermionStatic::displacements({1, 1, 1, 1, -1, -1, -1, -1, 3, 3, ///////////////////////////////// template -ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Umu, GridCartesian &Fgrid, +ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, RealD _c1, RealD _c2,RealD _u0, const ImplParams &p) @@ -62,9 +62,10 @@ ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Umu, GridC UmuOdd(&Hgrid), UUUmu(&Fgrid), UUUmuEven(&Hgrid), - UUUmuOdd(&Hgrid) { + UUUmuOdd(&Hgrid) +{ // Allocate the required comms buffer - ImportGauge(_Umu); + ImportGauge(_Uthin,_Ufat); } //////////////////////////////////////////////////////////// @@ -79,19 +80,24 @@ ImprovedStaggeredFermion::ImprovedStaggeredFermion(GaugeField &_Umu, GridC // of above link to implmement fourier based solver. //////////////////////////////////////////////////////////// template -void ImprovedStaggeredFermion::ImportGauge(const GaugeField &_Umu) { - +void ImprovedStaggeredFermion::ImportGauge(const GaugeField &_Uthin) +{ + ImportGauge(_Uthin,_Uthin); +}; +template +void ImprovedStaggeredFermion::ImportGauge(const GaugeField &_Uthin,const GaugeField &_Ufat) +{ GaugeLinkField U(GaugeGrid()); //////////////////////////////////////////////////////// // Double Store should take two fields for Naik and one hop separately. //////////////////////////////////////////////////////// - Impl::DoubleStore(GaugeGrid(), Umu, UUUmu, _Umu); + Impl::DoubleStore(GaugeGrid(), UUUmu, Umu, _Uthin, _Ufat ); //////////////////////////////////////////////////////// // Apply scale factors to get the right fermion Kinetic term - // + // Could pass coeffs into the double store to save work. // 0.5 ( U p(x+mu) - Udag(x-mu) p(x-mu) ) //////////////////////////////////////////////////////// for (int mu = 0; mu < Nd; mu++) { @@ -312,7 +318,7 @@ void ImprovedStaggeredFermion::DhopDir(const FermionField &in, FermionFiel Compressor compressor; Stencil.HaloExchange(in, compressor); -PARALLEL_FOR_LOOP + PARALLEL_FOR_LOOP for (int sss = 0; sss < in._grid->oSites(); sss++) { Kernels::DhopDir(Stencil, Umu, UUUmu, Stencil.CommBuf(), sss, sss, in, out, dir, disp); } diff --git a/lib/qcd/action/fermion/ImprovedStaggeredFermion.h b/lib/qcd/action/fermion/ImprovedStaggeredFermion.h index d659155f..ad298d29 100644 --- a/lib/qcd/action/fermion/ImprovedStaggeredFermion.h +++ b/lib/qcd/action/fermion/ImprovedStaggeredFermion.h @@ -66,12 +66,10 @@ class ImprovedStaggeredFermion : public StaggeredKernels, public ImprovedS ///////////////////////////////////////////////////////// void Meooe(const FermionField &in, FermionField &out); void MeooeDag(const FermionField &in, FermionField &out); - - // allow override for twisted mass and clover - virtual void Mooee(const FermionField &in, FermionField &out); - virtual void MooeeDag(const FermionField &in, FermionField &out); - virtual void MooeeInv(const FermionField &in, FermionField &out); - virtual void MooeeInvDag(const FermionField &in, FermionField &out); + void Mooee(const FermionField &in, FermionField &out); + void MooeeDag(const FermionField &in, FermionField &out); + void MooeeInv(const FermionField &in, FermionField &out); + void MooeeInvDag(const FermionField &in, FermionField &out); //////////////////////// // Derivative interface @@ -106,13 +104,14 @@ class ImprovedStaggeredFermion : public StaggeredKernels, public ImprovedS const FermionField &in, FermionField &out, int dag); // Constructor - ImprovedStaggeredFermion(GaugeField &_Umu, GridCartesian &Fgrid, + ImprovedStaggeredFermion(GaugeField &_Uthin, GaugeField &_Ufat, GridCartesian &Fgrid, GridRedBlackCartesian &Hgrid, RealD _mass, RealD _c1=9.0/8.0, RealD _c2=-1.0/24.0,RealD _u0=1.0, const ImplParams &p = ImplParams()); // DoubleStore impl dependent - void ImportGauge(const GaugeField &_Umu); + void ImportGauge(const GaugeField &_Uthin, const GaugeField &_Ufat); + void ImportGauge(const GaugeField &_Uthin); /////////////////////////////////////////////////////////////// // Data members require to support the functionality diff --git a/lib/qcd/action/fermion/StaggeredKernels.cc b/lib/qcd/action/fermion/StaggeredKernels.cc index 8df7f3e4..b437199c 100644 --- a/lib/qcd/action/fermion/StaggeredKernels.cc +++ b/lib/qcd/action/fermion/StaggeredKernels.cc @@ -191,7 +191,7 @@ void StaggeredKernels::DhopSiteDag(StencilImpl &st, LebesgueOrder &lo, Dou int threeLink=1; DhopSiteDepth(st,lo,U,buf,sF,sU,in,naive,oneLink); DhopSiteDepth(st,lo,UUU,buf,sF,sU,in,naik,threeLink); - out._odata[sF] =naive+naik; + out._odata[sF] =-naive-naik; }; template void StaggeredKernels::DhopSite(StencilImpl &st, LebesgueOrder &lo, DoubledGaugeField &U, DoubledGaugeField &UUU, @@ -203,7 +203,7 @@ void StaggeredKernels::DhopSite(StencilImpl &st, LebesgueOrder &lo, Double int threeLink=1; DhopSiteDepth(st,lo,U,buf,sF,sU,in,naive,oneLink); DhopSiteDepth(st,lo,UUU,buf,sF,sU,in,naik,threeLink); - out._odata[sF] =-naive-naik; + out._odata[sF] =naive+naik; }; template diff --git a/tests/core/Test_cf_coarsen_support.cc b/tests/core/Test_cf_coarsen_support.cc index 325cc3a5..9edfc71d 100644 --- a/tests/core/Test_cf_coarsen_support.cc +++ b/tests/core/Test_cf_coarsen_support.cc @@ -64,7 +64,7 @@ int main (int argc, char ** argv) LatticeFermion ref(FGrid); ref=zero; LatticeFermion tmp(FGrid); LatticeFermion err(FGrid); - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); for(int mu=0;mu U(4,UGrid); RealD mass=0.1; diff --git a/tests/core/Test_dwf_even_odd.cc b/tests/core/Test_dwf_even_odd.cc index 5c60d84b..dd34bea9 100644 --- a/tests/core/Test_dwf_even_odd.cc +++ b/tests/core/Test_dwf_even_odd.cc @@ -72,7 +72,7 @@ int main (int argc, char ** argv) LatticeFermion ref(FGrid); ref=zero; LatticeFermion tmp(FGrid); tmp=zero; LatticeFermion err(FGrid); tmp=zero; - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); // Only one non-zero (y) diff --git a/tests/core/Test_dwf_rb5d.cc b/tests/core/Test_dwf_rb5d.cc index ab9e4d6e..5f776aec 100644 --- a/tests/core/Test_dwf_rb5d.cc +++ b/tests/core/Test_dwf_rb5d.cc @@ -81,7 +81,7 @@ int main (int argc, char ** argv) LatticeFermion tmp(FGrid); LatticeFermion err(FGrid); - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); // Only one non-zero (y) diff --git a/tests/core/Test_gpwilson_even_odd.cc b/tests/core/Test_gpwilson_even_odd.cc index b69bf266..b8b320d8 100644 --- a/tests/core/Test_gpwilson_even_odd.cc +++ b/tests/core/Test_gpwilson_even_odd.cc @@ -61,7 +61,7 @@ int main (int argc, char ** argv) FermionField ref(&Grid); ref=zero; FermionField tmp(&Grid); tmp=zero; FermionField err(&Grid); tmp=zero; - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); std::vector U(4,&Grid); double volume=1; diff --git a/tests/core/Test_wilson_even_odd.cc b/tests/core/Test_wilson_even_odd.cc index 8028e6de..8218068b 100644 --- a/tests/core/Test_wilson_even_odd.cc +++ b/tests/core/Test_wilson_even_odd.cc @@ -71,7 +71,7 @@ int main (int argc, char ** argv) LatticeFermion ref(&Grid); ref=zero; LatticeFermion tmp(&Grid); tmp=zero; LatticeFermion err(&Grid); tmp=zero; - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); std::vector U(4,&Grid); double volume=1; diff --git a/tests/core/Test_wilson_tm_even_odd.cc b/tests/core/Test_wilson_tm_even_odd.cc index 2d28240c..2084b249 100644 --- a/tests/core/Test_wilson_tm_even_odd.cc +++ b/tests/core/Test_wilson_tm_even_odd.cc @@ -70,7 +70,7 @@ int main (int argc, char ** argv) LatticeFermion ref(&Grid); ref=zero; LatticeFermion tmp(&Grid); tmp=zero; LatticeFermion err(&Grid); tmp=zero; - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); std::vector U(4,&Grid); double volume=1; diff --git a/tests/debug/Test_cayley_coarsen_support.cc b/tests/debug/Test_cayley_coarsen_support.cc index 9c740b8b..4cfe0e22 100644 --- a/tests/debug/Test_cayley_coarsen_support.cc +++ b/tests/debug/Test_cayley_coarsen_support.cc @@ -77,7 +77,7 @@ int main (int argc, char ** argv) LatticeFermion ref(FGrid); ref=zero; LatticeFermion tmp(FGrid); LatticeFermion err(FGrid); - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); #if 0 std::vector U(4,UGrid); diff --git a/tests/debug/Test_cayley_even_odd.cc b/tests/debug/Test_cayley_even_odd.cc index 5c15450c..81c2e1d4 100644 --- a/tests/debug/Test_cayley_even_odd.cc +++ b/tests/debug/Test_cayley_even_odd.cc @@ -70,7 +70,7 @@ int main (int argc, char ** argv) GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5); GridParallelRNG RNG4(UGrid); RNG4.SeedFixedIntegers(seeds4); - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); RealD mass=0.1; diff --git a/tests/debug/Test_cayley_even_odd_vec.cc b/tests/debug/Test_cayley_even_odd_vec.cc index f8600782..99ae610d 100644 --- a/tests/debug/Test_cayley_even_odd_vec.cc +++ b/tests/debug/Test_cayley_even_odd_vec.cc @@ -91,7 +91,7 @@ int main (int argc, char ** argv) GridParallelRNG sRNG4(sUGrid); sRNG4.SeedFixedIntegers(seeds4); GridParallelRNG sRNG5(sFGrid); sRNG5.SeedFixedIntegers(seeds5); - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); RealD mass=0.1; RealD M5 =1.8; diff --git a/tests/debug/Test_zmm.cc b/tests/debug/Test_zmm.cc index 40263cb9..4f372296 100644 --- a/tests/debug/Test_zmm.cc +++ b/tests/debug/Test_zmm.cc @@ -187,7 +187,7 @@ int main(int argc,char **argv) GridParallelRNG RNG5(FGrid); RNG5.SeedFixedIntegers(seeds5); random(RNG5,src); #if 1 - random(RNG4,Umu); + SU3::HotConfiguration(RNG4,Umu); #else int mmu=2; std::vector U(4,UGrid); diff --git a/tests/solver/Test_cf_cr_unprec.cc b/tests/solver/Test_cf_cr_unprec.cc index 59031ba8..045d6d75 100644 --- a/tests/solver/Test_cf_cr_unprec.cc +++ b/tests/solver/Test_cf_cr_unprec.cc @@ -61,7 +61,7 @@ int main (int argc, char ** argv) LatticeFermion src(FGrid); random(RNG5,src); LatticeFermion result(FGrid); result=zero; - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); for(int mu=0;mu U(4,UGrid); RealD mass=0.1; diff --git a/tests/solver/Test_dwf_cg_schur.cc b/tests/solver/Test_dwf_cg_schur.cc index 75ca3521..d61580dc 100644 --- a/tests/solver/Test_dwf_cg_schur.cc +++ b/tests/solver/Test_dwf_cg_schur.cc @@ -61,7 +61,7 @@ int main (int argc, char ** argv) LatticeFermion src(FGrid); random(RNG5,src); LatticeFermion result(FGrid); result=zero; - LatticeGaugeField Umu(UGrid); random(RNG4,Umu); + LatticeGaugeField Umu(UGrid); SU3::HotConfiguration(RNG4,Umu); std::vector U(4,UGrid); for(int mu=0;mu U(4,UGrid); for(int mu=0;mu U(4,UGrid); diff --git a/tests/solver/Test_wilson_cg_prec.cc b/tests/solver/Test_wilson_cg_prec.cc index 7cc9d574..0f9ed5b3 100644 --- a/tests/solver/Test_wilson_cg_prec.cc +++ b/tests/solver/Test_wilson_cg_prec.cc @@ -60,7 +60,7 @@ int main (int argc, char ** argv) LatticeFermion src(&Grid); random(pRNG,src); RealD nrm = norm2(src); LatticeFermion result(&Grid); result=zero; - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); std::vector U(4,&Grid); diff --git a/tests/solver/Test_wilson_cg_schur.cc b/tests/solver/Test_wilson_cg_schur.cc index 1ea6a07c..a23cf9b7 100644 --- a/tests/solver/Test_wilson_cg_schur.cc +++ b/tests/solver/Test_wilson_cg_schur.cc @@ -57,7 +57,7 @@ int main (int argc, char ** argv) std::vector seeds({1,2,3,4}); GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds); - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); LatticeFermion src(&Grid); random(pRNG,src); LatticeFermion result(&Grid); result=zero; diff --git a/tests/solver/Test_wilson_cg_unprec.cc b/tests/solver/Test_wilson_cg_unprec.cc index 34b0a687..bad72ea4 100644 --- a/tests/solver/Test_wilson_cg_unprec.cc +++ b/tests/solver/Test_wilson_cg_unprec.cc @@ -60,7 +60,7 @@ int main (int argc, char ** argv) LatticeFermion src(&Grid); random(pRNG,src); RealD nrm = norm2(src); LatticeFermion result(&Grid); result=zero; - LatticeGaugeField Umu(&Grid); random(pRNG,Umu); + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); double volume=1; for(int mu=0;mu U(4,&Grid);