From d8c29f5fcf321e4d1a4f0579cbdf698df481b2ce Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Sun, 18 Dec 2022 12:05:00 -0500 Subject: [PATCH] Updated FFT test for PETSc --- Grid/lattice/Lattice.h | 1 + Grid/lattice/Lattice_crc.h | 55 +++++++++++++++++++++ tests/core/Test_fft_matt.cc | 95 ++++++++++++++++++++++++++++--------- 3 files changed, 129 insertions(+), 22 deletions(-) create mode 100644 Grid/lattice/Lattice_crc.h diff --git a/Grid/lattice/Lattice.h b/Grid/lattice/Lattice.h index 9f5f1da7..c4adf86a 100644 --- a/Grid/lattice/Lattice.h +++ b/Grid/lattice/Lattice.h @@ -46,3 +46,4 @@ Author: Peter Boyle #include #include #include +#include diff --git a/Grid/lattice/Lattice_crc.h b/Grid/lattice/Lattice_crc.h new file mode 100644 index 00000000..142e2349 --- /dev/null +++ b/Grid/lattice/Lattice_crc.h @@ -0,0 +1,55 @@ +/************************************************************************************* + + Grid physics library, www.github.com/paboyle/Grid + + Source file: ./lib/lattice/Lattice_crc.h + + Copyright (C) 2021 + +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 */ +#pragma once + +NAMESPACE_BEGIN(Grid); + +template void DumpSliceNorm(std::string s,Lattice &f,int mu=-1) +{ + auto ff = localNorm2(f); + if ( mu==-1 ) mu = f.Grid()->Nd()-1; + typedef typename vobj::tensor_reduced normtype; + typedef typename normtype::scalar_object scalar; + std::vector sff; + sliceSum(ff,sff,mu); + for(int t=0;t uint32_t crc(Lattice & buf) +{ + autoView( buf_v , buf, CpuRead); + return ::crc32(0L,(unsigned char *)&buf_v[0],(size_t)sizeof(vobj)*buf.oSites()); +} + +#define CRC(U) std::cout << "FingerPrint "<<__FILE__ <<" "<< __LINE__ <<" "<< #U <<" "< #include using namespace Grid; - ; + +Gamma::Algebra Gmu [] = { + Gamma::Algebra::GammaX, + Gamma::Algebra::GammaY, + Gamma::Algebra::GammaZ, + Gamma::Algebra::GammaT, + Gamma::Algebra::Gamma5 +}; int main (int argc, char ** argv) { @@ -49,22 +55,7 @@ int main (int argc, char ** argv) GridCartesian GRID(latt_size,simd_layout,mpi_layout); GridRedBlackCartesian RBGRID(&GRID); - LatticeComplexD one(&GRID); - LatticeComplexD zz(&GRID); - LatticeComplexD C(&GRID); - LatticeComplexD Ctilde(&GRID); - LatticeComplexD Cref (&GRID); - LatticeComplexD Csav (&GRID); LatticeComplexD coor(&GRID); - - LatticeSpinMatrixD S(&GRID); - LatticeSpinMatrixD Stilde(&GRID); - - Coordinate p({1,3,2,3}); - - one = ComplexD(1.0,0.0); - zz = ComplexD(0.0,0.0); - ComplexD ci(0.0,1.0); std::vector seeds({1,2,3,4}); @@ -73,7 +64,6 @@ int main (int argc, char ** argv) pRNG.SeedFixedIntegers(seeds); LatticeGaugeFieldD Umu(&GRID); - SU::ColdConfiguration(pRNG,Umu); // Unit gauge //////////////////////////////////////////////////// @@ -81,17 +71,78 @@ int main (int argc, char ** argv) //////////////////////////////////////////////////// { LatticeFermionD src(&GRID); gaussian(pRNG,src); + LatticeFermionD src_p(&GRID); LatticeFermionD tmp(&GRID); LatticeFermionD ref(&GRID); + LatticeFermionD result(&GRID); - RealD mass=0.01; + RealD mass=0.1; WilsonFermionD Dw(Umu,GRID,RBGRID,mass); - Dw.M(src,tmp); + Dw.M(src,ref); + std::cout << "Norm src "< 1/2 gmu (eip - emip) = i sinp gmu + Kinetic = Kinetic + sin(kmu)*ci*(Gamma(Gmu[mu])*src_p); + + } + + W = mass + sk2; + Kinetic = Kinetic + W * src_p; + + std::cout<<"Momentum space src "<< norm2(src_p)<