1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-13 04:37:05 +01:00

Removing redundant arguments for integrator functions, step 1

This commit is contained in:
Guido Cossu
2016-12-20 17:51:30 +00:00
parent 0bd296dda4
commit ce1a115e0b
7 changed files with 152 additions and 92 deletions

View File

@ -63,6 +63,11 @@ class HMCRunnerParameters : Serializable {
class HmcRunner : public BinaryHmcRunner {
public:
HMCRunnerParameters HMCPar;
void BuildTheAction(int argc, char **argv){}
};
/*
// eliminate arcg and argv from here
void BuildTheAction(int argc, char **argv)
{
@ -90,6 +95,7 @@ class HmcRunner : public BinaryHmcRunner {
// Add observables
// options for checkpointers
// this can be moved outside the BuildTheAction
//BinaryHmcCheckpointer
//ILDGHmcCheckpointer
//NerscHmcCheckpointer
@ -107,9 +113,11 @@ class HmcRunner : public BinaryHmcRunner {
ObservablesList.push_back(&PlaqLog);
ObservablesList.push_back(&Checkpoint);
// This must run from here so that the grids are defined
Run(argc, argv, Checkpoint); // no smearing
};
};
*/
}
}
@ -136,7 +144,57 @@ int main(int argc, char **argv) {
TheHMC.MDparameters.set(TheHMC.HMCPar.MDsteps, TheHMC.HMCPar.TrajectorLength);
TheHMC.BuildTheAction(argc, argv);
//TheHMC.BuildTheAction(argc, argv);
// Typedefs to simplify notation
typedef WilsonGaugeActionR GaugeAction;
typedef WilsonImplR ImplPolicy;
typedef WilsonFermionR FermionAction;
typedef typename FermionAction::FermionField FermionField;
// this can be simplified too. MakeDefaultGrid(Nd)
TheHMC.UGrid = SpaceTimeGrid::makeFourDimGrid(
GridDefaultLatt(),
GridDefaultSimd(Nd, vComplex::Nsimd()),
GridDefaultMpi());
// Gauge action
std::cout << GridLogMessage << "Beta: " << TheHMC.HMCPar.beta << std::endl;
GaugeAction Waction(TheHMC.HMCPar.beta);
// Collect actions
ActionLevel<BinaryHmcRunner::Field> Level1(1);
Level1.push_back(&Waction);
TheHMC.TheAction.push_back(Level1);
// Add observables
// options for checkpointers
// this can be moved outside the BuildTheAction
//BinaryHmcCheckpointer
//ILDGHmcCheckpointer
//NerscHmcCheckpointer
NerscHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(
TheHMC.HMCPar.conf_prefix, TheHMC.HMCPar.rng_prefix, TheHMC.HMCPar.SaveInterval, TheHMC.HMCPar.format);
// Can implement also a specific function in the hmcrunner
// AddCheckpoint (...) that takes the same parameters + a string/tag
// defining the type of the checkpointer
// with tags can be implemented by overloading and no ifs
// Then force all checkpoint to have few common functions
// return an object that is then passed to the Run function
PlaquetteLogger<BinaryHmcRunner::ImplPolicy> PlaqLog(
std::string("Plaquette"));
TheHMC.ObservablesList.push_back(&PlaqLog);
TheHMC.ObservablesList.push_back(&Checkpoint);
// This must run from here so that the grids are defined
TheHMC.Run(argc, argv, Checkpoint); // no smearing
Grid_finalize();
}

View File

@ -67,7 +67,7 @@ int main(int argc, char** argv) {
GridParallelRNG RNG4(UGrid);
RNG4.SeedFixedIntegers(seeds4);
std::cout << GridLogMessage << "Generating random ferrmion field" << std::endl;
std::cout << GridLogMessage << "Generating random fermion field" << std::endl;
LatticeFermion src(FGrid);
random(RNG5, src);
LatticeFermion result(FGrid);
@ -96,7 +96,7 @@ int main(int argc, char** argv) {
GridStopWatch CGTimer;
SchurDiagMooeeOperator<DomainWallFermionVec5dR, LatticeFermion> HermOpEO(Ddwf);
ConjugateGradient<LatticeFermion> CG(1.0e-8, 10000, 0);// switch off the assert
ConjugateGradient<LatticeFermion> CG(1.0e-8, 10000, 0); // switch off the assert
Ddwf.ZeroCounters();
CGTimer.Start();
@ -110,4 +110,4 @@ int main(int argc, char** argv) {
Ddwf.Report();
Grid_finalize();
}
}