1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 01:05:38 +01:00

1) Don't write Laplacian eigenvectors to disk 2) Add a test that loads perambulators from disk

This commit is contained in:
Michael Marshall 2019-05-01 09:50:23 +01:00
parent e72e26c899
commit cfe5fa7a35
2 changed files with 49 additions and 20 deletions

View File

@ -229,8 +229,6 @@ void TLapEvec<GImpl>::execute(void)
envGetTmp(LatticeColourVector, src);
const int Ntlocal{gridHD->LocalDimensions()[Tdir]};
const int Ntfirst{gridHD->LocalStarts()[Tdir]};
const char DefaultOperatorXml[] = "<OPERATOR>Michael</OPERATOR>";
const char DefaultsolverXml[] = "<SOLVER>Felix</SOLVER>";
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<GImpl>::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 = "<OPERATOR>Distillation</OPERATOR>";
eig4d.record.solverXml = "<SOLVER>CG</SOLVER>";
std::string sEigenPackName(getName());
sEigenPackName.append(".");
sEigenPackName.append(std::to_string(vm().getTrajectory()));
eig4d.write(sEigenPackName,false);
GridLogIRL.Active( PreviousIRLLogState );
#endif
}
END_MODULE_NAMESPACE

View File

@ -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<MGauge::Random>( 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<MGauge::Random>(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<MIO::LoadPerambulator>( 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 );