1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-11 03:46:55 +01:00

HMC bit repro across checkpoints. Fixed parallel RNG issue with threading.

Conclusion: c++11 distributions not thread safe and must us distinct dist as well as distinct engine
per site. Makes sense when you think of box muller. Also added a reset of dist on fill to ensure
repro across checkpoints.
This commit is contained in:
paboyle
2015-12-22 08:54:40 +00:00
parent 0abfbcc8eb
commit 08edbb5cbe
7 changed files with 210 additions and 90 deletions

View File

@ -39,7 +39,25 @@ namespace Grid{
virtual void TrajectoryComplete (int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )=0;
};
template<class GaugeField>
class PlaquetteLogger : public HmcObservable<GaugeField> {
private:
std::string Stem;
public:
PlaquetteLogger(std::string cf) {
Stem = cf;
};
void TrajectoryComplete(int traj, GaugeField &U, GridSerialRNG &sRNG, GridParallelRNG & pRNG )
{
std::string file; { std::ostringstream os; os << Stem <<"."<< traj; file = os.str(); }
std::ofstream of(file);
RealD plaq = WilsonLoops<GaugeField>::avgPlaquette(U);
of << plaq <<std::endl;
std::cout<< GridLogMessage<< "Plaquette for trajectory "<< traj << " is " << plaq <<std::endl;
}
};
// template <class GaugeField, class Integrator, class Smearer, class Boundary>
template <class GaugeField, class IntegratorType>
class HybridMonteCarlo {
@ -141,9 +159,6 @@ namespace Grid{
Ucur = Ucopy;
}
plaq = WilsonLoops<GaugeField>::avgPlaquette(Ucur);
std::cout << " Now gauge field has plaq = "<< plaq <<std::endl;
for(int obs = 0;obs<Observables.size();obs++){
Observables[obs]->TrajectoryComplete (traj+1,Ucur,sRNG,pRNG);
}

View File

@ -165,7 +165,6 @@ namespace Grid{
H += Hterm;
}
}
std::cout<<GridLogMessage << "Total action H = "<< H << "\n";
return H;
}