mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Adding ParameterFile option for the HMC
This commit is contained in:
		@@ -56,6 +56,7 @@ class HMCWrapperTemplate: public HMCRunnerBase<ReaderClass> {
 | 
				
			|||||||
  using IntegratorType = Integrator<Implementation, S, RepresentationsPolicy>;
 | 
					  using IntegratorType = Integrator<Implementation, S, RepresentationsPolicy>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HMCparameters Parameters;
 | 
					  HMCparameters Parameters;
 | 
				
			||||||
 | 
					  std::string ParameterFile;
 | 
				
			||||||
  HMCResourceManager<Implementation> Resources;
 | 
					  HMCResourceManager<Implementation> Resources;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // The set of actions (keep here for lower level users, for now)
 | 
					  // The set of actions (keep here for lower level users, for now)
 | 
				
			||||||
@@ -114,6 +115,10 @@ class HMCWrapperTemplate: public HMCRunnerBase<ReaderClass> {
 | 
				
			|||||||
      GridCmdOptionIntVector(arg, ivec);
 | 
					      GridCmdOptionIntVector(arg, ivec);
 | 
				
			||||||
      Parameters.NoMetropolisUntil = ivec[0];
 | 
					      Parameters.NoMetropolisUntil = ivec[0];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (GridCmdOptionExists(argv, argv + argc, "--ParameterFile")) {
 | 
				
			||||||
 | 
					      arg = GridCmdOptionPayload(argv, argv + argc, "--ParameterFile");
 | 
				
			||||||
 | 
					      ParameterFile = arg;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -91,19 +91,28 @@ int main(int argc, char **argv) {
 | 
				
			|||||||
  typedef WilsonImplR FermionImplPolicy;
 | 
					  typedef WilsonImplR FermionImplPolicy;
 | 
				
			||||||
  typedef MobiusFermionR FermionAction;
 | 
					  typedef MobiusFermionR FermionAction;
 | 
				
			||||||
  typedef typename FermionAction::FermionField FermionField;
 | 
					  typedef typename FermionAction::FermionField FermionField;
 | 
				
			||||||
 | 
					 | 
				
			||||||
  // Serialiser
 | 
					  // Serialiser
 | 
				
			||||||
  //typedef Grid::XmlReader       Serialiser;
 | 
					  //typedef Grid::XmlReader       Serialiser;
 | 
				
			||||||
  typedef Grid::JSONReader       Serialiser;
 | 
					  typedef Grid::JSONReader       Serialiser;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 | 
				
			||||||
 | 
					  HMCWrapper TheHMC;
 | 
				
			||||||
 | 
					  TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
  // Reader, file should come from command line
 | 
					  // Reader, file should come from command line
 | 
				
			||||||
  Serialiser Reader("input.json");
 | 
					  if (TheHMC.ParameterFile.empty()){
 | 
				
			||||||
 | 
					    std::cout << "Input file not specified."
 | 
				
			||||||
 | 
					              << "Use --ParameterFile option in the command line.\nAborting" 
 | 
				
			||||||
 | 
					              << std::endl;
 | 
				
			||||||
 | 
					    exit(1);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  Serialiser Reader(TheHMC.ParameterFile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  MobiusHMCParameters MyParams(Reader);  
 | 
					  MobiusHMCParameters MyParams(Reader);  
 | 
				
			||||||
  // Apply smearing to the fermionic action
 | 
					  // Apply smearing to the fermionic action
 | 
				
			||||||
  bool ApplySmearing = MyParams.Mobius.ApplySmearing;
 | 
					  bool ApplySmearing = MyParams.Mobius.ApplySmearing;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 | 
					  
 | 
				
			||||||
  HMCWrapper TheHMC;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Grid from the command line
 | 
					  // Grid from the command line
 | 
				
			||||||
  TheHMC.Resources.AddFourDimGrid("gauge");
 | 
					  TheHMC.Resources.AddFourDimGrid("gauge");
 | 
				
			||||||
@@ -199,7 +208,6 @@ int main(int argc, char **argv) {
 | 
				
			|||||||
  TheHMC.Parameters.MD.trajL   = 1.0;
 | 
					  TheHMC.Parameters.MD.trajL   = 1.0;
 | 
				
			||||||
  */
 | 
					  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TheHMC.ReadCommandLine(argc, argv); // these can be parameters from file
 | 
					 | 
				
			||||||
  // Reset performance counters 
 | 
					  // Reset performance counters 
 | 
				
			||||||
  NumOp.ZeroCounters();
 | 
					  NumOp.ZeroCounters();
 | 
				
			||||||
  DenOp.ZeroCounters();
 | 
					  DenOp.ZeroCounters();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user