diff --git a/Hadrons/Modules/MDistil/DistilPar.hpp b/Hadrons/Modules/MDistil/DistilPar.hpp index 328280bc..d1f333c5 100644 --- a/Hadrons/Modules/MDistil/DistilPar.hpp +++ b/Hadrons/Modules/MDistil/DistilPar.hpp @@ -18,6 +18,7 @@ class DistilParPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(DistilParPar, + int, nvec, int, nnoise, int, tsrc, int, TI, @@ -74,7 +75,7 @@ std::vector TDistilPar::getOutput(void) template void TDistilPar::setup(void) { - + // envCreate(Hadrons::MDistil::DistilParameters, getName(), 1); //DOES NOT WORK } // execution /////////////////////////////////////////////////////////////////// @@ -82,11 +83,12 @@ template void TDistilPar::execute(void) { Hadrons::MDistil::DistilParameters &out = envGet(Hadrons::MDistil::DistilParameters, getName()); + /* out.nvec=par().nvec; out.nnoise=par().nnoise; out.tsrc=par().tsrc; out.TI=par().TI; out.LI=par().LI; - out.SI=par().SI; + out.SI=par().SI; */ } END_MODULE_NAMESPACE diff --git a/Hadrons/Modules/MDistil/DistilVectors.hpp b/Hadrons/Modules/MDistil/DistilVectors.hpp index ec8c8d59..919c6d91 100644 --- a/Hadrons/Modules/MDistil/DistilVectors.hpp +++ b/Hadrons/Modules/MDistil/DistilVectors.hpp @@ -49,7 +49,7 @@ public: std::string, lapevec, std::string, rho, std::string, phi, - MDistil::DistilParameters, DistilPar); + std::string, DistilPar); }; template @@ -78,6 +78,7 @@ public: std::string PerambulatorName; std::string NoiseVectorName; std::string LapEvecName; + std::string DParName; bool bMakeRho; bool bMakePhi; std::string RhoName; @@ -108,7 +109,8 @@ std::vector TDistilVectors::getInput(void) PerambulatorName = par().perambulator; NoiseVectorName = par().noise; LapEvecName = par().lapevec; - return { PerambulatorName, NoiseVectorName, LapEvecName }; + DParName = par().DistilPar; + return { PerambulatorName, NoiseVectorName, LapEvecName, DParName }; } template @@ -142,16 +144,17 @@ void TDistilVectors::setup(void) Cleanup(); auto &noise = envGet(NoiseTensor, NoiseVectorName); auto &perambulator = envGet(PerambTensor, PerambulatorName); + auto &DPar = envGet(MDistil::DistilParameters, DParName); // We expect the perambulator to have been created with these indices assert( perambulator.ValidateIndexNames() && "Perambulator index names bad" ); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; @@ -195,6 +198,7 @@ void TDistilVectors::execute(void) auto &noise = envGet(NoiseTensor, NoiseVectorName); auto &perambulator = envGet(PerambTensor, PerambulatorName); auto &epack = envGet(Grid::Hadrons::EigenPack, LapEvecName); + auto &DPar = envGet(MDistil::DistilParameters, DParName); envGetTmp(LatticeSpinColourVector, source4d); envGetTmp(LatticeSpinColourVector, source3d); @@ -206,12 +210,12 @@ void TDistilVectors::execute(void) const int Ntfirst{ grid4d->LocalStarts()[3] }; const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int tsrc{par().DistilPar.tsrc}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int tsrc{DPar.tsrc}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; diff --git a/Hadrons/Modules/MDistil/Noises.hpp b/Hadrons/Modules/MDistil/Noises.hpp index 1af023e4..10596260 100644 --- a/Hadrons/Modules/MDistil/Noises.hpp +++ b/Hadrons/Modules/MDistil/Noises.hpp @@ -43,7 +43,7 @@ class NoisesPar: Serializable { public: GRID_SERIALIZABLE_CLASS_MEMBERS(NoisesPar, - MDistil::DistilParameters, DistilPar, + std::string, DistilPar, std::string, NoiseFileName) }; @@ -62,6 +62,8 @@ public: virtual void setup(void); // execution virtual void execute(void); +protected: + std::string DParName; }; MODULE_REGISTER_TMP(Noises, TNoises, MDistil); @@ -79,7 +81,8 @@ TNoises::TNoises(const std::string name) template std::vector TNoises::getInput(void) { - return {}; + DParName = par().DistilPar; + return { DParName }; } template @@ -93,9 +96,10 @@ std::vector TNoises::getOutput(void) template void TNoises::setup(void) { + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; envCreate(NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns); } @@ -103,11 +107,12 @@ void TNoises::setup(void) template void TNoises::execute(void) { + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nnoise{par().DistilPar.nnoise}; - const int nvec{par().DistilPar.nvec}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; + const int nnoise{DPar.nnoise}; + const int nvec{DPar.nvec}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; const bool full_tdil{ TI == Nt }; const bool exact_distillation{ full_tdil && LI == nvec }; diff --git a/Hadrons/Modules/MDistil/PerambFromSolve.hpp b/Hadrons/Modules/MDistil/PerambFromSolve.hpp index 662055a0..dec76404 100644 --- a/Hadrons/Modules/MDistil/PerambFromSolve.hpp +++ b/Hadrons/Modules/MDistil/PerambFromSolve.hpp @@ -53,7 +53,7 @@ public: std::string, solve, std::string, nvec_reduced, std::string, LI_reduced, - MDistil::DistilParameters, DistilPar); + std::string, DistilPar); }; template @@ -75,6 +75,8 @@ public: protected: GridCartesian * grid3d; // Owned by me, so I must delete it GridCartesian * grid4d; + //other members + std::string DParName; protected: virtual void Cleanup(void); @@ -101,7 +103,9 @@ TPerambFromSolve::~TPerambFromSolve(void) template std::vector TPerambFromSolve::getInput(void) { - return std::vector{ par().solve, par().eigenPack }; + //return std::vector{ par().solve, par().eigenPack }; + DParName = par().DistilPar; + return {par().solve, par().eigenPack, DParName }; } template @@ -115,12 +119,13 @@ template void TPerambFromSolve::setup(void) { Cleanup(); + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int LI{par().DistilPar.LI}; - const int TI{par().DistilPar.TI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int LI{DPar.LI}; + const int TI{DPar.TI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; const int nvec_reduced{ par().nvec_reduced.empty() ? nvec:std::stoi(par().nvec_reduced)}; @@ -152,12 +157,13 @@ void TPerambFromSolve::execute(void) GridCartesian * grid4d = env().getGrid(); const int Ntlocal{grid4d->LocalDimensions()[3]}; const int Ntfirst{grid4d->LocalStarts()[3]}; + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; const int nvec_reduced{ par().nvec_reduced.empty() ? nvec:std::stoi(par().nvec_reduced)}; diff --git a/Hadrons/Modules/MDistil/Perambulator.hpp b/Hadrons/Modules/MDistil/Perambulator.hpp index 3cc444e3..beaeb6f0 100644 --- a/Hadrons/Modules/MDistil/Perambulator.hpp +++ b/Hadrons/Modules/MDistil/Perambulator.hpp @@ -49,7 +49,7 @@ public: std::string, PerambFileName, std::string, UnsmearedSinkFileName, std::string, UnsmearedSinkMultiFile, - MDistil::DistilParameters, DistilPar); + std::string, DistilPar); }; template @@ -79,6 +79,7 @@ protected: unsigned int Ls_; std::string sLapEvecName; std::string sNoiseName; + std::string DParName; }; MODULE_REGISTER_TMP(Perambulator, TPerambulator, MDistil); @@ -105,7 +106,8 @@ std::vector TPerambulator::getInput(void) { sLapEvecName = par().lapevec; sNoiseName = par().noise; - return {sLapEvecName, par().solver, sNoiseName }; + DParName = par().DistilPar; + return {sLapEvecName, par().solver, sNoiseName, DParName }; } template @@ -121,13 +123,14 @@ void TPerambulator::setup(void) Cleanup(); grid4d = env().getGrid(); grid3d = MakeLowerDimGrid(grid4d); + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int tsrc{par().DistilPar.tsrc}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int tsrc{DPar.tsrc}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName }; @@ -170,13 +173,14 @@ void TPerambulator::Cleanup(void) template void TPerambulator::execute(void) { + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int tsrc{par().DistilPar.tsrc}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int tsrc{DPar.tsrc}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const int Nt_inv{ full_tdil ? 1 : TI }; diff --git a/Hadrons/Modules/MIO/LoadDistilNoise.hpp b/Hadrons/Modules/MIO/LoadDistilNoise.hpp index a1a20ca1..7b5ce782 100644 --- a/Hadrons/Modules/MIO/LoadDistilNoise.hpp +++ b/Hadrons/Modules/MIO/LoadDistilNoise.hpp @@ -44,7 +44,7 @@ class LoadDistilNoisePar: Serializable public: GRID_SERIALIZABLE_CLASS_MEMBERS(LoadDistilNoisePar, std::string, NoiseFileName, - MDistil::DistilParameters, DistilPar); + std::string, DistilPar); }; template @@ -62,6 +62,8 @@ public: virtual void setup(void); // execution virtual void execute(void); +protected: + std::string DParName; }; MODULE_REGISTER_TMP(LoadDistilNoise, TLoadDistilNoise, MIO); @@ -79,9 +81,9 @@ TLoadDistilNoise::TLoadDistilNoise(const std::string name) template std::vector TLoadDistilNoise::getInput(void) { - std::vector in; + DParName = par().DistilPar; + return { par().NoiseFileName, DParName }; - return in; } template @@ -96,9 +98,10 @@ std::vector TLoadDistilNoise::getOutput(void) template void TLoadDistilNoise::setup(void) { + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; envCreate(MDistil::NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns); } diff --git a/Hadrons/Modules/MIO/LoadPerambulator.hpp b/Hadrons/Modules/MIO/LoadPerambulator.hpp index 45f31b2d..8314c2a9 100644 --- a/Hadrons/Modules/MIO/LoadPerambulator.hpp +++ b/Hadrons/Modules/MIO/LoadPerambulator.hpp @@ -44,7 +44,7 @@ class LoadPerambulatorPar: Serializable public: GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPerambulatorPar, std::string, PerambFileName, - MDistil::DistilParameters, DistilPar); + std::string, DistilPar); }; template @@ -62,6 +62,8 @@ public: virtual void setup(void); // execution virtual void execute(void); +protected: + std::string DParName; }; MODULE_REGISTER_TMP(LoadPerambulator, TLoadPerambulator, MIO); @@ -79,9 +81,8 @@ TLoadPerambulator::TLoadPerambulator(const std::string name) template std::vector TLoadPerambulator::getInput(void) { - std::vector in; - - return in; + DParName = par().DistilPar; + return { par().PerambFileName, DParName }; } template @@ -96,13 +97,14 @@ std::vector TLoadPerambulator::getOutput(void) template void TLoadPerambulator::setup(void) { + auto &DPar = envGet(MDistil::DistilParameters, DParName); const int Nt{env().getDim(Tdir)}; - const int nvec{par().DistilPar.nvec}; - const int nnoise{par().DistilPar.nnoise}; - const int tsrc{par().DistilPar.tsrc}; - const int TI{par().DistilPar.TI}; - const int LI{par().DistilPar.LI}; - const int SI{par().DistilPar.SI}; + const int nvec{DPar.nvec}; + const int nnoise{DPar.nnoise}; + const int tsrc{DPar.tsrc}; + const int TI{DPar.TI}; + const int LI{DPar.LI}; + const int SI{DPar.SI}; const bool full_tdil{ TI == Nt }; const bool exact_distillation{ full_tdil && LI == nvec }; const int Nt_inv{ full_tdil ? 1 : TI }; diff --git a/tests/hadrons/Test_distil.cc b/tests/hadrons/Test_distil.cc index 5e2d50f0..6e79f3f8 100644 --- a/tests/hadrons/Test_distil.cc +++ b/tests/hadrons/Test_distil.cc @@ -58,6 +58,10 @@ void test_Global(Application &application) globalPar.trajCounter.end = 1120; globalPar.trajCounter.step = 20; globalPar.runId = "test"; + globalPar.graphFile = ""; + globalPar.scheduleFile = ""; + globalPar.saveSchedule = "false"; + globalPar.parallelWriteMaxRetry = -1; application.setPar(globalPar); } @@ -65,10 +69,9 @@ void test_Global(Application &application) // Create a random gauge with the correct name ///////////////////////////////////////////////////////////// -std::string test_Gauge(Application &application, const char * pszBaseName ) +std::string test_Gauge(Application &application ) { - std::string sGaugeName{ pszBaseName }; - sGaugeName.append( "_gauge" ); + std::string sGaugeName{ "gauge" }; application.createModule( sGaugeName ); return sGaugeName; } @@ -80,8 +83,9 @@ std::string test_Gauge(Application &application, const char * pszBaseName ) void test_LapEvec(Application &application) { const char szModuleName[] = "LapEvec"; - test_Gauge( application, szModuleName ); + test_Gauge( application ); MDistil::LapEvecPar p; + p.gauge = "gauge"; p.Stout.steps = 3; p.Stout.rho = 0.2; p.Cheby.PolyOrder = 11; @@ -117,7 +121,7 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr sActionName.append( pSuffix ); } MAction::DWF::Par actionPar; - actionPar.gauge = "LapEvec_gauge"; + actionPar.gauge = "gauge"; actionPar.Ls = 16; actionPar.M5 = 1.8; actionPar.mass = 0.005; @@ -133,6 +137,23 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr return sSolverName; } +///////////////////////////////////////////////////////////// +// DistilParameters +///////////////////////////////////////////////////////////// + +std::string test_DPar(Application &application) { + // DistilVectors parameters + MDistil::DistilParPar DistilPar; + DistilPar.nvec = 5; + DistilPar.nnoise = 1; + DistilPar.tsrc = 0; + DistilPar.LI = 5; + DistilPar.TI = 8; + DistilPar.SI = 4; + std::string sDParName{"DPar_l"}; + application.createModule(sDParName,DistilPar); + return sDParName; +} ///////////////////////////////////////////////////////////// // Noises ///////////////////////////////////////////////////////////// @@ -140,8 +161,7 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr std::string test_Noises(Application &application, const std::string &sNoiseBaseName ) { // DistilVectors parameters MDistil::NoisesPar NoisePar; - NoisePar.nnoise = 1; - NoisePar.nvec = 5; + NoisePar.DistilPar = "DPar_l"; std::string sNoiseName{sNoiseBaseName + "_noise"}; application.createModule(sNoiseName,NoisePar); return sNoiseName; @@ -164,9 +184,7 @@ void test_LoadPerambulators( Application &application, const char * pszSuffix = std::string sModuleName{ PerambulatorName( pszSuffix ) }; MIO::LoadPerambulator::Par PerambPar; PerambPar.PerambFileName = sModuleName; - PerambPar.Distil.tsrc = 0; - PerambPar.Distil.nnoise = 1; - PerambPar.nvec = 5; + PerambPar.DistilPar = "DPar_l"; test_Noises(application, sModuleName); // I want these written after solver stuff application.createModule( sModuleName, PerambPar ); } @@ -179,9 +197,7 @@ void test_Perambulators( Application &application, const char * pszSuffix = null PerambPar.lapevec = "LapEvec"; PerambPar.PerambFileName = sModuleName; PerambPar.solver = test_Solver( application, pszSuffix ); - PerambPar.Distil.tsrc = 0; - PerambPar.Distil.nnoise = 1; - PerambPar.nvec = 5; + PerambPar.DistilPar = "DPar_l"; test_Noises(application, sModuleName); // I want these written after solver stuff application.createModule( sModuleName, PerambPar ); } @@ -202,9 +218,7 @@ void test_DistilVectors(Application &application, const char * pszSuffix = nullp DistilVecPar.noise = sPerambName + "_noise"; DistilVecPar.perambulator = sPerambName; DistilVecPar.lapevec = "LapEvec"; - DistilVecPar.tsrc = 0; - if( pszNvec ) - DistilVecPar.nvec = pszNvec; + DistilVecPar.DistilPar = "DPar_l"; application.createModule(sModuleName,DistilVecPar); } @@ -331,15 +345,17 @@ int main(int argc, char *argv[]) LOG(Message) << "Computing Meson 2pt-function" << std::endl; test_Global( application ); test_LapEvec( application ); - test_Perambulators( application ); - test_DistilVectors( application ); - test_MesonField( application, "Phi", "_phi" ); - test_MesonField( application, "Rho", "_rho" ); + test_DPar( application ); + //test_Perambulators( application ); + //test_DistilVectors( application ); + //test_MesonField( application, "Phi", "_phi" ); + //test_MesonField( application, "Rho", "_rho" ); break; case 1: LOG(Message) << "Computing Meson 2pt-function by loading perambulators" << std::endl; test_Global( application ); test_LapEvec( application ); + test_DPar( application ); test_LoadPerambulators( application ); test_DistilVectors( application ); test_MesonField( application, "Phi", "_phi" ); @@ -349,6 +365,7 @@ int main(int argc, char *argv[]) LOG(Message) << "Computing Meson 2pt-function for two quark flavours" << std::endl; test_Global( application ); test_LapEvec( application ); + test_DPar( application ); test_Perambulators( application ); test_DistilVectors( application ); test_Perambulators( application, "S" ); @@ -360,6 +377,7 @@ int main(int argc, char *argv[]) LOG(Message) << "Computing Meson 2pt-function with current insertion" << std::endl; test_Global( application ); test_LapEvec( application ); + test_DPar( application ); test_Perambulators( application ); test_MesonSink( application ); break;