From cfe5fa7a35121be865f8eb9f934ee9852a5d693f Mon Sep 17 00:00:00 2001 From: Michael Marshall <43034299+mmphys@users.noreply.github.com> Date: Wed, 1 May 2019 09:50:23 +0100 Subject: [PATCH] 1) Don't write Laplacian eigenvectors to disk 2) Add a test that loads perambulators from disk --- Hadrons/Modules/MDistil/LapEvec.hpp | 12 +++--- tests/hadrons/Test_distil.cc | 57 ++++++++++++++++++++++------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/Hadrons/Modules/MDistil/LapEvec.hpp b/Hadrons/Modules/MDistil/LapEvec.hpp index 1b603ef6..cbbbebae 100644 --- a/Hadrons/Modules/MDistil/LapEvec.hpp +++ b/Hadrons/Modules/MDistil/LapEvec.hpp @@ -229,8 +229,6 @@ void TLapEvec::execute(void) envGetTmp(LatticeColourVector, src); const int Ntlocal{gridHD->LocalDimensions()[Tdir]}; const int Ntfirst{gridHD->LocalStarts()[Tdir]}; - const char DefaultOperatorXml[] = "Michael"; - const char DefaultsolverXml[] = "Felix"; for(int t = Ntfirst; t < Ntfirst + Ntlocal; t++ ) { LOG(Message) << "------------------------------------------------------------" << std::endl; LOG(Message) << " Compute eigenpack, Timeslice = " << t << " / " << Ntfirst + Ntlocal << std::endl; @@ -266,16 +264,16 @@ void TLapEvec::execute(void) eig4d.eval[i] = eig[t].eval[i]; // TODO: Discuss: is this needed? Is there a better way? } } - + GridLogIRL.Active( PreviousIRLLogState ); +#if DEBUG // Now write out the 4d eigenvectors - eig4d.record.operatorXml = DefaultOperatorXml; - eig4d.record.solverXml = DefaultsolverXml; + eig4d.record.operatorXml = "Distillation"; + eig4d.record.solverXml = "CG"; std::string sEigenPackName(getName()); sEigenPackName.append("."); sEigenPackName.append(std::to_string(vm().getTrajectory())); eig4d.write(sEigenPackName,false); - - GridLogIRL.Active( PreviousIRLLogState ); +#endif } END_MODULE_NAMESPACE diff --git a/tests/hadrons/Test_distil.cc b/tests/hadrons/Test_distil.cc index bf53f2b2..cb6475ee 100644 --- a/tests/hadrons/Test_distil.cc +++ b/tests/hadrons/Test_distil.cc @@ -61,6 +61,18 @@ void test_Global(Application &application) application.setPar(globalPar); } +///////////////////////////////////////////////////////////// +// Create a random gauge with the correct name +///////////////////////////////////////////////////////////// + +std::string test_Gauge(Application &application, const char * pszBaseName ) +{ + std::string sGaugeName{ pszBaseName }; + sGaugeName.append( "_gauge" ); + application.createModule( sGaugeName ); + return sGaugeName; +} + ///////////////////////////////////////////////////////////// // Test creation of laplacian eigenvectors ///////////////////////////////////////////////////////////// @@ -68,13 +80,8 @@ void test_Global(Application &application) void test_LapEvec(Application &application) { const char szModuleName[] = "LapEvec"; - // gauge field - std::string sGaugeName{szModuleName}; - sGaugeName.append( "_gauge" ); - application.createModule(sGaugeName); - // Now make an instance of the LapEvec object + test_Gauge( application, szModuleName ); MDistil::LapEvecPar p; - //p.gauge = sGaugeName; // This is the default for LapEvec, so no need to be explicit p.Stout.steps = 3; p.Stout.rho = 0.2; p.Cheby.PolyOrder = 11; @@ -144,11 +151,29 @@ std::string test_Noises(Application &application, const std::string &sNoiseBaseN // Perambulators ///////////////////////////////////////////////////////////// +std::string PerambulatorName( const char * pszSuffix = nullptr ) +{ + std::string sPerambulatorName{ "Peramb" }; + if( pszSuffix && pszSuffix[0] ) + sPerambulatorName.append( pszSuffix ); + return sPerambulatorName; +} + +void test_LoadPerambulators( Application &application, const char * pszSuffix = nullptr ) +{ + std::string sModuleName{ PerambulatorName( pszSuffix ) }; + MIO::LoadPerambulator::Par PerambPar; + PerambPar.PerambFileName = sModuleName; + PerambPar.Distil.tsrc = 0; + PerambPar.Distil.nnoise = 1; + PerambPar.nvec = 5; + test_Noises(application, sModuleName); // I want these written after solver stuff + application.createModule( sModuleName, PerambPar ); +} + void test_Perambulators( Application &application, const char * pszSuffix = nullptr ) { - std::string sModuleName{ "Peramb" }; - if( pszSuffix && pszSuffix[0] ) - sModuleName.append( pszSuffix ); + std::string sModuleName{ PerambulatorName( pszSuffix ) }; // Perambulator parameters MDistil::Peramb::Par PerambPar; PerambPar.lapevec = "LapEvec"; @@ -927,19 +952,25 @@ int main(int argc, char *argv[]) //const unsigned int nt = GridDefaultLatt()[Tp]; switch(iTestNum) { + case 0: + test_Global( application ); + test_LapEvec( application ); + break; case 1: test_Global( application ); test_LapEvec( application ); + test_Perambulators( application ); break; - case 2: + default: // 2 test_Global( application ); test_LapEvec( application ); test_Perambulators( application ); + test_DistilVectors( application ); break; - default: // 3 + case 3: test_Global( application ); test_LapEvec( application ); - test_Perambulators( application ); + test_LoadPerambulators( application ); test_DistilVectors( application ); break; case 4: @@ -950,7 +981,7 @@ int main(int argc, char *argv[]) test_MesonField( application, "Phi", "_phi" ); test_MesonField( application, "Rho", "_rho" ); break; - case 5: // 3 + case 5: test_Global( application ); test_LapEvec( application ); test_Perambulators( application );