mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 21:50:45 +01:00
Permabulator is read back from disk if it exists instead of being created
This commit is contained in:
parent
c7aa4e0c1f
commit
008ac6b5ae
@ -234,6 +234,45 @@ void TPerambLight<FImpl>::execute(void)
|
|||||||
std::cout << GridLogMessage << "reading done." << std::endl;
|
std::cout << GridLogMessage << "reading done." << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Create Noises
|
||||||
|
//std::cout << pszGaugeConfigFile << std::endl;
|
||||||
|
//GridSerialRNG sRNG; sRNG.SeedUniqueString(std::string(pszGaugeConfigFile));
|
||||||
|
GridSerialRNG sRNG; sRNG.SeedUniqueString("unique_string"); // TODO: Proper unique string. Include quark mass, gauge field? Maybe also nvec, but in a way that more nvec would only add noises, not change all of them???
|
||||||
|
Real rn;
|
||||||
|
|
||||||
|
for (int inoise=0;inoise<nnoise;inoise++) {
|
||||||
|
for (int t=0;t<Nt;t++) {
|
||||||
|
for (int ivec=0;ivec<nvec;ivec++) {
|
||||||
|
for (int is=0;is<Ns;is++) {
|
||||||
|
if (exact_distillation)
|
||||||
|
noise[inoise + nnoise*(t + Nt*(ivec+nvec*is))] = 1.;
|
||||||
|
//noises[inoise][t][ivec]()(is)() = 1.;
|
||||||
|
else{
|
||||||
|
random(sRNG,rn);
|
||||||
|
// We could use a greater number of complex roots of unity
|
||||||
|
// ... but this seems to work well
|
||||||
|
noise[inoise + nnoise*(t + Nt*(ivec+nvec*is))] = (rn > 0.5) ? -1 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load perambulator if it exists on disk instead of creating it
|
||||||
|
const std::string &PerambFileName{par().PerambFileName};
|
||||||
|
if( PerambFileName.length() ){
|
||||||
|
bool bExists = false;
|
||||||
|
{
|
||||||
|
std::ifstream f(PerambFileName, std::ios::binary);
|
||||||
|
if( f.is_open() )
|
||||||
|
bExists = true;
|
||||||
|
}
|
||||||
|
if( bExists ) {
|
||||||
|
perambulator.ReadTemporary(PerambFileName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
envGetTmp(LatticeSpinColourVector, dist_source);
|
envGetTmp(LatticeSpinColourVector, dist_source);
|
||||||
envGetTmp(LatticeSpinColourVector, tmp2);
|
envGetTmp(LatticeSpinColourVector, tmp2);
|
||||||
envGetTmp(LatticeSpinColourVector, result);
|
envGetTmp(LatticeSpinColourVector, result);
|
||||||
@ -249,30 +288,6 @@ void TPerambLight<FImpl>::execute(void)
|
|||||||
const int Ntlocal{grid4d->LocalDimensions()[3]};
|
const int Ntlocal{grid4d->LocalDimensions()[3]};
|
||||||
const int Ntfirst{grid4d->LocalStarts()[3]};
|
const int Ntfirst{grid4d->LocalStarts()[3]};
|
||||||
|
|
||||||
//Create Noises
|
|
||||||
//std::cout << pszGaugeConfigFile << std::endl;
|
|
||||||
//GridSerialRNG sRNG; sRNG.SeedUniqueString(std::string(pszGaugeConfigFile));
|
|
||||||
GridSerialRNG sRNG; sRNG.SeedUniqueString("unique_string"); // TODO: Proper unique string. Include quark mass, gauge field? Maybe also nvec, but in a way that more nvec would only add noises, not change all of them???
|
|
||||||
Real rn;
|
|
||||||
|
|
||||||
for (int inoise=0;inoise<nnoise;inoise++) {
|
|
||||||
for (int t=0;t<Nt;t++) {
|
|
||||||
for (int ivec=0;ivec<nvec;ivec++) {
|
|
||||||
for (int is=0;is<Ns;is++) {
|
|
||||||
if (exact_distillation)
|
|
||||||
noise[inoise + nnoise*(t + Nt*(ivec+nvec*is))] = 1.;
|
|
||||||
//noises[inoise][t][ivec]()(is)() = 1.;
|
|
||||||
else{
|
|
||||||
random(sRNG,rn);
|
|
||||||
// We could use a greater number of complex roots of unity
|
|
||||||
// ... but this seems to work well
|
|
||||||
noise[inoise + nnoise*(t + Nt*(ivec+nvec*is))] = (rn > 0.5) ? -1 : 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const Real mass{Solver.mass};
|
const Real mass{Solver.mass};
|
||||||
const Real M5 {Solver.M5};
|
const Real M5 {Solver.M5};
|
||||||
std::cout << "init RBG " << std::endl;
|
std::cout << "init RBG " << std::endl;
|
||||||
@ -352,9 +367,8 @@ void TPerambLight<FImpl>::execute(void)
|
|||||||
perambulator.SliceShare( grid3d, grid4d );
|
perambulator.SliceShare( grid3d, grid4d );
|
||||||
|
|
||||||
// THIS IS WHERE WE WANT TO SAVE THE PERAMBULATORS TO DISK
|
// THIS IS WHERE WE WANT TO SAVE THE PERAMBULATORS TO DISK
|
||||||
const std::string &FileName{par().PerambFileName};
|
if(PerambFileName.length())
|
||||||
if(FileName.length())
|
perambulator.WriteTemporary(PerambFileName);
|
||||||
perambulator.WriteTemporary(FileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
END_MODULE_NAMESPACE
|
END_MODULE_NAMESPACE
|
||||||
|
@ -131,7 +131,7 @@ void test_PerambulatorsS(Application &application)
|
|||||||
// PerambLight parameters
|
// PerambLight parameters
|
||||||
MDistil::PerambLight::Par PerambPar;
|
MDistil::PerambLight::Par PerambPar;
|
||||||
PerambPar.eigenPack="LapEvec";
|
PerambPar.eigenPack="LapEvec";
|
||||||
PerambPar.PerambFileName="peramb.bin";
|
PerambPar.PerambFileName="perambS.bin";
|
||||||
PerambPar.Distil.tsrc = 0;
|
PerambPar.Distil.tsrc = 0;
|
||||||
PerambPar.Distil.nnoise = 1;
|
PerambPar.Distil.nnoise = 1;
|
||||||
PerambPar.Distil.LI=3;
|
PerambPar.Distil.LI=3;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user