mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
Adding a barrier in the RNG save
This commit is contained in:
@ -37,28 +37,28 @@ using namespace Grid::QCD;
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
class HMCRunnerParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCRunnerParameters,
|
||||
double, beta,
|
||||
double, mass,
|
||||
int, MaxCGIterations,
|
||||
double, StoppingCondition,
|
||||
bool, smearedAction,
|
||||
int, SaveInterval,
|
||||
std::string, format,
|
||||
std::string, conf_prefix,
|
||||
std::string, rng_prefix,
|
||||
double, rho,
|
||||
int, SmearingLevels,
|
||||
);
|
||||
class HMCRunnerParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCRunnerParameters,
|
||||
double, beta,
|
||||
double, mass,
|
||||
int, MaxCGIterations,
|
||||
double, StoppingCondition,
|
||||
bool, smearedAction,
|
||||
int, SaveInterval,
|
||||
std::string, format,
|
||||
std::string, conf_prefix,
|
||||
std::string, rng_prefix,
|
||||
double, rho,
|
||||
int, SmearingLevels,
|
||||
);
|
||||
|
||||
HMCRunnerParameters() {}
|
||||
};
|
||||
HMCRunnerParameters() {}
|
||||
};
|
||||
|
||||
// Derive from the BinaryHmcRunner (templated for gauge fields)
|
||||
class HmcRunner : public BinaryHmcRunner {
|
||||
public:
|
||||
public:
|
||||
void BuildTheAction(int argc, char **argv)
|
||||
|
||||
{
|
||||
@ -70,7 +70,7 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
|
||||
UGrid = SpaceTimeGrid::makeFourDimGrid(GridDefaultLatt(), GridDefaultSimd(Nd,vComplex::Nsimd()),GridDefaultMpi());
|
||||
UrbGrid = SpaceTimeGrid::makeFourDimRedBlackGrid(UGrid);
|
||||
|
||||
|
||||
FGrid = SpaceTimeGrid::makeFiveDimGrid(Ls,UGrid);
|
||||
FrbGrid = SpaceTimeGrid::makeFiveDimRedBlackGrid(Ls,UGrid);
|
||||
|
||||
@ -87,12 +87,12 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
RealD scale = 2.0;
|
||||
FermionAction DenOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,mass,M5,scale);
|
||||
FermionAction NumOp(U,*FGrid,*FrbGrid,*UGrid,*UrbGrid,pv,M5,scale);
|
||||
|
||||
|
||||
double StoppingCondition = 1.0e-8;
|
||||
double MaxCGIterations = 10000;
|
||||
ConjugateGradient<FermionField> CG(StoppingCondition,MaxCGIterations);
|
||||
TwoFlavourEvenOddRatioPseudoFermionAction<ImplPolicy> Nf2(NumOp, DenOp,CG,CG);
|
||||
|
||||
|
||||
// Set smearing (true/false), default: false
|
||||
Nf2.is_smeared = true;
|
||||
|
||||
@ -115,8 +115,7 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
std::string format = std::string("IEEE64BIG");
|
||||
std::string conf_prefix = std::string("DWF_ckpoint_lat");
|
||||
std::string rng_prefix = std::string("DWF_ckpoint_rng");
|
||||
BinaryHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(
|
||||
conf_prefix, rng_prefix, SaveInterval, format);
|
||||
BinaryHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(conf_prefix, rng_prefix, SaveInterval, 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
|
||||
@ -124,8 +123,7 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
// 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"));
|
||||
PlaquetteLogger<BinaryHmcRunner::ImplPolicy> PlaqLog(std::string("Plaquette"));
|
||||
ObservablesList.push_back(&PlaqLog);
|
||||
ObservablesList.push_back(&Checkpoint);
|
||||
|
||||
@ -139,7 +137,7 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
|
||||
Run(argc, argv, Checkpoint, SmearingPolicy);
|
||||
//Run(argc, argv, Checkpoint); // no smearing
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -153,6 +151,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
HmcRunner TheHMC;
|
||||
|
||||
|
||||
// Seeds for the random number generators
|
||||
std::vector<int> SerSeed({1, 2, 3, 4, 5});
|
||||
std::vector<int> ParSeed({6, 7, 8, 9, 10});
|
||||
|
@ -37,20 +37,22 @@ using namespace Grid::QCD;
|
||||
namespace Grid {
|
||||
namespace QCD {
|
||||
|
||||
//Change here the type of reader
|
||||
typedef Grid::TextReader InputFileReader;
|
||||
|
||||
|
||||
class HMCRunnerParameters : Serializable {
|
||||
public:
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(HMCRunnerParameters,
|
||||
double, beta,
|
||||
double, mass,
|
||||
int, MaxCGIterations,
|
||||
double, StoppingCondition,
|
||||
bool, smearedAction,
|
||||
int, MDsteps,
|
||||
double, TrajectorLength,
|
||||
int, SaveInterval,
|
||||
std::string, format,
|
||||
std::string, conf_prefix,
|
||||
std::string, rng_prefix,
|
||||
double, rho,
|
||||
int, SmearingLevels,
|
||||
std::string, serial_seeds,
|
||||
std::string, parallel_seeds,
|
||||
);
|
||||
|
||||
HMCRunnerParameters() {}
|
||||
@ -59,7 +61,8 @@ class HMCRunnerParameters : Serializable {
|
||||
// Derive from the BinaryHmcRunner (templated for gauge fields)
|
||||
class HmcRunner : public BinaryHmcRunner {
|
||||
public:
|
||||
void BuildTheAction(int argc, char **argv)
|
||||
HMCRunnerParameters HMCPar;
|
||||
void BuildTheAction(int argc, char **argv)
|
||||
|
||||
{
|
||||
typedef WilsonImplR ImplPolicy;
|
||||
@ -70,7 +73,7 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
|
||||
|
||||
// Gauge action
|
||||
WilsonGaugeActionR Waction(5.6);
|
||||
WilsonGaugeActionR Waction(HMCPar.beta);
|
||||
|
||||
// Collect actions
|
||||
ActionLevel<Field> Level1(1);
|
||||
@ -78,12 +81,8 @@ class HmcRunner : public BinaryHmcRunner {
|
||||
TheAction.push_back(Level1);
|
||||
|
||||
// Add observables
|
||||
int SaveInterval = 1;
|
||||
std::string format = std::string("IEEE64BIG");
|
||||
std::string conf_prefix = std::string("ckpoint_lat");
|
||||
std::string rng_prefix = std::string("ckpoint_rng");
|
||||
BinaryHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(
|
||||
conf_prefix, rng_prefix, SaveInterval, format);
|
||||
HMCPar.conf_prefix, HMCPar.rng_prefix, HMCPar.SaveInterval, 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
|
||||
@ -110,13 +109,18 @@ int main(int argc, char **argv) {
|
||||
<< " threads" << std::endl;
|
||||
|
||||
HmcRunner TheHMC;
|
||||
InputFileReader Reader("input.wilson_gauge.params");
|
||||
read(Reader, "HMC", TheHMC.HMCPar);
|
||||
|
||||
std::cout << GridLogMessage << TheHMC.HMCPar << std::endl;
|
||||
|
||||
// Seeds for the random number generators
|
||||
std::vector<int> SerSeed({1, 2, 3, 4, 5});
|
||||
std::vector<int> ParSeed({6, 7, 8, 9, 10});
|
||||
std::vector<int> SerSeed = strToVec<int>(TheHMC.HMCPar.serial_seeds);
|
||||
std::vector<int> ParSeed = strToVec<int>(TheHMC.HMCPar.parallel_seeds);
|
||||
|
||||
TheHMC.RNGSeeds(SerSeed, ParSeed);
|
||||
|
||||
TheHMC.MDparameters.set(20, 1.0);// MDsteps, traj length
|
||||
TheHMC.MDparameters.set(TheHMC.HMCPar.MDsteps, TheHMC.HMCPar.TrajectorLength);
|
||||
|
||||
TheHMC.BuildTheAction(argc, argv);
|
||||
|
||||
|
Reference in New Issue
Block a user