diff --git a/Grid/threads/ThreadReduction.h b/Grid/threads/ThreadReduction.h index f0d24d50..2cb3e90d 100644 --- a/Grid/threads/ThreadReduction.h +++ b/Grid/threads/ThreadReduction.h @@ -28,6 +28,11 @@ Author: paboyle /* END LEGAL */ #pragma once +#ifndef MIN +#define MIN(x,y) ((x)>(y)?(y):(x)) +#endif + + // Introduce a class to gain deterministic bit reproducible reduction. // make static; perhaps just a namespace is required. NAMESPACE_BEGIN(Grid); diff --git a/tests/lanczos/Test_dwf_G5R5.cc b/tests/lanczos/Test_dwf_G5R5.cc index 0fd1bc35..1027e4af 100644 --- a/tests/lanczos/Test_dwf_G5R5.cc +++ b/tests/lanczos/Test_dwf_G5R5.cc @@ -33,9 +33,13 @@ using namespace std; using namespace Grid; ; -//typedef WilsonFermionD FermionOp; +#if 0 typedef DomainWallFermionD FermionOp; typedef typename DomainWallFermionD::FermionField FermionField; +#else +typedef MobiusFermionD FermionOp; +typedef typename MobiusFermionD::FermionField FermionField; +#endif RealD AllZero(RealD x) { return 0.; } @@ -170,10 +174,11 @@ int main(int argc, char** argv) { int Nm = Nk + Np; int MaxIt = 10000; RealD resid = 1.0e-5; - + RealD mob_b=1.5; //while ( mass > - 5.0){ - FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); +// FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5); + FermionOp Ddwf(Umu,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,mob_b,mob_b-1.); MdagMLinearOperator HermOp(Ddwf); /// <----- // Gamma5HermitianLinearOperator HermOp2(WilsonOperator); /// <----- Gamma5R5HermitianLinearOperator G5R5Herm(Ddwf); diff --git a/tests/lanczos/Test_wilson_DWFKernel.cc b/tests/lanczos/Test_wilson_DWFKernel.cc index 30cbd1b3..ab60d780 100644 --- a/tests/lanczos/Test_wilson_DWFKernel.cc +++ b/tests/lanczos/Test_wilson_DWFKernel.cc @@ -113,6 +113,9 @@ struct LanczosParameters: Serializable { GRID_SERIALIZABLE_CLASS_MEMBERS(LanczosParameters, RealD, mass , RealD, resid, + Integer, Nstop, + Integer, Nk, + Integer, Np, RealD, ChebyLow, RealD, ChebyHigh, Integer, ChebyOrder) @@ -204,7 +207,6 @@ int main(int argc, char** argv) { int Nstop = 5; int Nk = 10; int Np = 90; - int Nm = Nk + Np; int MaxIt = 10000; RealD resid = 1.0e-5; @@ -226,10 +228,14 @@ int main(int argc, char** argv) { XmlWriter HMCwr("LanParams.xml.out"); write(HMCwr,"LanczosParameters",LanParams); } - + Nstop=LanParams.Nstop; + Nk=LanParams.Nk; + Np=LanParams.Np; mass=LanParams.mass; resid=LanParams.resid; + int Nm = Nk + Np; + while ( mass > - 5.0){ FermionOp WilsonOperator(Umu,*FGrid,*FrbGrid,2.+mass); diff --git a/tests/lanczos/Test_wilson_specflow.cc b/tests/lanczos/Test_wilson_specflow.cc index e9bd04df..a23afa94 100644 --- a/tests/lanczos/Test_wilson_specflow.cc +++ b/tests/lanczos/Test_wilson_specflow.cc @@ -27,6 +27,7 @@ directory *************************************************************************************/ /* END LEGAL */ #include +#include using namespace std; using namespace Grid; @@ -38,11 +39,28 @@ typedef typename WilsonFermionD::FermionField FermionField; RealD AllZero(RealD x) { return 0.; } +template void writeFile(T& in, std::string const fname){ +#if 1 + // Ref: https://github.com/paboyle/Grid/blob/feature/scidac-wp1/tests/debug/Test_general_coarse_hdcg_phys48.cc#L111 + std::cout << Grid::GridLogMessage << "Writes to: " << fname << std::endl; + Grid::emptyUserRecord record; + Grid::ScidacWriter WR(in.Grid()->IsBoss()); + WR.open(fname); + WR.writeScidacFieldRecord(in,record,0); + WR.close(); +#endif + // What is the appropriate way to throw error? +} + + namespace Grid { struct LanczosParameters: Serializable { GRID_SERIALIZABLE_CLASS_MEMBERS(LanczosParameters, RealD, mass , + Integer, Nstop, + Integer, Nk, + Integer, Np, RealD, ChebyLow, RealD, ChebyHigh, Integer, ChebyOrder) @@ -158,6 +176,10 @@ int main(int argc, char** argv) { } mass=LanParams.mass; + Nstop=LanParams.Nstop; + Nk=LanParams.Nk; + Np=LanParams.Np; + Nm = Nk + Np; while ( mass > - 5.0){ @@ -202,6 +224,12 @@ while ( mass > - 5.0){ tmp = g5*evec[i]; dot = innerProduct(tmp,evec[i]); std::cout << mass << " : " << eval[i] << " " << real(dot) << " " << imag(dot) << std::endl ; +// if ( i<1) + { + std::string evfile ("./evec_"+std::to_string(mass)+"_"+std::to_string(i)); + auto evdensity = localInnerProduct(evec[i],evec[i] ); + writeFile(evdensity,evfile); + } } src = evec[0]+evec[1]+evec[2]; mass += -0.1;