From 6bb9b67c93b2dbce1a45b2b566e8c9791488051d Mon Sep 17 00:00:00 2001 From: ferben Date: Wed, 13 Mar 2019 12:09:12 +0000 Subject: [PATCH] externalised gauge field reading to hadrons module --- Hadrons/Modules/MDistil/LapEvec.hpp | 46 +-------- Hadrons/Modules/MDistil/PerambLight.hpp | 119 +----------------------- 2 files changed, 5 insertions(+), 160 deletions(-) diff --git a/Hadrons/Modules/MDistil/LapEvec.hpp b/Hadrons/Modules/MDistil/LapEvec.hpp index 22ca8526..829cfcf7 100644 --- a/Hadrons/Modules/MDistil/LapEvec.hpp +++ b/Hadrons/Modules/MDistil/LapEvec.hpp @@ -86,8 +86,8 @@ class LapEvecPar: Serializable public: GRID_SERIALIZABLE_CLASS_MEMBERS(LapEvecPar, std::string, gauge, - std::string, ConfigFileDir, - std::string, ConfigFileName, + // std::string, ConfigFileDir, + // std::string, ConfigFileName, //,std::string, EigenPackName StoutParameters, Stout ,ChebyshevParameters, Cheby @@ -211,11 +211,6 @@ void TLapEvec::execute(void) { LOG(Message) << "execute() : start for " << getName() << std::endl; - // Alii for parameters - //const int &TI{par().Distil.TI}; - //const int &LI{par().Distil.LI}; - //const int &nnoise{par().Distil.Nnoise}; - //const int &tsrc{par().Distil.tSrc}; const ChebyshevParameters &ChebPar{par().Cheby}; const LanczosParameters &LPar{par().Lanczos}; const int &nvec{LPar.Nvec}; @@ -231,45 +226,8 @@ void TLapEvec::execute(void) //else //assert(nnoise>1); - const std::string &ConfigFileDir{par().ConfigFileDir}; - const std::string &ConfigFileName{par().ConfigFileName}; - - // Debugging only - //envGetTmp(GaugeField, Umu); auto &Umu = envGet(GaugeField, par().gauge); envGetTmp(GaugeField, Umu_smear); - FieldMetaData header; - if((0)) { - const std::vector seeds({1, 2, 3, 4, 5}); - GridParallelRNG pRNG4d(gridHD); - pRNG4d.SeedFixedIntegers(seeds); - std::cout << GridLogMessage << "now hot config" << std::endl; - SU::HotConfiguration(pRNG4d, Umu); - std::cout << GridLogMessage << "hot cfg done." << std::endl; - - // Set up the SAME gauge field on every time plane - Grid_unquiesce_nodes(); - Umu_smear = Umu; - Lattice > coor(gridHD); - LatticeCoordinate(coor,Tdir); - for(int t=1;t 7,0,1,2,3,4,5,6 t=1 - // 0,0,2,3,4,5,6,7 6,7,0,1,2,3,4,5 t=2 - // 0,0,0,3,4,5,6,7 5,6,7,0,1,2,3,4 t=3 - //... - - Umu_smear = Cshift(Umu_smear,Tdir,-1); - Umu = where(coor==t,Umu_smear,Umu); - } - // std::cout << "Umu is "< DistilParameters(Reader& Reader){read(Reader,"Distil",*this);} -}; - */ -/*struct SolverParameters: Serializable { - GRID_SERIALIZABLE_CLASS_MEMBERS(SolverParameters, - double, CGPrecision, - int, MaxIterations, - double, mass, - double, M5) - SolverParameters() = default; - template SolverParameters(Reader& Reader){read(Reader,"Solver",*this);} -};*/ class PerambLightPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(PerambLightPar, std::string, eigenPack, - std::string, PerambFileName, - std::string, ConfigFileDir, - std::string, ConfigFileName, + std::string, PerambFileName, //stem!!! std::string, UniqueIdentifier, bool, multiFile, int, nvec, -// int, Ls, // For makeFiveDimGrid DistilParameters, Distil, std::string, solver); -// SolverParameters, Solver); }; template @@ -132,7 +104,6 @@ void TPerambLight::setup(void) { Cleanup(); - // auto &noise = envGet(std::vector>>, par().noise); const int nvec{par().nvec}; const DistilParameters & Distil{par().Distil}; const int LI{Distil.LI}; @@ -140,12 +111,7 @@ void TPerambLight::setup(void) const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI; const int Ns{Distil.Ns}; std::array sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"}; - //std::complex z{0.6,-3.1}; - //envCreate(std::string, getName() + "_debug_delete_me", 1, "Bingonuts"); - //envCreate(std::complex, getName() + "_debug_delete_me_2", 1, 0.6); - //envCreate(std::complex, getName() + "_debug_delete_me_3", 1, z); - //envCreate(std::complex, getName() + "_debug_delete_me_4", 1, {0.6 COMMA -3.1}); - //envCreate(std::array, getName() + "_debug_delete_me_5", 1, {"One" COMMA "Two" COMMA "Three"}); + envCreate(Perambulator, getName() + "_perambulator_light", 1, sIndexNames,Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI); envCreate(std::vector, getName() + "_noise", 1, @@ -156,14 +122,10 @@ void TPerambLight::setup(void) grid4d = env().getGrid(); grid3d = MakeLowerDimGrid(grid4d);//new GridCartesian(latt_size,simd_layout_3,mpi_layout,*grid4d); - envTmpLat(GaugeField, "Umu"); envTmpLat(LatticeSpinColourVector, "dist_source"); envTmpLat(LatticeSpinColourVector, "tmp2"); envTmpLat(LatticeSpinColourVector, "result"); - //envTmpLat(LatticeSpinColourVector, "result_single_component"); envTmpLat(LatticeColourVector, "result_nospin"); - //envTmpLat(LatticeColourVector, "tmp_nospin"); - //envTmpLat(LatticeSpinVector, "peramb_tmp"); envTmp(LatticeSpinColourVector, "tmp3d",1,LatticeSpinColourVector(grid3d)); envTmp(LatticeColourVector, "tmp3d_nospin",1,LatticeColourVector(grid3d)); envTmp(LatticeColourVector, "result_3d",1,LatticeColourVector(grid3d)); @@ -193,7 +155,6 @@ void TPerambLight::execute(void) { const int nvec{par().nvec}; const DistilParameters & Distil{par().Distil}; - //const SolverParameters & Solver{par().Solver}; const int LI{Distil.LI}; //const int SI{Distil.SI}; const int TI{Distil.TI}; @@ -209,64 +170,21 @@ void TPerambLight::execute(void) envGetTmp(FermionField, v5dtmp); envGetTmp(FermionField, v5dtmp_sol); - //const Real mass{Solver.mass}; - //const Real M5 {Solver.M5}; const bool full_tdil{TI==Nt}; const bool exact_distillation{full_tdil && LI==nvec}; - const std::string &ConfigFileDir{par().ConfigFileDir}; - const std::string &ConfigFileName{par().ConfigFileName}; const std::string &UniqueIdentifier{par().UniqueIdentifier}; - //auto &noise = envGet(std::vector>>, par().noise); auto &noise = envGet(std::vector, getName() + "_noise"); auto &perambulator = envGet(Perambulator, getName() + "_perambulator_light"); auto &epack = envGet(Grid::Hadrons::EigenPack, par().eigenPack); auto &unsmeared_sink = envGet(std::vector, getName() + "_unsmeared_sink"); - envGetTmp(GaugeField, Umu); - FieldMetaData header; - if((0)){ - const std::vector seeds({1, 2, 3, 4, 5}); - GridParallelRNG pRNG4d(grid4d); - pRNG4d.SeedFixedIntegers(seeds); - std::cout << GridLogMessage << "now hot config" << std::endl; - SU::HotConfiguration(pRNG4d, Umu); - std::cout << GridLogMessage << "hot cfg done." << std::endl; - - // Set up the SAME gauge field on every time plane - // int Nt = grid4d->gDimensions()[Tdir]; - Grid_unquiesce_nodes(); - - auto Usft = Umu; - Lattice > coor(grid4d); - LatticeCoordinate(coor,Tdir); - for(int t=1;t 7,0,1,2,3,4,5,6 t=1 - // 0,0,2,3,4,5,6,7 6,7,0,1,2,3,4,5 t=2 - // 0,0,0,3,4,5,6,7 5,6,7,0,1,2,3,4 t=3 - //... - - Usft = Cshift(Usft,Tdir,-1); - Umu = where(coor==t,Usft,Umu); - } - } else { - //std::string fileName( "/home/dp008/dp008/dc-rich6/Scripts/ConfigsDeflQED/ckpoint_lat.3000" ); - std::string fileName(ConfigFileDir + ConfigFileName); - std::cout << GridLogMessage << "Loading NERSC configuration from '" << fileName << "'" << std::endl; - NerscIO::readConfiguration(Umu, header, fileName); - std::cout << GridLogMessage << "reading done." << std::endl; - } - //Create Noises - //std::cout << pszGaugeConfigFile << std::endl; - //GridSerialRNG sRNG; sRNG.SeedUniqueString(std::string(pszGaugeConfigFile)); GridSerialRNG sRNG; - sRNG.SeedUniqueString(ConfigFileName + "_" + UniqueIdentifier); + sRNG.SeedUniqueString(UniqueIdentifier); //maybe add trajectory number?? Real rn; for (int inoise=0;inoise::execute(void) for (int is=0;is::execute(void) envGetTmp(LatticeSpinColourVector, dist_source); envGetTmp(LatticeSpinColourVector, tmp2); envGetTmp(LatticeSpinColourVector, result); - //envGetTmp(LatticeSpinColourVector, result_single_component); envGetTmp(LatticeColourVector, result_nospin); - //envGetTmp(LatticeColourVector, tmp_nospin); - //envGetTmp(LatticeSpinVector, peramb_tmp); envGetTmp(LatticeSpinColourVector, tmp3d); envGetTmp(LatticeColourVector, tmp3d_nospin); envGetTmp(LatticeColourVector, result_3d); @@ -321,25 +235,8 @@ void TPerambLight::execute(void) GridRedBlackCartesian RBGrid(grid4d); std::cout << "init RBG done" << std::endl; - //const int Ls{par().Ls}; - //const double CGPrecision{Solver.CGPrecision}; - //const int MaxIterations {Solver.MaxIterations}; { - /*GridCartesian * FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,grid4d); - GridRedBlackCartesian * FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,grid4d); - - typedef DomainWallFermionR FermionAction; - - FermionAction Dop(Umu,*FGrid,*FrbGrid,*grid4d,RBGrid,mass,M5); - - MdagMLinearOperator HermOp(Dop); - ConjugateGradient CG(CGPrecision,MaxIterations); - SchurRedBlackDiagMooeeSolve SchurSolver(CG); - LatticeSpinColourVector a(grid4d); - LatticeColourVector b(grid4d); - b= peekSpin(a,0); -*/ int t_inv; for (int inoise = 0; inoise < nnoise; inoise++) { for (int dk = 0; dk < LI; dk++) { @@ -367,12 +264,6 @@ void TPerambLight::execute(void) } std::cout << "Inversion for noise " << inoise << " and dilution component (d_k,d_t,d_alpha) : (" << dk << ","<< dt << "," << ds << ")" << std::endl; result=zero; - /*LatticeFermion src5(FGrid); - LatticeFermion sol5(FGrid); - Dop.ImportPhysicalFermionSource(dist_source,src5); - SchurSolver(Dop,src5,sol5); - Dop.ExportPhysicalFermionSolution(sol5,result); //These are the meson sinks - */ v4dtmp = dist_source; if (Ls_ == 1){ solver(result, v4dtmp); @@ -400,14 +291,10 @@ void TPerambLight::execute(void) } } } - // Kill our 5 dimensional grid (avoid leaks). Should really declare these objects temporary - //delete FrbGrid; - //delete FGrid; } std::cout << "perambulator done" << std::endl; perambulator.SliceShare( grid3d, grid4d ); - // THIS IS WHERE WE WANT TO SAVE THE PERAMBULATORS TO DISK if(PerambFileName.length()) perambulator.WriteBinary(PerambFileName); }