mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Hadrons: 32 bit I/O directly in Lanczos module
This commit is contained in:
parent
318c64adc2
commit
74c38822ed
@ -309,6 +309,8 @@ class CoarseEigenPack: public EigenPack<FineF, FineFIo>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef CoarseF CoarseField;
|
typedef CoarseF CoarseField;
|
||||||
|
typedef CoarseFIo CoarseFieldIo;
|
||||||
|
public:
|
||||||
std::vector<CoarseF> evecCoarse;
|
std::vector<CoarseF> evecCoarse;
|
||||||
std::vector<RealD> evalCoarse;
|
std::vector<RealD> evalCoarse;
|
||||||
public:
|
public:
|
||||||
|
@ -77,6 +77,15 @@ env().template getGrid<typename latticeType::vector_type>(Ls)
|
|||||||
#define envGetGrid(...)\
|
#define envGetGrid(...)\
|
||||||
HADRONS_MACRO_REDIRECT_12(__VA_ARGS__, envGetGrid5, envGetGrid4)(__VA_ARGS__)
|
HADRONS_MACRO_REDIRECT_12(__VA_ARGS__, envGetGrid5, envGetGrid4)(__VA_ARGS__)
|
||||||
|
|
||||||
|
#define envGetCoarseGrid4(latticeType, blockSize)\
|
||||||
|
env().template getCoarseGrid<typename latticeType::vector_type>(blockSize)
|
||||||
|
|
||||||
|
#define envGetCoarseGrid5(latticeType, blockSize, Ls)\
|
||||||
|
env().template getCoarseGrid<typename latticeType::vector_type>(blockSize, Ls)
|
||||||
|
|
||||||
|
#define envGetCoarseGrid(...)\
|
||||||
|
HADRONS_MACRO_REDIRECT_23(__VA_ARGS__, envGetCoarseGrid5, envGetCoarseGrid4)(__VA_ARGS__)
|
||||||
|
|
||||||
#define envGetRbGrid4(latticeType)\
|
#define envGetRbGrid4(latticeType)\
|
||||||
env().template getRbGrid<typename latticeType::vector_type>()
|
env().template getRbGrid<typename latticeType::vector_type>()
|
||||||
|
|
||||||
|
@ -32,4 +32,6 @@ using namespace Hadrons;
|
|||||||
using namespace MIO;
|
using namespace MIO;
|
||||||
|
|
||||||
template class Grid::Hadrons::MIO::TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL,HADRONS_DEFAULT_LANCZOS_NBASIS>>;
|
template class Grid::Hadrons::MIO::TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL,HADRONS_DEFAULT_LANCZOS_NBASIS>>;
|
||||||
|
#ifdef GRID_DEFAULT_PRECISION_DOUBLE
|
||||||
|
template class Grid::Hadrons::MIO::TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL,HADRONS_DEFAULT_LANCZOS_NBASIS, FIMPLF>>;
|
||||||
|
#endif
|
||||||
|
@ -56,7 +56,11 @@ template <typename Pack>
|
|||||||
class TLoadCoarseEigenPack: public Module<LoadCoarseEigenPackPar>
|
class TLoadCoarseEigenPack: public Module<LoadCoarseEigenPackPar>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef CoarseEigenPack<typename Pack::Field, typename Pack::CoarseField> BasePack;
|
typedef typename Pack::Field Field;
|
||||||
|
typedef typename Pack::FieldIo FieldIo;
|
||||||
|
typedef typename Pack::CoarseField CoarseField;
|
||||||
|
typedef typename Pack::CoarseFieldIo CoarseFieldIo;
|
||||||
|
typedef CoarseEigenPack<Field, CoarseField, FieldIo, CoarseFieldIo> BasePack;
|
||||||
template <typename vtype>
|
template <typename vtype>
|
||||||
using iImplScalar = iScalar<iScalar<iScalar<vtype>>>;
|
using iImplScalar = iScalar<iScalar<iScalar<vtype>>>;
|
||||||
typedef iImplScalar<typename Pack::Field::vector_type> SiteComplex;
|
typedef iImplScalar<typename Pack::Field::vector_type> SiteComplex;
|
||||||
@ -74,7 +78,12 @@ public:
|
|||||||
virtual void execute(void);
|
virtual void execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_REGISTER_TMP(LoadCoarseFermionEigenPack, ARG(TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL, HADRONS_DEFAULT_LANCZOS_NBASIS>>), MIO);
|
MODULE_REGISTER_TMP(LoadCoarseFermionEigenPack,
|
||||||
|
ARG(TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL, HADRONS_DEFAULT_LANCZOS_NBASIS>>), MIO);
|
||||||
|
#ifdef GRID_DEFAULT_PRECISION_DOUBLE
|
||||||
|
MODULE_REGISTER_TMP(LoadCoarseFermionEigenPackIo32,
|
||||||
|
ARG(TLoadCoarseEigenPack<CoarseFermionEigenPack<FIMPL, HADRONS_DEFAULT_LANCZOS_NBASIS, FIMPLF>>), MIO);
|
||||||
|
#endif
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* TLoadCoarseEigenPack implementation *
|
* TLoadCoarseEigenPack implementation *
|
||||||
@ -106,18 +115,27 @@ std::vector<std::string> TLoadCoarseEigenPack<Pack>::getOutput(void)
|
|||||||
template <typename Pack>
|
template <typename Pack>
|
||||||
void TLoadCoarseEigenPack<Pack>::setup(void)
|
void TLoadCoarseEigenPack<Pack>::setup(void)
|
||||||
{
|
{
|
||||||
env().createGrid(par().Ls);
|
GridBase *gridIo = nullptr, *gridCoarseIo = nullptr;
|
||||||
env().createCoarseGrid(par().blockSize, par().Ls);
|
|
||||||
|
if (typeHash<Field>() != typeHash<FieldIo>())
|
||||||
|
{
|
||||||
|
gridIo = envGetRbGrid(FieldIo, par().Ls);
|
||||||
|
}
|
||||||
|
if (typeHash<CoarseField>() != typeHash<CoarseFieldIo>())
|
||||||
|
{
|
||||||
|
gridCoarseIo = envGetCoarseGrid(CoarseFieldIo, par().blockSize, par().Ls);
|
||||||
|
}
|
||||||
envCreateDerived(BasePack, Pack, getName(), par().Ls, par().sizeFine,
|
envCreateDerived(BasePack, Pack, getName(), par().Ls, par().sizeFine,
|
||||||
par().sizeCoarse, env().getRbGrid(par().Ls),
|
par().sizeCoarse, envGetRbGrid(Field, par().Ls),
|
||||||
env().getCoarseGrid(par().blockSize, par().Ls));
|
envGetCoarseGrid(CoarseField, par().blockSize, par().Ls),
|
||||||
|
gridIo, gridCoarseIo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// execution ///////////////////////////////////////////////////////////////////
|
// execution ///////////////////////////////////////////////////////////////////
|
||||||
template <typename Pack>
|
template <typename Pack>
|
||||||
void TLoadCoarseEigenPack<Pack>::execute(void)
|
void TLoadCoarseEigenPack<Pack>::execute(void)
|
||||||
{
|
{
|
||||||
auto cg = env().getCoarseGrid(par().blockSize, par().Ls);
|
auto cg = envGetCoarseGrid(CoarseField, par().blockSize, par().Ls);
|
||||||
auto &epack = envGetDerived(BasePack, Pack, getName());
|
auto &epack = envGetDerived(BasePack, Pack, getName());
|
||||||
Lattice<SiteComplex> dummy(cg);
|
Lattice<SiteComplex> dummy(cg);
|
||||||
|
|
||||||
|
@ -65,6 +65,10 @@ public:
|
|||||||
nBasis> LCL;
|
nBasis> LCL;
|
||||||
typedef BaseFermionEigenPack<FImpl> BasePack;
|
typedef BaseFermionEigenPack<FImpl> BasePack;
|
||||||
typedef CoarseFermionEigenPack<FImpl, nBasis, FImplIo> CoarsePack;
|
typedef CoarseFermionEigenPack<FImpl, nBasis, FImplIo> CoarsePack;
|
||||||
|
typedef typename CoarsePack::Field Field;
|
||||||
|
typedef typename CoarsePack::FieldIo FieldIo;
|
||||||
|
typedef typename CoarsePack::CoarseField CoarseField;
|
||||||
|
typedef typename CoarsePack::CoarseFieldIo CoarseFieldIo;
|
||||||
typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
|
typedef HADRONS_DEFAULT_SCHUR_OP<FMat, FermionField> SchurFMat;
|
||||||
public:
|
public:
|
||||||
// constructor
|
// constructor
|
||||||
@ -123,21 +127,30 @@ void TLocalCoherenceLanczos<FImpl, nBasis, FImplIo>::setup(void)
|
|||||||
|
|
||||||
unsigned int Ls = env().getObjectLs(par().action);
|
unsigned int Ls = env().getObjectLs(par().action);
|
||||||
auto blockSize = strToVec<int>(par().blockSize);
|
auto blockSize = strToVec<int>(par().blockSize);
|
||||||
|
GridBase *gridIo = nullptr, *gridCoarseIo = nullptr;
|
||||||
|
|
||||||
env().createCoarseGrid(blockSize, Ls);
|
if (typeHash<Field>() != typeHash<FieldIo>())
|
||||||
|
{
|
||||||
|
gridIo = envGetRbGrid(FieldIo, Ls);
|
||||||
|
}
|
||||||
|
if (typeHash<CoarseField>() != typeHash<CoarseFieldIo>())
|
||||||
|
{
|
||||||
|
gridCoarseIo = envGetCoarseGrid(CoarseFieldIo, blockSize, Ls);
|
||||||
|
}
|
||||||
|
|
||||||
auto cg = env().getCoarseGrid(blockSize, Ls);
|
auto cg = envGetCoarseGrid(CoarseField, blockSize, Ls);
|
||||||
int cNm = (par().doCoarse) ? par().coarseParams.Nm : 0;
|
int cNm = (par().doCoarse) ? par().coarseParams.Nm : 0;
|
||||||
|
|
||||||
LOG(Message) << "Coarse grid: " << cg->GlobalDimensions() << std::endl;
|
LOG(Message) << "Coarse grid: " << cg->GlobalDimensions() << std::endl;
|
||||||
envCreateDerived(BasePack, CoarsePack, getName(), Ls,
|
envCreateDerived(BasePack, CoarsePack, getName(), Ls,
|
||||||
par().fineParams.Nm, cNm, env().getRbGrid(Ls), cg);
|
par().fineParams.Nm, cNm, envGetRbGrid(Field, Ls), cg,
|
||||||
|
gridIo, gridCoarseIo);
|
||||||
|
|
||||||
auto &epack = envGetDerived(BasePack, CoarsePack, getName());
|
auto &epack = envGetDerived(BasePack, CoarsePack, getName());
|
||||||
|
|
||||||
envTmp(SchurFMat, "mat", Ls, envGet(FMat, par().action));
|
envTmp(SchurFMat, "mat", Ls, envGet(FMat, par().action));
|
||||||
envGetTmp(SchurFMat, mat);
|
envGetTmp(SchurFMat, mat);
|
||||||
envTmp(LCL, "solver", Ls, env().getRbGrid(Ls), cg, mat,
|
envTmp(LCL, "solver", Ls, envGetRbGrid(Field, Ls), cg, mat,
|
||||||
Odd, epack.evec, epack.evecCoarse, epack.eval, epack.evalCoarse);
|
Odd, epack.evec, epack.evecCoarse, epack.eval, epack.evalCoarse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user