1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

envCreate problem..

This commit is contained in:
ferben 2019-11-12 12:23:34 +00:00
parent b8f0878981
commit db952993fa
8 changed files with 128 additions and 84 deletions

View File

@ -18,6 +18,7 @@ class DistilParPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(DistilParPar,
int, nvec,
int, nnoise,
int, tsrc,
int, TI,
@ -74,7 +75,7 @@ std::vector<std::string> TDistilPar<FImpl>::getOutput(void)
template <typename FImpl>
void TDistilPar<FImpl>::setup(void)
{
// envCreate(Hadrons::MDistil::DistilParameters, getName(), 1); //DOES NOT WORK
}
// execution ///////////////////////////////////////////////////////////////////
@ -82,11 +83,12 @@ template <typename FImpl>
void TDistilPar<FImpl>::execute(void)
{
Hadrons::MDistil::DistilParameters &out = envGet(Hadrons::MDistil::DistilParameters, getName());
/* out.nvec=par().nvec;
out.nnoise=par().nnoise;
out.tsrc=par().tsrc;
out.TI=par().TI;
out.LI=par().LI;
out.SI=par().SI;
out.SI=par().SI; */
}
END_MODULE_NAMESPACE

View File

@ -49,7 +49,7 @@ public:
std::string, lapevec,
std::string, rho,
std::string, phi,
MDistil::DistilParameters, DistilPar);
std::string, DistilPar);
};
template <typename FImpl>
@ -78,6 +78,7 @@ public:
std::string PerambulatorName;
std::string NoiseVectorName;
std::string LapEvecName;
std::string DParName;
bool bMakeRho;
bool bMakePhi;
std::string RhoName;
@ -108,7 +109,8 @@ std::vector<std::string> TDistilVectors<FImpl>::getInput(void)
PerambulatorName = par().perambulator;
NoiseVectorName = par().noise;
LapEvecName = par().lapevec;
return { PerambulatorName, NoiseVectorName, LapEvecName };
DParName = par().DistilPar;
return { PerambulatorName, NoiseVectorName, LapEvecName, DParName };
}
template <typename FImpl>
@ -142,16 +144,17 @@ void TDistilVectors<FImpl>::setup(void)
Cleanup();
auto &noise = envGet(NoiseTensor, NoiseVectorName);
auto &perambulator = envGet(PerambTensor, PerambulatorName);
auto &DPar = envGet(MDistil::DistilParameters, DParName);
// We expect the perambulator to have been created with these indices
assert( perambulator.ValidateIndexNames() && "Perambulator index names bad" );
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };
@ -195,6 +198,7 @@ void TDistilVectors<FImpl>::execute(void)
auto &noise = envGet(NoiseTensor, NoiseVectorName);
auto &perambulator = envGet(PerambTensor, PerambulatorName);
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, LapEvecName);
auto &DPar = envGet(MDistil::DistilParameters, DParName);
envGetTmp(LatticeSpinColourVector, source4d);
envGetTmp(LatticeSpinColourVector, source3d);
@ -206,12 +210,12 @@ void TDistilVectors<FImpl>::execute(void)
const int Ntfirst{ grid4d->LocalStarts()[3] };
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int tsrc{par().DistilPar.tsrc};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int tsrc{DPar.tsrc};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };

View File

@ -43,7 +43,7 @@ class NoisesPar: Serializable
{
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(NoisesPar,
MDistil::DistilParameters, DistilPar,
std::string, DistilPar,
std::string, NoiseFileName)
};
@ -62,6 +62,8 @@ public:
virtual void setup(void);
// execution
virtual void execute(void);
protected:
std::string DParName;
};
MODULE_REGISTER_TMP(Noises, TNoises<FIMPL>, MDistil);
@ -79,7 +81,8 @@ TNoises<FImpl>::TNoises(const std::string name)
template <typename FImpl>
std::vector<std::string> TNoises<FImpl>::getInput(void)
{
return {};
DParName = par().DistilPar;
return { DParName };
}
template <typename FImpl>
@ -93,9 +96,10 @@ std::vector<std::string> TNoises<FImpl>::getOutput(void)
template <typename FImpl>
void TNoises<FImpl>::setup(void)
{
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
envCreate(NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns);
}
@ -103,11 +107,12 @@ void TNoises<FImpl>::setup(void)
template <typename FImpl>
void TNoises<FImpl>::execute(void)
{
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nnoise{par().DistilPar.nnoise};
const int nvec{par().DistilPar.nvec};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int nnoise{DPar.nnoise};
const int nvec{DPar.nvec};
const int TI{DPar.TI};
const int LI{DPar.LI};
const bool full_tdil{ TI == Nt };
const bool exact_distillation{ full_tdil && LI == nvec };

View File

@ -53,7 +53,7 @@ public:
std::string, solve,
std::string, nvec_reduced,
std::string, LI_reduced,
MDistil::DistilParameters, DistilPar);
std::string, DistilPar);
};
template <typename FImpl>
@ -75,6 +75,8 @@ public:
protected:
GridCartesian * grid3d; // Owned by me, so I must delete it
GridCartesian * grid4d;
//other members
std::string DParName;
protected:
virtual void Cleanup(void);
@ -101,7 +103,9 @@ TPerambFromSolve<FImpl>::~TPerambFromSolve(void)
template <typename FImpl>
std::vector<std::string> TPerambFromSolve<FImpl>::getInput(void)
{
return std::vector<std::string>{ par().solve, par().eigenPack };
//return std::vector<std::string>{ par().solve, par().eigenPack };
DParName = par().DistilPar;
return {par().solve, par().eigenPack, DParName };
}
template <typename FImpl>
@ -115,12 +119,13 @@ template <typename FImpl>
void TPerambFromSolve<FImpl>::setup(void)
{
Cleanup();
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int LI{par().DistilPar.LI};
const int TI{par().DistilPar.TI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int LI{DPar.LI};
const int TI{DPar.TI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };
const int nvec_reduced{ par().nvec_reduced.empty() ? nvec:std::stoi(par().nvec_reduced)};
@ -152,12 +157,13 @@ void TPerambFromSolve<FImpl>::execute(void)
GridCartesian * grid4d = env().getGrid();
const int Ntlocal{grid4d->LocalDimensions()[3]};
const int Ntfirst{grid4d->LocalStarts()[3]};
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };
const int nvec_reduced{ par().nvec_reduced.empty() ? nvec:std::stoi(par().nvec_reduced)};

View File

@ -49,7 +49,7 @@ public:
std::string, PerambFileName,
std::string, UnsmearedSinkFileName,
std::string, UnsmearedSinkMultiFile,
MDistil::DistilParameters, DistilPar);
std::string, DistilPar);
};
template <typename FImpl>
@ -79,6 +79,7 @@ protected:
unsigned int Ls_;
std::string sLapEvecName;
std::string sNoiseName;
std::string DParName;
};
MODULE_REGISTER_TMP(Perambulator, TPerambulator<FIMPL>, MDistil);
@ -105,7 +106,8 @@ std::vector<std::string> TPerambulator<FImpl>::getInput(void)
{
sLapEvecName = par().lapevec;
sNoiseName = par().noise;
return {sLapEvecName, par().solver, sNoiseName };
DParName = par().DistilPar;
return {sLapEvecName, par().solver, sNoiseName, DParName };
}
template <typename FImpl>
@ -121,13 +123,14 @@ void TPerambulator<FImpl>::setup(void)
Cleanup();
grid4d = env().getGrid();
grid3d = MakeLowerDimGrid(grid4d);
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int tsrc{par().DistilPar.tsrc};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int tsrc{DPar.tsrc};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };
const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName };
@ -170,13 +173,14 @@ void TPerambulator<FImpl>::Cleanup(void)
template <typename FImpl>
void TPerambulator<FImpl>::execute(void)
{
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int tsrc{par().DistilPar.tsrc};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int tsrc{DPar.tsrc};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const int Nt_inv{ full_tdil ? 1 : TI };

View File

@ -44,7 +44,7 @@ class LoadDistilNoisePar: Serializable
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(LoadDistilNoisePar,
std::string, NoiseFileName,
MDistil::DistilParameters, DistilPar);
std::string, DistilPar);
};
template <typename FImpl>
@ -62,6 +62,8 @@ public:
virtual void setup(void);
// execution
virtual void execute(void);
protected:
std::string DParName;
};
MODULE_REGISTER_TMP(LoadDistilNoise, TLoadDistilNoise<FIMPL>, MIO);
@ -79,9 +81,9 @@ TLoadDistilNoise<FImpl>::TLoadDistilNoise(const std::string name)
template <typename FImpl>
std::vector<std::string> TLoadDistilNoise<FImpl>::getInput(void)
{
std::vector<std::string> in;
DParName = par().DistilPar;
return { par().NoiseFileName, DParName };
return in;
}
template <typename FImpl>
@ -96,9 +98,10 @@ std::vector<std::string> TLoadDistilNoise<FImpl>::getOutput(void)
template <typename FImpl>
void TLoadDistilNoise<FImpl>::setup(void)
{
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
envCreate(MDistil::NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns);
}

View File

@ -44,7 +44,7 @@ class LoadPerambulatorPar: Serializable
public:
GRID_SERIALIZABLE_CLASS_MEMBERS(LoadPerambulatorPar,
std::string, PerambFileName,
MDistil::DistilParameters, DistilPar);
std::string, DistilPar);
};
template <typename FImpl>
@ -62,6 +62,8 @@ public:
virtual void setup(void);
// execution
virtual void execute(void);
protected:
std::string DParName;
};
MODULE_REGISTER_TMP(LoadPerambulator, TLoadPerambulator<FIMPL>, MIO);
@ -79,9 +81,8 @@ TLoadPerambulator<FImpl>::TLoadPerambulator(const std::string name)
template <typename FImpl>
std::vector<std::string> TLoadPerambulator<FImpl>::getInput(void)
{
std::vector<std::string> in;
return in;
DParName = par().DistilPar;
return { par().PerambFileName, DParName };
}
template <typename FImpl>
@ -96,13 +97,14 @@ std::vector<std::string> TLoadPerambulator<FImpl>::getOutput(void)
template <typename FImpl>
void TLoadPerambulator<FImpl>::setup(void)
{
auto &DPar = envGet(MDistil::DistilParameters, DParName);
const int Nt{env().getDim(Tdir)};
const int nvec{par().DistilPar.nvec};
const int nnoise{par().DistilPar.nnoise};
const int tsrc{par().DistilPar.tsrc};
const int TI{par().DistilPar.TI};
const int LI{par().DistilPar.LI};
const int SI{par().DistilPar.SI};
const int nvec{DPar.nvec};
const int nnoise{DPar.nnoise};
const int tsrc{DPar.tsrc};
const int TI{DPar.TI};
const int LI{DPar.LI};
const int SI{DPar.SI};
const bool full_tdil{ TI == Nt };
const bool exact_distillation{ full_tdil && LI == nvec };
const int Nt_inv{ full_tdil ? 1 : TI };

View File

@ -58,6 +58,10 @@ void test_Global(Application &application)
globalPar.trajCounter.end = 1120;
globalPar.trajCounter.step = 20;
globalPar.runId = "test";
globalPar.graphFile = "";
globalPar.scheduleFile = "";
globalPar.saveSchedule = "false";
globalPar.parallelWriteMaxRetry = -1;
application.setPar(globalPar);
}
@ -65,10 +69,9 @@ void test_Global(Application &application)
// Create a random gauge with the correct name
/////////////////////////////////////////////////////////////
std::string test_Gauge(Application &application, const char * pszBaseName )
std::string test_Gauge(Application &application )
{
std::string sGaugeName{ pszBaseName };
sGaugeName.append( "_gauge" );
std::string sGaugeName{ "gauge" };
application.createModule<MGauge::Random>( sGaugeName );
return sGaugeName;
}
@ -80,8 +83,9 @@ std::string test_Gauge(Application &application, const char * pszBaseName )
void test_LapEvec(Application &application)
{
const char szModuleName[] = "LapEvec";
test_Gauge( application, szModuleName );
test_Gauge( application );
MDistil::LapEvecPar p;
p.gauge = "gauge";
p.Stout.steps = 3;
p.Stout.rho = 0.2;
p.Cheby.PolyOrder = 11;
@ -117,7 +121,7 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr
sActionName.append( pSuffix );
}
MAction::DWF::Par actionPar;
actionPar.gauge = "LapEvec_gauge";
actionPar.gauge = "gauge";
actionPar.Ls = 16;
actionPar.M5 = 1.8;
actionPar.mass = 0.005;
@ -133,6 +137,23 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr
return sSolverName;
}
/////////////////////////////////////////////////////////////
// DistilParameters
/////////////////////////////////////////////////////////////
std::string test_DPar(Application &application) {
// DistilVectors parameters
MDistil::DistilParPar DistilPar;
DistilPar.nvec = 5;
DistilPar.nnoise = 1;
DistilPar.tsrc = 0;
DistilPar.LI = 5;
DistilPar.TI = 8;
DistilPar.SI = 4;
std::string sDParName{"DPar_l"};
application.createModule<MDistil::DistilPar>(sDParName,DistilPar);
return sDParName;
}
/////////////////////////////////////////////////////////////
// Noises
/////////////////////////////////////////////////////////////
@ -140,8 +161,7 @@ std::string test_Solver(Application &application, const char * pSuffix = nullptr
std::string test_Noises(Application &application, const std::string &sNoiseBaseName ) {
// DistilVectors parameters
MDistil::NoisesPar NoisePar;
NoisePar.nnoise = 1;
NoisePar.nvec = 5;
NoisePar.DistilPar = "DPar_l";
std::string sNoiseName{sNoiseBaseName + "_noise"};
application.createModule<MDistil::Noises>(sNoiseName,NoisePar);
return sNoiseName;
@ -164,9 +184,7 @@ void test_LoadPerambulators( Application &application, const char * pszSuffix =
std::string sModuleName{ PerambulatorName( pszSuffix ) };
MIO::LoadPerambulator::Par PerambPar;
PerambPar.PerambFileName = sModuleName;
PerambPar.Distil.tsrc = 0;
PerambPar.Distil.nnoise = 1;
PerambPar.nvec = 5;
PerambPar.DistilPar = "DPar_l";
test_Noises(application, sModuleName); // I want these written after solver stuff
application.createModule<MIO::LoadPerambulator>( sModuleName, PerambPar );
}
@ -179,9 +197,7 @@ void test_Perambulators( Application &application, const char * pszSuffix = null
PerambPar.lapevec = "LapEvec";
PerambPar.PerambFileName = sModuleName;
PerambPar.solver = test_Solver( application, pszSuffix );
PerambPar.Distil.tsrc = 0;
PerambPar.Distil.nnoise = 1;
PerambPar.nvec = 5;
PerambPar.DistilPar = "DPar_l";
test_Noises(application, sModuleName); // I want these written after solver stuff
application.createModule<MDistil::Perambulator>( sModuleName, PerambPar );
}
@ -202,9 +218,7 @@ void test_DistilVectors(Application &application, const char * pszSuffix = nullp
DistilVecPar.noise = sPerambName + "_noise";
DistilVecPar.perambulator = sPerambName;
DistilVecPar.lapevec = "LapEvec";
DistilVecPar.tsrc = 0;
if( pszNvec )
DistilVecPar.nvec = pszNvec;
DistilVecPar.DistilPar = "DPar_l";
application.createModule<MDistil::DistilVectors>(sModuleName,DistilVecPar);
}
@ -331,15 +345,17 @@ int main(int argc, char *argv[])
LOG(Message) << "Computing Meson 2pt-function" << std::endl;
test_Global( application );
test_LapEvec( application );
test_Perambulators( application );
test_DistilVectors( application );
test_MesonField( application, "Phi", "_phi" );
test_MesonField( application, "Rho", "_rho" );
test_DPar( application );
//test_Perambulators( application );
//test_DistilVectors( application );
//test_MesonField( application, "Phi", "_phi" );
//test_MesonField( application, "Rho", "_rho" );
break;
case 1:
LOG(Message) << "Computing Meson 2pt-function by loading perambulators" << std::endl;
test_Global( application );
test_LapEvec( application );
test_DPar( application );
test_LoadPerambulators( application );
test_DistilVectors( application );
test_MesonField( application, "Phi", "_phi" );
@ -349,6 +365,7 @@ int main(int argc, char *argv[])
LOG(Message) << "Computing Meson 2pt-function for two quark flavours" << std::endl;
test_Global( application );
test_LapEvec( application );
test_DPar( application );
test_Perambulators( application );
test_DistilVectors( application );
test_Perambulators( application, "S" );
@ -360,6 +377,7 @@ int main(int argc, char *argv[])
LOG(Message) << "Computing Meson 2pt-function with current insertion" << std::endl;
test_Global( application );
test_LapEvec( application );
test_DPar( application );
test_Perambulators( application );
test_MesonSink( application );
break;