1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-06-17 15:27:06 +01:00

Hadrons: environment with fully generic object store

This commit is contained in:
2016-06-06 17:45:37 +01:00
parent 1826ed06a3
commit 8e2078be71
15 changed files with 321 additions and 385 deletions

View File

@ -65,19 +65,17 @@ void ADWF::setup(void)
// execution ///////////////////////////////////////////////////////////////////
void ADWF::execute(void)
{
env().createGrid(par().Ls);
auto &U = *env().get<LatticeGaugeField>(par().gauge);
auto &g4 = *env().getGrid();
auto &grb4 = *env().getRbGrid();
auto &g5 = *env().getGrid(par().Ls);
auto &grb5 = *env().getRbGrid(par().Ls);
auto fMatPt = new DomainWallFermionR(U, g5, grb5, g4, grb4,
par().mass, par().M5);
LOG(Message) << "Setting up domain wall fermion matrix with m= "
<< par().mass << ", M5= " << par().M5 << " and Ls= "
<< par().Ls << " using gauge field '" << par().gauge << "'"
<< std::endl;
env().addFermionMatrix(getName(), fMatPt);
env().createGrid(par().Ls);
auto &U = *env().getObject<LatticeGaugeField>(par().gauge);
auto &g4 = *env().getGrid();
auto &grb4 = *env().getRbGrid();
auto &g5 = *env().getGrid(par().Ls);
auto &grb5 = *env().getRbGrid(par().Ls);
FMat *fMatPt = new DomainWallFermionR(U, g5, grb5, g4, grb4, par().mass,
par().M5);
env().setObject(getName(), fMatPt);
}

View File

@ -65,13 +65,11 @@ void AWilson::setup(void)
// execution ///////////////////////////////////////////////////////////////////
void AWilson::execute()
{
auto &U = *env().get<LatticeGaugeField>(par().gauge);
auto &grid = *env().getGrid();
auto &gridRb = *env().getRbGrid();
auto fMatPt = new WilsonFermionR(U, grid, gridRb, par().mass);
unsigned int size;
LOG(Message) << "Setting up Wilson fermion matrix with m= " << par().mass
<< " using gauge field '" << par().gauge << "'" << std::endl;
env().addFermionMatrix(getName(), fMatPt);
auto &U = *env().getObject<LatticeGaugeField>(par().gauge);
auto &grid = *env().getGrid();
auto &gridRb = *env().getRbGrid();
FMat *fMatPt = new WilsonFermionR(U, grid, gridRb, par().mass);
env().setObject(getName(), fMatPt);
}

View File

@ -62,8 +62,8 @@ void CMeson::execute(void)
<< std::endl;
XmlWriter writer(par().output);
LatticePropagator &q1 = *env().get<LatticePropagator>(par().q1);
LatticePropagator &q2 = *env().get<LatticePropagator>(par().q2);
LatticePropagator &q1 = *env().getObject<LatticePropagator>(par().q1);
LatticePropagator &q2 = *env().getObject<LatticePropagator>(par().q2);
LatticeComplex c(env().getGrid());
SpinMatrix g[Ns*Ns], g5;
std::vector<TComplex> buf;

View File

@ -68,7 +68,7 @@ void GLoad::execute(void)
LOG(Message) << "Loading NERSC configuration from file '" << fileName
<< "'" << std::endl;
LatticeGaugeField &U = *env().create<LatticeGaugeField>(getName());
LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
NerscIO::readConfiguration(U, header, fileName);
LOG(Message) << "NERSC header:" << std::endl;
dump_nersc_header(header, LOG(Message));

View File

@ -61,6 +61,6 @@ void GRandom::setup(void)
void GRandom::execute(void)
{
LOG(Message) << "Generating random gauge configuration" << std::endl;
LatticeGaugeField &U = *env().create<LatticeGaugeField>(getName());
LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
SU3::HotConfiguration(*env().get4dRng(), U);
}

View File

@ -61,6 +61,6 @@ void GUnit::setup(void)
void GUnit::execute(void)
{
LOG(Message) << "Creating unit gauge configuration" << std::endl;
LatticeGaugeField &U = *env().create<LatticeGaugeField>(getName());
LatticeGaugeField &U = *env().createLattice<LatticeGaugeField>(getName());
SU3::ColdConfiguration(*env().get4dRng(), U);
}

View File

@ -57,7 +57,7 @@ std::vector<std::string> MQuark::getOutput(void)
// setup ///////////////////////////////////////////////////////////////////////
void MQuark::setup(void)
{
Ls_ = env().getObjectLs(env().getSolverAction(par().solver));
Ls_ = env().getObjectLs(par().solver);
env().registerLattice<LatticePropagator>(getName());
if (Ls_ > 1)
{
@ -74,11 +74,12 @@ void MQuark::execute(void)
LOG(Message) << "Computing quark propagator '" << getName() << "'"
<< std::endl;
LatticePropagator &prop = *env().create<LatticePropagator>(propName);
LatticePropagator &fullSrc = *env().get<LatticePropagator>(par().source);
LatticePropagator &prop = *env().createLattice<LatticePropagator>(propName);
LatticePropagator &fullSrc = *env().getObject<LatticePropagator>(par().source);
Environment::Solver &solver = *env().getObject<Environment::Solver>(par().solver);
if (Ls_ > 1)
{
env().create<LatticePropagator>(getName());
env().createLattice<LatticePropagator>(getName());
}
LOG(Message) << "Inverting using solver '" << par().solver
@ -86,6 +87,8 @@ void MQuark::execute(void)
for (unsigned int s = 0; s < Ns; ++s)
for (unsigned int c = 0; c < Nc; ++c)
{
LOG(Message) << "Inversion for spin= " << s << ", color= " << c
<< std::endl;
// source conversion for 4D sources
if (!env().isObject5d(par().source))
{
@ -116,12 +119,12 @@ void MQuark::execute(void)
}
}
sol = zero;
env().callSolver(par().solver, sol, source);
solver(sol, source);
FermToProp(prop, sol, s, c);
// create 4D propagators from 5D one if necessary
if (Ls_ > 1)
{
LatticePropagator &p4d = *env().get<LatticePropagator>(getName());
LatticePropagator &p4d = *env().getObject<LatticePropagator>(getName());
axpby_ssp_pminus(sol, 0., sol, 1., sol, 0, 0);
axpby_ssp_pplus(sol, 0., sol, 1., sol, 0, Ls_-1);

View File

@ -57,15 +57,16 @@ std::vector<std::string> SolRBPrecCG::getOutput(void)
// setup ///////////////////////////////////////////////////////////////////////
void SolRBPrecCG::setup(void)
{
env().registerObject(getName(), 0);
auto Ls = env().getObjectLs(par().action);
env().registerObject(getName(), 0, Ls);
env().addOwnership(getName(), par().action);
env().setSolverAction(getName(), par().action);
}
// execution ///////////////////////////////////////////////////////////////////
void SolRBPrecCG::execute(void)
{
auto &mat = *(env().getFermionMatrix(par().action));
auto &mat = *(env().getObject<Environment::FMat>(par().action));
auto solver = [&mat, this](LatticeFermion &sol,
const LatticeFermion &source)
{
@ -78,5 +79,5 @@ void SolRBPrecCG::execute(void)
LOG(Message) << "setting up Schur red-black preconditioned CG for"
<< " action '" << par().action << "' with residual "
<< par().residual << std::endl;
env().addSolver(getName(), solver);
env().setObject(getName(), new Environment::Solver(solver));
}

View File

@ -67,7 +67,7 @@ void SrcPoint::execute(void)
LOG(Message) << "Creating point source at position [" << par().position
<< "]" << std::endl;
LatticePropagator &src = *env().create<LatticePropagator>(getName());
LatticePropagator &src = *env().createLattice<LatticePropagator>(getName());
id = 1.;
src = zero;
pokeSite(id, src, position);

View File

@ -77,7 +77,7 @@ void SrcZ2::execute(void)
LOG(Message) << "Generating Z_2 band for " << par().tA << " <= t <= "
<< par().tB << std::endl;
}
LatticePropagator &src = *env().create<LatticePropagator>(getName());
LatticePropagator &src = *env().createLattice<LatticePropagator>(getName());
LatticeCoordinate(t, Tp);
bernoulli(*env().get4dRng(), eta);
eta = (2.*eta - shift)*(1./::sqrt(2.));