mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-13 04:37:05 +01:00
WIP
This commit is contained in:
@ -47,9 +47,7 @@
|
||||
/******************************************************************************
|
||||
A consistent set of cross-platform methods for big endian <-> host byte ordering
|
||||
I imagine this exists already?
|
||||
|
||||
RELEASE NOTE:
|
||||
|
||||
This can be removed once the (deprecated) NamedTensor::ReadBinary & WriteBinary methods are deleted
|
||||
******************************************************************************/
|
||||
|
||||
#if defined(__linux__)
|
||||
@ -81,7 +79,6 @@
|
||||
|
||||
/******************************************************************************
|
||||
This potentially belongs in CartesianCommunicator
|
||||
Turns out I don't actually need this when running inside hadrons
|
||||
******************************************************************************/
|
||||
|
||||
BEGIN_MODULE_NAMESPACE(Grid)
|
||||
@ -138,15 +135,13 @@ inline void SliceShare( GridBase * gridLowDim, GridBase * gridHighDim, void * Bu
|
||||
}
|
||||
|
||||
/*************************************************************************************
|
||||
|
||||
Not sure where the right home for this is? But presumably in Grid
|
||||
|
||||
-Grad^2 (Peardon, 2009, pg 2, equation 3)
|
||||
-Grad^2 (Peardon, 2009, pg 2, equation 3, https://arxiv.org/abs/0905.2160)
|
||||
Field Type of field the operator will be applied to
|
||||
GaugeField Gauge field the operator will smear using
|
||||
|
||||
TODO CANDIDATE for integration into laplacian operator
|
||||
should just require adding number of dimensions to act on to constructor,
|
||||
where the default=all dimensions, but we could specify 3 spatial dimensions
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
template<typename Field, typename GaugeField=LatticeGaugeField>
|
||||
@ -202,15 +197,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class BFieldIO: Serializable{
|
||||
public:
|
||||
using BaryonTensorSet = Eigen::Tensor<Complex, 7>;
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(BFieldIO,
|
||||
BaryonTensorSet, BField
|
||||
);
|
||||
};
|
||||
|
||||
END_MODULE_NAMESPACE // Grid
|
||||
|
||||
/******************************************************************************
|
||||
@ -221,29 +207,33 @@ BEGIN_HADRONS_NAMESPACE
|
||||
|
||||
BEGIN_MODULE_NAMESPACE(MDistil)
|
||||
|
||||
typedef Grid::Hadrons::EigenPack<LatticeColourVector> DistilEP;
|
||||
typedef std::vector<std::vector<std::vector<SpinVector> > > DistilNoises;
|
||||
using DistilEP = Grid::Hadrons::EigenPack<LatticeColourVector>;
|
||||
|
||||
// Noise vector index order: nnoise, nt, nvec, ns
|
||||
using NoiseTensor = Eigen::Tensor<Complex, 4, Eigen::RowMajor>;
|
||||
|
||||
struct DistilParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(DistilParameters,
|
||||
int, TI,
|
||||
int, LI,
|
||||
int, nnoise,
|
||||
int, tsrc,
|
||||
int, SI,
|
||||
int, Ns,
|
||||
int, Nt_inv)
|
||||
DistilParameters() = default;
|
||||
template <class ReaderClass> DistilParameters(Reader<ReaderClass>& Reader){read(Reader,"Distil",*this);}
|
||||
};
|
||||
|
||||
class BFieldIO: Serializable{
|
||||
public:
|
||||
using BaryonTensorSet = Eigen::Tensor<Complex, 7>;
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(BFieldIO, BaryonTensorSet, BField );
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
Make a lower dimensional grid
|
||||
******************************************************************************/
|
||||
|
||||
inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD )
|
||||
{
|
||||
//LOG(Message) << "MakeLowerDimGrid() begin" << std::endl;
|
||||
int nd{static_cast<int>(gridHD->_ndimension)};
|
||||
std::vector<int> latt_size = gridHD->_gdimensions;
|
||||
latt_size[nd-1] = 1;
|
||||
|
||||
std::vector<int> simd_layout = GridDefaultSimd(nd-1, vComplex::Nsimd());
|
||||
simd_layout.push_back( 1 );
|
||||
|
||||
std::vector<int> mpi_layout = gridHD->_processors;
|
||||
mpi_layout[nd-1] = 1;
|
||||
GridCartesian * gridLD = new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD);
|
||||
//LOG(Message) << "MakeLowerDimGrid() end" << std::endl;
|
||||
return gridLD;
|
||||
}
|
||||
Default for distillation file operations. For now only used by NamedTensor
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef HAVE_HDF5
|
||||
using Default_Reader = Grid::Hdf5Reader;
|
||||
@ -348,6 +338,14 @@ template<typename T, typename V = void> struct is_named_tensor : public std::fal
|
||||
template<typename Scalar_, int NumIndices_, uint16_t Endian_Scalar_Size_> struct is_named_tensor<NamedTensor<Scalar_, NumIndices_, Endian_Scalar_Size_>> : public std::true_type {};
|
||||
template<typename T> struct is_named_tensor<T, typename std::enable_if<std::is_base_of<NamedTensor<typename T::Scalar, T::NumIndices, T::Endian_Scalar_Size_>, T>::value>::type> : public std::true_type {};
|
||||
|
||||
/******************************************************************************
|
||||
Perambulator object
|
||||
Endian_Scalar_Size can be removed once (deprecated) NamedTensor::ReadBinary & WriteBinary methods deleted
|
||||
******************************************************************************/
|
||||
|
||||
template<typename Scalar_, int NumIndices_, uint16_t Endian_Scalar_Size = sizeof(Scalar_)>
|
||||
using Perambulator = NamedTensor<Scalar_, NumIndices_, Endian_Scalar_Size>;
|
||||
|
||||
/******************************************************************************
|
||||
Save NamedTensor binary format (NB: On-disk format is Big Endian)
|
||||
Assumes the Scalar_ objects are contiguous (no padding)
|
||||
@ -586,31 +584,25 @@ void NamedTensor<Scalar_, NumIndices_, Endian_Scalar_Size>::read(const char * fi
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
Perambulator object
|
||||
Make a lower dimensional grid in preparation for local slice operations
|
||||
******************************************************************************/
|
||||
|
||||
template<typename Scalar_, int NumIndices_, uint16_t Endian_Scalar_Size = sizeof(Scalar_)>
|
||||
using Perambulator = NamedTensor<Scalar_, NumIndices_, Endian_Scalar_Size>;
|
||||
|
||||
struct DistilParameters: Serializable {
|
||||
GRID_SERIALIZABLE_CLASS_MEMBERS(DistilParameters,
|
||||
int, TI,
|
||||
int, LI,
|
||||
int, nnoise,
|
||||
int, tsrc,
|
||||
int, SI,
|
||||
int, Ns,
|
||||
int, Nt,
|
||||
int, Nt_inv)
|
||||
DistilParameters() = default;
|
||||
template <class ReaderClass> DistilParameters(Reader<ReaderClass>& Reader){read(Reader,"Distil",*this);}
|
||||
};
|
||||
inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD )
|
||||
{
|
||||
int nd{static_cast<int>(gridHD->_ndimension)};
|
||||
std::vector<int> latt_size = gridHD->_gdimensions;
|
||||
latt_size[nd-1] = 1;
|
||||
std::vector<int> simd_layout = GridDefaultSimd(nd-1, vComplex::Nsimd());
|
||||
simd_layout.push_back( 1 );
|
||||
std::vector<int> mpi_layout = gridHD->_processors;
|
||||
mpi_layout[nd-1] = 1;
|
||||
GridCartesian * gridLD = new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD);
|
||||
return gridLD;
|
||||
}
|
||||
|
||||
/*************************************************************************************
|
||||
|
||||
Rotate eigenvectors into our phase convention
|
||||
First component of first eigenvector is real and positive
|
||||
|
||||
*************************************************************************************/
|
||||
|
||||
inline void RotateEigen(std::vector<LatticeColourVector> & evec)
|
||||
@ -642,7 +634,5 @@ inline void RotateEigen(std::vector<LatticeColourVector> & evec)
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
#endif // Hadrons_MDistil_Distil_hpp_
|
||||
|
@ -60,13 +60,11 @@ public:
|
||||
std::string, sink,
|
||||
bool, multiFile,
|
||||
int, tsrc,
|
||||
//int, nnoise,
|
||||
int, LI,
|
||||
int, SI,
|
||||
int, TI,
|
||||
int, nvec,
|
||||
int, Ns,
|
||||
int, Nt,
|
||||
int, Nt_inv);
|
||||
};
|
||||
|
||||
@ -172,7 +170,7 @@ template <typename FImpl>
|
||||
void TDistilVectors<FImpl>::setup(void)
|
||||
{
|
||||
Cleanup();
|
||||
auto &noise = envGet(std::vector<Complex>, NoiseVectorName);
|
||||
auto &noise = envGet(NoiseTensor, NoiseVectorName);
|
||||
auto &perambulator = envGet(DistilPeramb, PerambulatorName);
|
||||
|
||||
// We expect the perambulator to have been created with these indices
|
||||
@ -180,7 +178,8 @@ void TDistilVectors<FImpl>::setup(void)
|
||||
for(int i = 0; i < DistilPeramb::NumIndices; i++ )
|
||||
assert( sIndexNames[i] == perambulator.IndexNames[i] && "Perambulator indices bad" );
|
||||
|
||||
nnoise = static_cast<int>( noise.size() );
|
||||
nnoise = static_cast<int>( noise.dimension(0) );
|
||||
LOG(Message) << "NoiseTensor has " << nnoise << " noise vectors" << std::endl;
|
||||
int LI=par().LI;
|
||||
int Ns=par().Ns;
|
||||
int SI=par().SI;
|
||||
@ -225,7 +224,7 @@ void TDistilVectors<FImpl>::Cleanup(void)
|
||||
template <typename FImpl>
|
||||
void TDistilVectors<FImpl>::execute(void)
|
||||
{
|
||||
auto &noise = envGet(std::vector<Complex>, NoiseVectorName);
|
||||
auto &noise = envGet(NoiseTensor, NoiseVectorName);
|
||||
auto &perambulator = envGet(DistilPeramb, PerambulatorName);
|
||||
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, LapEvecName);
|
||||
|
||||
@ -244,7 +243,7 @@ void TDistilVectors<FImpl>::execute(void)
|
||||
int LI=par().LI;
|
||||
int Ns=par().Ns;
|
||||
int Nt_inv=par().Nt_inv; // TODO: No input, but define through Nt, TI
|
||||
int Nt=par().Nt;
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
int TI=par().TI;
|
||||
int nvec=par().nvec;
|
||||
int SI=par().SI;
|
||||
@ -255,10 +254,10 @@ void TDistilVectors<FImpl>::execute(void)
|
||||
int t_inv;
|
||||
if( bMakeSource ) {
|
||||
auto &rho = envGet(std::vector<FermionField>, SourceName);
|
||||
for (int inoise = 0; inoise < nnoise; inoise++) {
|
||||
for (int dk = 0; dk < LI; dk++) {
|
||||
for (int dt = 0; dt < Nt_inv; dt++) {
|
||||
for (int ds = 0; ds < SI; ds++) {
|
||||
for( int inoise = 0; inoise < nnoise; inoise++ ) {
|
||||
for( int dk = 0; dk < LI; dk++ ) {
|
||||
for( int dt = 0; dt < Nt_inv; dt++ ) {
|
||||
for( int ds = 0; ds < SI; ds++ ) {
|
||||
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
|
||||
rho[vecindex] = zero;
|
||||
tmp3d_nospin = zero;
|
||||
@ -268,7 +267,8 @@ void TDistilVectors<FImpl>::execute(void)
|
||||
for (int ik = dk; ik < nvec; ik += LI){
|
||||
for (int is = ds; is < Ns; is += SI){
|
||||
ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv,3);
|
||||
tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
|
||||
//tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
|
||||
tmp3d_nospin = evec3d * noise(inoise, t_inv, ik, is);
|
||||
tmp3d=zero;
|
||||
pokeSpin(tmp3d,tmp3d_nospin,is);
|
||||
tmp2=zero;
|
||||
@ -285,10 +285,10 @@ void TDistilVectors<FImpl>::execute(void)
|
||||
}
|
||||
if( bMakeSink ) {
|
||||
auto &phi = envGet(std::vector<FermionField>, SinkName);
|
||||
for (int inoise = 0; inoise < nnoise; inoise++) {
|
||||
for (int dk = 0; dk < LI; dk++) {
|
||||
for (int dt = 0; dt < Nt_inv; dt++) {
|
||||
for (int ds = 0; ds < SI; ds++) {
|
||||
for( int inoise = 0; inoise < nnoise; inoise++ ) {
|
||||
for( int dk = 0; dk < LI; dk++ ) {
|
||||
for( int dt = 0; dt < Nt_inv; dt++ ) {
|
||||
for( int ds = 0; ds < SI; ds++ ) {
|
||||
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
|
||||
phi[vecindex] = zero;
|
||||
for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) {
|
||||
@ -307,7 +307,5 @@ void TDistilVectors<FImpl>::execute(void)
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
#endif // Hadrons_MDistil_DistilVectors_hpp_
|
||||
|
@ -106,54 +106,53 @@ std::vector<std::string> TNoises<FImpl>::getOutput(void)
|
||||
template <typename FImpl>
|
||||
void TNoises<FImpl>::setup(void)
|
||||
{
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int nvec{par().nvec};
|
||||
|
||||
envCreate(std::vector<Complex>, getName(), 1, nvec*Distil.Ns*Distil.Nt*Distil.nnoise);
|
||||
|
||||
const int Nt{env().getGrid()->GlobalDimensions()[Tdir]};
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
//envCreate(std::vector<Complex>, getName(), 1, nvec*Distil.Ns*Distil.Nt*Distil.nnoise);
|
||||
envCreate(NoiseTensor, getName(), 1, Distil.nnoise, Nt, nvec, Distil.Ns);
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
template <typename FImpl>
|
||||
void TNoises<FImpl>::execute(void)
|
||||
{
|
||||
const std::string &UniqueIdentifier{par().UniqueIdentifier};
|
||||
auto &noise = envGet(std::vector<Complex>, getName());
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt{Distil.Nt};
|
||||
const int Ns{Distil.Ns};
|
||||
const int TI{Distil.TI};
|
||||
const int LI{Distil.LI};
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
|
||||
GridSerialRNG sRNG;
|
||||
sRNG.SeedUniqueString(UniqueIdentifier + std::to_string(vm().getTrajectory())); //maybe add more??
|
||||
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.;
|
||||
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 std::string &UniqueIdentifier{par().UniqueIdentifier};
|
||||
auto &noise = envGet(NoiseTensor, getName());
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt{env().getGrid()->GlobalDimensions()[Tdir]};
|
||||
const int Ns{Distil.Ns};
|
||||
const int TI{Distil.TI};
|
||||
const int LI{Distil.LI};
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
|
||||
GridSerialRNG sRNG;
|
||||
sRNG.SeedUniqueString(UniqueIdentifier + std::to_string(vm().getTrajectory())); //maybe add more??
|
||||
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.;
|
||||
noise(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;
|
||||
noise(inoise, t, ivec, is) = (rn > 0.5) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_MODULE_NAMESPACE
|
||||
|
||||
END_HADRONS_NAMESPACE
|
||||
|
||||
#endif // Hadrons_MDistil_Noises_hpp_
|
||||
|
@ -154,6 +154,7 @@ void TPerambFromSolve<FImpl>::setup(void)
|
||||
|
||||
grid4d = env().getGrid();
|
||||
grid3d = MakeLowerDimGrid(grid4d);
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
|
||||
|
||||
const int nvec_reduced{par().nvec_reduced};
|
||||
@ -161,9 +162,9 @@ void TPerambFromSolve<FImpl>::setup(void)
|
||||
//envCreate(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName(), 1,
|
||||
// sIndexNames,Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
envCreate(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName(), 1,
|
||||
sIndexNames,Distil.Nt,nvec_reduced,LI_reduced,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
sIndexNames,Nt,nvec_reduced,LI_reduced,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
envCreate(std::vector<Complex>, getName() + "_noise", 1,
|
||||
nvec*Distil.Ns*Distil.Nt*Distil.nnoise);
|
||||
nvec*Distil.Ns*Nt*Distil.nnoise);
|
||||
|
||||
envTmp(LatticeColourVector, "result_3d",1,LatticeColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "evec3d",1,LatticeColourVector(grid3d));
|
||||
@ -187,34 +188,32 @@ void TPerambFromSolve<FImpl>::Cleanup(void)
|
||||
template <typename FImpl>
|
||||
void TPerambFromSolve<FImpl>::execute(void)
|
||||
{
|
||||
const int nvec_reduced{par().nvec_reduced};
|
||||
const int LI_reduced{par().LI_reduced};
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int TI{Distil.TI};
|
||||
const int SI{Distil.SI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt{Distil.Nt};
|
||||
const int Nt_inv{Distil.Nt_inv};
|
||||
const int tsrc{Distil.tsrc};
|
||||
const int Ns{Distil.Ns};
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
auto &perambulator = envGet(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>,
|
||||
getName());
|
||||
auto &solve = envGet(std::vector<FermionField>, par().solve);
|
||||
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, par().eigenPack);
|
||||
GridCartesian * grid4d = env().getGrid();
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
const int Ntlocal{grid4d->LocalDimensions()[3]};
|
||||
const int Ntfirst{grid4d->LocalStarts()[3]};
|
||||
|
||||
const int nvec_reduced{par().nvec_reduced};
|
||||
const int LI_reduced{par().LI_reduced};
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int TI{Distil.TI};
|
||||
const int SI{Distil.SI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt_inv{Distil.Nt_inv};
|
||||
const int tsrc{Distil.tsrc};
|
||||
const int Ns{Distil.Ns};
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
auto &perambulator = envGet(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName());
|
||||
auto &solve = envGet(std::vector<FermionField>, par().solve);
|
||||
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, par().eigenPack);
|
||||
|
||||
envGetTmp(LatticeColourVector, result_nospin);
|
||||
envGetTmp(LatticeColourVector, result_3d);
|
||||
envGetTmp(LatticeColourVector, evec3d);
|
||||
|
||||
GridCartesian * grid4d = env().getGrid();
|
||||
|
||||
int Ntlocal = grid4d->LocalDimensions()[3];
|
||||
int Ntfirst = grid4d->LocalStarts()[3];
|
||||
|
||||
for (int inoise = 0; inoise < nnoise; inoise++) {
|
||||
for (int dk = 0; dk < LI_reduced; dk++) {
|
||||
for (int dt = 0; dt < Nt_inv; dt++) {
|
||||
|
@ -134,38 +134,36 @@ std::vector<std::string> TPerambulator<FImpl>::getOutput(void)
|
||||
template <typename FImpl>
|
||||
void TPerambulator<FImpl>::setup(void)
|
||||
{
|
||||
Cleanup();
|
||||
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
|
||||
const int Ns{Distil.Ns};
|
||||
std::array<std::string,6> sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"};
|
||||
|
||||
envCreate(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName(), 1,
|
||||
sIndexNames,Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
envCreate(std::vector<FermionField>, getName() + "_unsmeared_sink", 1,
|
||||
Cleanup();
|
||||
grid4d = env().getGrid();
|
||||
grid3d = MakeLowerDimGrid(grid4d);
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
|
||||
const int Ns{Distil.Ns};
|
||||
std::array<std::string,6> sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"};
|
||||
|
||||
envCreate(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName(), 1,
|
||||
sIndexNames,Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
envCreate(std::vector<FermionField>, getName() + "_unsmeared_sink", 1,
|
||||
nnoise*LI*Ns*Nt_inv, envGetGrid(FermionField));
|
||||
|
||||
grid4d = env().getGrid();
|
||||
grid3d = MakeLowerDimGrid(grid4d);//new GridCartesian(latt_size,simd_layout_3,mpi_layout,*grid4d);
|
||||
|
||||
envTmpLat(LatticeSpinColourVector, "dist_source");
|
||||
envTmpLat(LatticeSpinColourVector, "tmp2");
|
||||
envTmpLat(LatticeSpinColourVector, "result");
|
||||
envTmpLat(LatticeColourVector, "result_nospin");
|
||||
envTmp(LatticeSpinColourVector, "tmp3d",1,LatticeSpinColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "tmp3d_nospin",1,LatticeColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "result_3d",1,LatticeColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "evec3d",1,LatticeColourVector(grid3d));
|
||||
|
||||
Ls_ = env().getObjectLs(par().solver);
|
||||
envTmpLat(FermionField, "v4dtmp");
|
||||
envTmpLat(FermionField, "v5dtmp", Ls_);
|
||||
envTmpLat(FermionField, "v5dtmp_sol", Ls_);
|
||||
|
||||
|
||||
envTmpLat(LatticeSpinColourVector, "dist_source");
|
||||
envTmpLat(LatticeSpinColourVector, "tmp2");
|
||||
envTmpLat(LatticeSpinColourVector, "result");
|
||||
envTmpLat(LatticeColourVector, "result_nospin");
|
||||
envTmp(LatticeSpinColourVector, "tmp3d",1,LatticeSpinColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "tmp3d_nospin",1,LatticeColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "result_3d",1,LatticeColourVector(grid3d));
|
||||
envTmp(LatticeColourVector, "evec3d",1,LatticeColourVector(grid3d));
|
||||
|
||||
Ls_ = env().getObjectLs(par().solver);
|
||||
envTmpLat(FermionField, "v4dtmp");
|
||||
envTmpLat(FermionField, "v5dtmp", Ls_);
|
||||
envTmpLat(FermionField, "v5dtmp_sol", Ls_);
|
||||
}
|
||||
|
||||
// clean up any temporaries created by setup (that aren't stored in the environment)
|
||||
@ -183,30 +181,29 @@ void TPerambulator<FImpl>::Cleanup(void)
|
||||
template <typename FImpl>
|
||||
void TPerambulator<FImpl>::execute(void)
|
||||
{
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
const int nvec{par().nvec};
|
||||
const DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int SI{Distil.SI};
|
||||
const int TI{Distil.TI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt{Distil.Nt};
|
||||
const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
|
||||
const int tsrc{Distil.tsrc};
|
||||
const int Ns{Distil.Ns};
|
||||
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
const int Nt_inv{full_tdil ? 1 : TI}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
|
||||
|
||||
auto &solver=envGet(Solver, par().solver);
|
||||
auto &mat = solver.getFMat();
|
||||
envGetTmp(FermionField, v4dtmp);
|
||||
envGetTmp(FermionField, v5dtmp);
|
||||
envGetTmp(FermionField, v5dtmp_sol);
|
||||
|
||||
|
||||
const bool full_tdil{TI==Nt};
|
||||
const bool exact_distillation{full_tdil && LI==nvec};
|
||||
|
||||
const std::string &UniqueIdentifier{par().UniqueIdentifier};
|
||||
|
||||
auto &noise = envGet(std::vector<Complex>, par().noise);
|
||||
//auto &noise = envGet(std::vector<Complex>, par().noise);
|
||||
auto &noise = envGet(NoiseTensor, par().noise);
|
||||
auto &perambulator = envGet(Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName());
|
||||
auto &epack = envGet(Grid::Hadrons::EigenPack<LatticeColourVector>, par().eigenPack);
|
||||
auto &unsmeared_sink = envGet(std::vector<FermionField>, getName() + "_unsmeared_sink");
|
||||
@ -245,7 +242,8 @@ void TPerambulator<FImpl>::execute(void)
|
||||
for (int ik = dk; ik < nvec; ik += LI){
|
||||
for (int is = ds; is < Ns; is += SI){
|
||||
ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv,3);
|
||||
tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
|
||||
//tmp3d_nospin = evec3d * noise[inoise + nnoise*(t_inv + Nt*(ik+nvec*is))];
|
||||
tmp3d_nospin = evec3d * noise(inoise, t_inv, ik, is);
|
||||
tmp3d=zero;
|
||||
pokeSpin(tmp3d,tmp3d_nospin,is);
|
||||
tmp2=zero;
|
||||
|
@ -101,17 +101,13 @@ std::vector<std::string> TLoadPerambulator<FImpl>::getOutput(void)
|
||||
template <typename FImpl>
|
||||
void TLoadPerambulator<FImpl>::setup(void)
|
||||
{
|
||||
GridCartesian * grid4d = env().getGrid();
|
||||
const int Nt{grid4d->GlobalDimensions()[Tdir]};
|
||||
const int nvec{par().nvec};
|
||||
const MDistil::DistilParameters & Distil{par().Distil};
|
||||
const int LI{Distil.LI};
|
||||
const int nnoise{Distil.nnoise};
|
||||
const int Nt_inv{Distil.Nt_inv}; // TODO: PROBABLY BETTER: if (full_tdil) Nt_inv=1; else Nt_inv = TI;
|
||||
const int Ns{Distil.Ns};
|
||||
std::array<std::string,6> sIndexNames{"Nt", "nvec", "LI", "nnoise", "Nt_inv", "SI"};
|
||||
|
||||
envCreate(MDistil::Perambulator<SpinVector COMMA 6 COMMA sizeof(Real)>, getName(), 1,
|
||||
sIndexNames,Distil.Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
|
||||
sIndexNames,Nt,nvec,Distil.LI,Distil.nnoise,Distil.Nt_inv,Distil.SI);
|
||||
}
|
||||
|
||||
// execution ///////////////////////////////////////////////////////////////////
|
||||
|
Reference in New Issue
Block a user