mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	1) Don't write Laplacian eigenvectors to disk 2) Add a test that loads perambulators from disk
This commit is contained in:
		@@ -229,8 +229,6 @@ void TLapEvec<GImpl>::execute(void)
 | 
				
			|||||||
  envGetTmp(LatticeColourVector, src);
 | 
					  envGetTmp(LatticeColourVector, src);
 | 
				
			||||||
  const int Ntlocal{gridHD->LocalDimensions()[Tdir]};
 | 
					  const int Ntlocal{gridHD->LocalDimensions()[Tdir]};
 | 
				
			||||||
  const int Ntfirst{gridHD->LocalStarts()[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++ ) {
 | 
					  for(int t = Ntfirst; t < Ntfirst + Ntlocal; t++ ) {
 | 
				
			||||||
    LOG(Message) << "------------------------------------------------------------" << std::endl;
 | 
					    LOG(Message) << "------------------------------------------------------------" << std::endl;
 | 
				
			||||||
    LOG(Message) << " Compute eigenpack, Timeslice = " << t << " / " << Ntfirst + Ntlocal << 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?
 | 
					        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
 | 
					  // Now write out the 4d eigenvectors
 | 
				
			||||||
  eig4d.record.operatorXml = DefaultOperatorXml;
 | 
					  eig4d.record.operatorXml = "<OPERATOR>Distillation</OPERATOR>";
 | 
				
			||||||
  eig4d.record.solverXml = DefaultsolverXml;
 | 
					  eig4d.record.solverXml = "<SOLVER>CG</SOLVER>";
 | 
				
			||||||
  std::string sEigenPackName(getName());
 | 
					  std::string sEigenPackName(getName());
 | 
				
			||||||
  sEigenPackName.append(".");
 | 
					  sEigenPackName.append(".");
 | 
				
			||||||
  sEigenPackName.append(std::to_string(vm().getTrajectory()));
 | 
					  sEigenPackName.append(std::to_string(vm().getTrajectory()));
 | 
				
			||||||
  eig4d.write(sEigenPackName,false);
 | 
					  eig4d.write(sEigenPackName,false);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
  GridLogIRL.Active( PreviousIRLLogState );
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
END_MODULE_NAMESPACE
 | 
					END_MODULE_NAMESPACE
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,18 @@ void test_Global(Application &application)
 | 
				
			|||||||
  application.setPar(globalPar);
 | 
					  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
 | 
					// Test creation of laplacian eigenvectors
 | 
				
			||||||
/////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////
 | 
				
			||||||
@@ -68,13 +80,8 @@ void test_Global(Application &application)
 | 
				
			|||||||
void test_LapEvec(Application &application)
 | 
					void test_LapEvec(Application &application)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const char szModuleName[] = "LapEvec";
 | 
					  const char szModuleName[] = "LapEvec";
 | 
				
			||||||
  // gauge field
 | 
					  test_Gauge( application, szModuleName );
 | 
				
			||||||
  std::string sGaugeName{szModuleName};
 | 
					 | 
				
			||||||
  sGaugeName.append( "_gauge" );
 | 
					 | 
				
			||||||
  application.createModule<MGauge::Random>(sGaugeName);
 | 
					 | 
				
			||||||
  // Now make an instance of the LapEvec object
 | 
					 | 
				
			||||||
  MDistil::LapEvecPar p;
 | 
					  MDistil::LapEvecPar p;
 | 
				
			||||||
  //p.gauge = sGaugeName; // This is the default for LapEvec, so no need to be explicit
 | 
					 | 
				
			||||||
  p.Stout.steps = 3;
 | 
					  p.Stout.steps = 3;
 | 
				
			||||||
  p.Stout.rho = 0.2;
 | 
					  p.Stout.rho = 0.2;
 | 
				
			||||||
  p.Cheby.PolyOrder = 11;
 | 
					  p.Cheby.PolyOrder = 11;
 | 
				
			||||||
@@ -144,11 +151,29 @@ std::string test_Noises(Application &application, const std::string &sNoiseBaseN
 | 
				
			|||||||
// Perambulators
 | 
					// 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 )
 | 
					void test_Perambulators( Application &application, const char * pszSuffix = nullptr )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  std::string sModuleName{ "Peramb" };
 | 
					  std::string sModuleName{ PerambulatorName( pszSuffix ) };
 | 
				
			||||||
  if( pszSuffix && pszSuffix[0] )
 | 
					 | 
				
			||||||
    sModuleName.append( pszSuffix );
 | 
					 | 
				
			||||||
  // Perambulator parameters
 | 
					  // Perambulator parameters
 | 
				
			||||||
  MDistil::Peramb::Par PerambPar;
 | 
					  MDistil::Peramb::Par PerambPar;
 | 
				
			||||||
  PerambPar.lapevec = "LapEvec";
 | 
					  PerambPar.lapevec = "LapEvec";
 | 
				
			||||||
@@ -927,19 +952,25 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
  //const unsigned int  nt    = GridDefaultLatt()[Tp];
 | 
					  //const unsigned int  nt    = GridDefaultLatt()[Tp];
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  switch(iTestNum) {
 | 
					  switch(iTestNum) {
 | 
				
			||||||
 | 
					    case 0:
 | 
				
			||||||
 | 
					      test_Global( application );
 | 
				
			||||||
 | 
					      test_LapEvec( application );
 | 
				
			||||||
 | 
					      break;
 | 
				
			||||||
    case 1:
 | 
					    case 1:
 | 
				
			||||||
      test_Global( application );
 | 
					      test_Global( application );
 | 
				
			||||||
      test_LapEvec( application );
 | 
					      test_LapEvec( application );
 | 
				
			||||||
 | 
					      test_Perambulators( application );
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case 2:
 | 
					    default: // 2
 | 
				
			||||||
      test_Global( application );
 | 
					      test_Global( application );
 | 
				
			||||||
      test_LapEvec( application );
 | 
					      test_LapEvec( application );
 | 
				
			||||||
      test_Perambulators( application );
 | 
					      test_Perambulators( application );
 | 
				
			||||||
 | 
					      test_DistilVectors( application );
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    default: // 3
 | 
					    case 3:
 | 
				
			||||||
      test_Global( application );
 | 
					      test_Global( application );
 | 
				
			||||||
      test_LapEvec( application );
 | 
					      test_LapEvec( application );
 | 
				
			||||||
      test_Perambulators( application );
 | 
					      test_LoadPerambulators( application );
 | 
				
			||||||
      test_DistilVectors( application );
 | 
					      test_DistilVectors( application );
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case 4:
 | 
					    case 4:
 | 
				
			||||||
@@ -950,7 +981,7 @@ int main(int argc, char *argv[])
 | 
				
			|||||||
      test_MesonField( application, "Phi", "_phi" );
 | 
					      test_MesonField( application, "Phi", "_phi" );
 | 
				
			||||||
      test_MesonField( application, "Rho", "_rho" );
 | 
					      test_MesonField( application, "Rho", "_rho" );
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case 5: // 3
 | 
					    case 5:
 | 
				
			||||||
      test_Global( application );
 | 
					      test_Global( application );
 | 
				
			||||||
      test_LapEvec( application );
 | 
					      test_LapEvec( application );
 | 
				
			||||||
      test_Perambulators( application );
 | 
					      test_Perambulators( application );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user