1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-10 14:10:46 +01:00

Permabulator is read back from disk if it exists instead of being created

This commit is contained in:
Michael Marshall 2019-02-04 12:06:32 +00:00
parent c7aa4e0c1f
commit 008ac6b5ae
2 changed files with 42 additions and 28 deletions

View File

@ -234,21 +234,6 @@ void TPerambLight<FImpl>::execute(void)
std::cout << GridLogMessage << "reading done." << std::endl;
}
envGetTmp(LatticeSpinColourVector, dist_source);
envGetTmp(LatticeSpinColourVector, tmp2);
envGetTmp(LatticeSpinColourVector, result);
//envGetTmp(LatticeSpinColourVector, result_single_component);
envGetTmp(LatticeColourVector, result_nospin);
//envGetTmp(LatticeColourVector, tmp_nospin);
//envGetTmp(LatticeSpinVector, peramb_tmp);
envGetTmp(LatticeSpinColourVector, tmp3d);
envGetTmp(LatticeColourVector, tmp3d_nospin);
envGetTmp(LatticeColourVector, result_3d);
envGetTmp(LatticeColourVector, evec3d);
const int Ntlocal{grid4d->LocalDimensions()[3]};
const int Ntfirst{grid4d->LocalStarts()[3]};
//Create Noises
//std::cout << pszGaugeConfigFile << std::endl;
//GridSerialRNG sRNG; sRNG.SeedUniqueString(std::string(pszGaugeConfigFile));
@ -273,6 +258,36 @@ void TPerambLight<FImpl>::execute(void)
}
}
// 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, tmp2);
envGetTmp(LatticeSpinColourVector, result);
//envGetTmp(LatticeSpinColourVector, result_single_component);
envGetTmp(LatticeColourVector, result_nospin);
//envGetTmp(LatticeColourVector, tmp_nospin);
//envGetTmp(LatticeSpinVector, peramb_tmp);
envGetTmp(LatticeSpinColourVector, tmp3d);
envGetTmp(LatticeColourVector, tmp3d_nospin);
envGetTmp(LatticeColourVector, result_3d);
envGetTmp(LatticeColourVector, evec3d);
const int Ntlocal{grid4d->LocalDimensions()[3]};
const int Ntfirst{grid4d->LocalStarts()[3]};
const Real mass{Solver.mass};
const Real M5 {Solver.M5};
std::cout << "init RBG " << std::endl;
@ -352,9 +367,8 @@ void TPerambLight<FImpl>::execute(void)
perambulator.SliceShare( grid3d, grid4d );
// THIS IS WHERE WE WANT TO SAVE THE PERAMBULATORS TO DISK
const std::string &FileName{par().PerambFileName};
if(FileName.length())
perambulator.WriteTemporary(FileName);
if(PerambFileName.length())
perambulator.WriteTemporary(PerambFileName);
}
END_MODULE_NAMESPACE

View File

@ -131,7 +131,7 @@ void test_PerambulatorsS(Application &application)
// PerambLight parameters
MDistil::PerambLight::Par PerambPar;
PerambPar.eigenPack="LapEvec";
PerambPar.PerambFileName="peramb.bin";
PerambPar.PerambFileName="perambS.bin";
PerambPar.Distil.tsrc = 0;
PerambPar.Distil.nnoise = 1;
PerambPar.Distil.LI=3;