From b35169f1dd443267f2c949da65347aaaa150f533 Mon Sep 17 00:00:00 2001 From: Azusa Yamaguchi Date: Wed, 2 May 2018 14:22:37 +0100 Subject: [PATCH] MultiShift for Staggered --- tests/solver/Test_staggered_multishift.cc | 121 ++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 tests/solver/Test_staggered_multishift.cc diff --git a/tests/solver/Test_staggered_multishift.cc b/tests/solver/Test_staggered_multishift.cc new file mode 100644 index 00000000..04386027 --- /dev/null +++ b/tests/solver/Test_staggered_multishift.cc @@ -0,0 +1,121 @@ + /************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./tests/Test_wilson_cg_unprec.cc + + Copyright (C) 2015 + +Author: Azusa Yamaguchi +Author: Peter Boyle + + 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 +#include + +using namespace std; +using namespace Grid; +using namespace Grid::QCD; + +template +struct scal { + d internal; +}; + + Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT + }; + +int main (int argc, char ** argv) +{ + typedef typename ImprovedStaggeredFermionR::FermionField FermionField; + typename ImprovedStaggeredFermionR::ImplParams params; + + Grid_init(&argc,&argv); + + std::vector latt_size = GridDefaultLatt(); + std::vector simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd()); + std::vector mpi_layout = GridDefaultMpi(); + + GridCartesian Grid(latt_size,simd_layout,mpi_layout); + GridRedBlackCartesian RBGrid(&Grid); + + std::vector seeds({1,2,3,4}); + GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds); + + + LatticeGaugeField Umu(&Grid); SU3::HotConfiguration(pRNG,Umu); + + double volume=1; + for(int mu=0;mu HermOpEO(Ds); + + FermionField src(&Grid); random(pRNG,src); + FermionField src_o(&RBGrid); + pickCheckerboard(Odd,src_o,src); + + + ///////////////////////////////// + //Multishift CG + ///////////////////////////////// + std::vector result(degree,&RBGrid); + ConjugateGradientMultiShift MSCG(10000,Sqrt); + + double deodoe_flops=(1205+15*degree)*volume; // == 66*16 + == 1146 + + double t1=usecond(); + MSCG(HermOpEO,src_o,result); + double t2=usecond(); + double ncall=MSCG.IterationsToComplete; + double flops = deodoe_flops * ncall; + std::cout<