1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-04-27 22:25:56 +01:00

Beautification

This commit is contained in:
Michael Marshall 2019-11-02 16:15:48 +00:00
parent 4bcdb4ff95
commit fcd90705bc
6 changed files with 588 additions and 597 deletions

View File

@ -41,7 +41,7 @@ BEGIN_HADRONS_NAMESPACE
BEGIN_MODULE_NAMESPACE(MDistil) BEGIN_MODULE_NAMESPACE(MDistil)
/****************************************************************************** /******************************************************************************
Common elements for distillation Distillation code that is common across modules
******************************************************************************/ ******************************************************************************/
struct DistilParameters: Serializable { struct DistilParameters: Serializable {
@ -102,6 +102,7 @@ inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD )
/************************************************************************************* /*************************************************************************************
Rotate eigenvectors into our phase convention Rotate eigenvectors into our phase convention
First component of first eigenvector is real and positive First component of first eigenvector is real and positive
TODO: Should this be in Distil.hpp?
*************************************************************************************/ *************************************************************************************/
inline void RotateEigen(std::vector<LatticeColourVector> & evec) inline void RotateEigen(std::vector<LatticeColourVector> & evec)

View File

@ -108,19 +108,22 @@ template <typename FImpl>
std::vector<std::string> TDistilVectors<FImpl>::getInput(void) std::vector<std::string> TDistilVectors<FImpl>::getInput(void)
{ {
PerambulatorName = par().perambulator; PerambulatorName = par().perambulator;
if( PerambulatorName.size() == 0 ) { if (PerambulatorName.empty())
{
PerambulatorName = getName(); PerambulatorName = getName();
PerambulatorName.append( "_peramb" ); PerambulatorName.append("_peramb");
} }
NoiseVectorName = par().noise; NoiseVectorName = par().noise;
if( NoiseVectorName.size() == 0 ) { if (NoiseVectorName.empty())
{
NoiseVectorName = PerambulatorName; NoiseVectorName = PerambulatorName;
NoiseVectorName.append( "_noise" ); NoiseVectorName.append("_noise");
} }
LapEvecName = par().lapevec; LapEvecName = par().lapevec;
if( LapEvecName.size() == 0 ) { if (LapEvecName.empty())
{
LapEvecName = PerambulatorName; LapEvecName = PerambulatorName;
LapEvecName.append( "_lapevec" ); LapEvecName.append("_lapevec");
} }
return { PerambulatorName, NoiseVectorName, LapEvecName }; return { PerambulatorName, NoiseVectorName, LapEvecName };
} }
@ -132,19 +135,20 @@ std::vector<std::string> TDistilVectors<FImpl>::getOutput(void)
SinkName = par().sink; SinkName = par().sink;
bMakeSource = ( SourceName.size() > 0 ); bMakeSource = ( SourceName.size() > 0 );
bMakeSink = ( SinkName.size() > 0 ); bMakeSink = ( SinkName.size() > 0 );
if( !bMakeSource && !bMakeSink ) { if (!bMakeSource && !bMakeSink)
{
SourceName = getName(); SourceName = getName();
SinkName = SourceName; SinkName = SourceName;
SourceName.append( "_rho" ); SourceName.append("_rho");
SinkName.append( "_phi" ); SinkName.append("_phi");
bMakeSource = true; bMakeSource = true;
bMakeSink = true; bMakeSink = true;
} }
std::vector<std::string> out; std::vector<std::string> out;
if( bMakeSource ) if (bMakeSource)
out.push_back( SourceName ); out.push_back(SourceName);
if( bMakeSink ) if (bMakeSink)
out.push_back( SinkName ); out.push_back(SinkName);
return out; return out;
} }
@ -161,7 +165,6 @@ void TDistilVectors<FImpl>::setup(void)
const int Nt{ env().getDim(Tdir) }; const int Nt{ env().getDim(Tdir) };
assert( Nt == static_cast<int>( perambulator.tensor.dimension(0) ) && "PerambTensor time dimensionality bad" ); assert( Nt == static_cast<int>( perambulator.tensor.dimension(0) ) && "PerambTensor time dimensionality bad" );
const int TI{ Hadrons::MDistil::DistilParameters::ParameterDefault( par().TI, Nt, true) };
const int LI{ static_cast<int>( perambulator.tensor.dimension(2) ) }; const int LI{ static_cast<int>( perambulator.tensor.dimension(2) ) };
const int SI{ static_cast<int>( perambulator.tensor.dimension(5) ) }; const int SI{ static_cast<int>( perambulator.tensor.dimension(5) ) };
const int Nt_inv{ static_cast<int>( perambulator.tensor.dimension(4) ) }; const int Nt_inv{ static_cast<int>( perambulator.tensor.dimension(4) ) };
@ -172,14 +175,13 @@ void TDistilVectors<FImpl>::setup(void)
const int nvec{Hadrons::MDistil::DistilParameters::ParameterDefault(par().nvec, nvec_per, true) }; const int nvec{Hadrons::MDistil::DistilParameters::ParameterDefault(par().nvec, nvec_per, true) };
assert( nvec <= nvec_per && "Not enough distillation sub-space vectors" ); assert( nvec <= nvec_per && "Not enough distillation sub-space vectors" );
if( bMakeSource ) if (bMakeSource)
envCreate(std::vector<FermionField>, SourceName, 1, nnoise*LI*SI*Nt_inv, envGetGrid(FermionField)); envCreate(std::vector<FermionField>, SourceName, 1, nnoise*LI*SI*Nt_inv, envGetGrid(FermionField));
if( bMakeSink ) if (bMakeSink)
envCreate(std::vector<FermionField>, SinkName, 1, nnoise*LI*SI*Nt_inv, envGetGrid(FermionField)); envCreate(std::vector<FermionField>, SinkName, 1, nnoise*LI*SI*Nt_inv, envGetGrid(FermionField));
grid4d = env().getGrid(); grid4d = env().getGrid();
Coordinate latt_size = GridDefaultLatt(); Coordinate latt_size = GridDefaultLatt();
Coordinate simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
Coordinate mpi_layout = GridDefaultMpi(); Coordinate mpi_layout = GridDefaultMpi();
Coordinate simd_layout_3 = GridDefaultSimd(Nd-1, vComplex::Nsimd()); Coordinate simd_layout_3 = GridDefaultSimd(Nd-1, vComplex::Nsimd());
latt_size[Nd-1] = 1; latt_size[Nd-1] = 1;
@ -187,7 +189,6 @@ void TDistilVectors<FImpl>::setup(void)
mpi_layout[Nd-1] = 1; mpi_layout[Nd-1] = 1;
grid3d = MakeLowerDimGrid(grid4d); grid3d = MakeLowerDimGrid(grid4d);
envTmp(LatticeSpinColourVector, "tmp2",1,LatticeSpinColourVector(grid4d)); envTmp(LatticeSpinColourVector, "tmp2",1,LatticeSpinColourVector(grid4d));
envTmp(LatticeSpinColourVector, "tmp3d",1,LatticeSpinColourVector(grid3d)); envTmp(LatticeSpinColourVector, "tmp3d",1,LatticeSpinColourVector(grid3d));
envTmp(LatticeColourVector, "tmp3d_nospin",1,LatticeColourVector(grid3d)); envTmp(LatticeColourVector, "tmp3d_nospin",1,LatticeColourVector(grid3d));
@ -199,7 +200,8 @@ void TDistilVectors<FImpl>::setup(void)
template <typename FImpl> template <typename FImpl>
void TDistilVectors<FImpl>::Cleanup(void) void TDistilVectors<FImpl>::Cleanup(void)
{ {
if( grid3d != nullptr ) { if ( grid3d != nullptr)
{
delete grid3d; delete grid3d;
grid3d = nullptr; grid3d = nullptr;
} }
@ -236,18 +238,19 @@ void TDistilVectors<FImpl>::execute(void)
int vecindex; int vecindex;
int t_inv; int t_inv;
if( bMakeSource ) { if (bMakeSource)
{
auto &rho = envGet(std::vector<FermionField>, SourceName); auto &rho = envGet(std::vector<FermionField>, SourceName);
for( int inoise = 0; inoise < nnoise; inoise++ ) { for (int inoise = 0; inoise < nnoise; inoise++) {
for( int dk = 0; dk < LI; dk++ ) { for (int dk = 0; dk < LI; dk++) {
for( int dt = 0; dt < Nt_inv; dt++ ) { for (int dt = 0; dt < Nt_inv; dt++) {
for( int ds = 0; ds < SI; ds++ ) { for (int ds = 0; ds < SI; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt; vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
rho[vecindex] = 0; rho[vecindex] = 0;
tmp3d_nospin = 0; tmp3d_nospin = 0;
for (int it = dt; it < Nt; it += TI){ for (int it = dt; it < Nt; it += TI){
if (full_tdil) t_inv = tsrc; else t_inv = it; if (full_tdil) t_inv = tsrc; else t_inv = it;
if( t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal ) { if (t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal) {
for (int ik = dk; ik < nvec; ik += LI){ for (int ik = dk; ik < nvec; ik += LI){
for (int is = ds; is < Ns; is += SI){ for (int is = ds; is < Ns; is += SI){
ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv-Ntfirst,Tdir); ExtractSliceLocal(evec3d,epack.evec[ik],0,t_inv-Ntfirst,Tdir);
@ -266,12 +269,12 @@ void TDistilVectors<FImpl>::execute(void)
} }
} }
} }
if( bMakeSink ) { if (bMakeSink) {
auto &phi = envGet(std::vector<FermionField>, SinkName); auto &phi = envGet(std::vector<FermionField>, SinkName);
for( int inoise = 0; inoise < nnoise; inoise++ ) { for (int inoise = 0; inoise < nnoise; inoise++) {
for( int dk = 0; dk < LI; dk++ ) { for (int dk = 0; dk < LI; dk++) {
for( int dt = 0; dt < Nt_inv; dt++ ) { for (int dt = 0; dt < Nt_inv; dt++) {
for( int ds = 0; ds < SI; ds++ ) { for (int ds = 0; ds < SI; ds++) {
vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt; vecindex = inoise + nnoise * dk + nnoise * LI * ds + nnoise *LI * SI*dt;
phi[vecindex] = 0; phi[vecindex] = 0;
for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) { for (int t = Ntfirst; t < Ntfirst + Ntlocal; t++) {

View File

@ -135,7 +135,8 @@ template <typename GImpl>
std::vector<std::string> TLapEvec<GImpl>::getInput(void) std::vector<std::string> TLapEvec<GImpl>::getInput(void)
{ {
sGaugeName = par().gauge; sGaugeName = par().gauge;
if( sGaugeName.size() == 0 ) { if (sGaugeName.empty())
{
sGaugeName = getName(); sGaugeName = getName();
sGaugeName.append( "_gauge" ); sGaugeName.append( "_gauge" );
} }
@ -172,7 +173,8 @@ void TLapEvec<GImpl>::setup(void)
template <typename GImpl> template <typename GImpl>
void TLapEvec<GImpl>::Cleanup(void) void TLapEvec<GImpl>::Cleanup(void)
{ {
if( gridLD != nullptr ) { if (gridLD != nullptr)
{
delete gridLD; delete gridLD;
gridLD = nullptr; gridLD = nullptr;
} }
@ -190,15 +192,14 @@ void TLapEvec<GImpl>::Cleanup(void)
template<typename Field, typename GaugeField=LatticeGaugeField> template<typename Field, typename GaugeField=LatticeGaugeField>
class Laplacian3D : public LinearOperatorBase<Field>, public LinearFunction<Field> { class Laplacian3D : public LinearOperatorBase<Field>, public LinearFunction<Field> {
typedef typename GaugeField::vector_type vCoeff_t; typedef typename GaugeField::vector_type vCoeff_t;
protected: // I don't really mind if _gf is messed with ... so make this public? public:
//GaugeField & _gf;
int nd; // number of spatial dimensions int nd; // number of spatial dimensions
std::vector<Lattice<iColourMatrix<vCoeff_t> > > U; std::vector<Lattice<iColourMatrix<vCoeff_t> > > U;
public:
// Construct this operator given a gauge field and the number of dimensions it should act on // Construct this operator given a gauge field and the number of dimensions it should act on
Laplacian3D( GaugeField& gf, int dimSpatial = Tdir ) : /*_gf(gf),*/ nd{dimSpatial} { Laplacian3D( GaugeField& gf, int dimSpatial = Tdir ) : nd{dimSpatial}
{
assert(dimSpatial>=1); assert(dimSpatial>=1);
for( int mu = 0 ; mu < nd ; mu++ ) for (int mu = 0 ; mu < nd ; mu++)
U.push_back(PeekIndex<LorentzIndex>(gf,mu)); U.push_back(PeekIndex<LorentzIndex>(gf,mu));
} }
@ -209,9 +210,8 @@ public:
out = ( ( Real ) ( 2 * nd ) ) * in; out = ( ( Real ) ( 2 * nd ) ) * in;
Field _tmp(in.Grid()); Field _tmp(in.Grid());
typedef typename GaugeField::vector_type vCoeff_t; typedef typename GaugeField::vector_type vCoeff_t;
//Lattice<iColourMatrix<vCoeff_t> > U(in.Grid()); for (int mu = 0 ; mu < nd ; mu++)
for( int mu = 0 ; mu < nd ; mu++ ) { {
//U = PeekIndex<LorentzIndex>(_gf,mu);
out -= U[mu] * Cshift( in, mu, 1); out -= U[mu] * Cshift( in, mu, 1);
_tmp = adj( U[mu] ) * in; _tmp = adj( U[mu] ) * in;
out -= Cshift(_tmp,mu,-1); out -= Cshift(_tmp,mu,-1);
@ -231,11 +231,10 @@ class Laplacian3DHerm : public LinearFunction<Field> {
public: public:
OperatorFunction<Field> & _poly; OperatorFunction<Field> & _poly;
LinearOperatorBase<Field> &_Linop; LinearOperatorBase<Field> &_Linop;
Laplacian3DHerm(OperatorFunction<Field> & poly,LinearOperatorBase<Field>& linop) Laplacian3DHerm(OperatorFunction<Field> & poly,LinearOperatorBase<Field>& linop)
: _poly{poly}, _Linop{linop} {} : _poly{poly}, _Linop{linop} {}
void operator()(const Field& in, Field& out)
void operator()(const Field& in, Field& out) { {
_poly(_Linop,in,out); _poly(_Linop,in,out);
} }
}; };
@ -283,7 +282,8 @@ void TLapEvec<GImpl>::execute(void)
const int Ntlocal{gridHD->LocalDimensions()[Tdir]}; const int Ntlocal{gridHD->LocalDimensions()[Tdir]};
const int Ntfirst{gridHD->LocalStarts()[Tdir]}; const int Ntfirst{gridHD->LocalStarts()[Tdir]};
uint32_t ConvergenceErrors{0}; uint32_t ConvergenceErrors{0};
for(int t = 0; t < Ntlocal; t++ ) { for (int t = 0; t < Ntlocal; t++ )
{
LOG(Message) << "------------------------------------------------------------" << std::endl; LOG(Message) << "------------------------------------------------------------" << std::endl;
LOG(Message) << " Compute eigenpack, local timeslice = " << t << " / " << Ntlocal << std::endl; LOG(Message) << " Compute eigenpack, local timeslice = " << t << " / " << Ntlocal << std::endl;
LOG(Message) << "------------------------------------------------------------" << std::endl; LOG(Message) << "------------------------------------------------------------" << std::endl;
@ -292,12 +292,12 @@ void TLapEvec<GImpl>::execute(void)
// Construct smearing operator // Construct smearing operator
ExtractSliceLocal(UmuNoTime,Umu_smear,0,t,Tdir); // switch to 3d/4d objects ExtractSliceLocal(UmuNoTime,Umu_smear,0,t,Tdir); // switch to 3d/4d objects
Laplacian3D<LatticeColourVector> Nabla(UmuNoTime); Laplacian3D<LatticeColourVector> Nabla(UmuNoTime);
LOG(Debug) << "Chebyshev preconditioning to order " << ChebPar.PolyOrder LOG(Message) << "Chebyshev preconditioning to order " << ChebPar.PolyOrder
<< " with parameters (alpha,beta) = (" << ChebPar.alpha << "," << ChebPar.beta << ")" << std::endl; << " with parameters (alpha,beta) = (" << ChebPar.alpha << "," << ChebPar.beta << ")" << std::endl;
Chebyshev<LatticeColourVector> Cheb(ChebPar.alpha,ChebPar.beta,ChebPar.PolyOrder); Chebyshev<LatticeColourVector> Cheb(ChebPar.alpha,ChebPar.beta,ChebPar.PolyOrder);
// Construct source vector according to Test_dwf_compressed_lanczos.cc // Construct source vector according to Test_dwf_compressed_lanczos.cc
src = 11.0; //TODO: Why hard-coded 11? src = 11.0; // NB: This is a dummy parameter and just needs to be non-zero
RealD nn = norm2(src); RealD nn = norm2(src);
nn = Grid::sqrt(nn); nn = Grid::sqrt(nn);
src = src * (1.0/nn); src = src * (1.0/nn);
@ -307,7 +307,8 @@ void TLapEvec<GImpl>::execute(void)
IRL(NablaCheby,Nabla,LPar.Nvec,LPar.Nk,LPar.Nk+LPar.Np,LPar.resid,LPar.MaxIt); IRL(NablaCheby,Nabla,LPar.Nvec,LPar.Nk,LPar.Nk+LPar.Np,LPar.resid,LPar.MaxIt);
int Nconv = 0; int Nconv = 0;
IRL.calc(eig[t].eval,eig[t].evec,src,Nconv); IRL.calc(eig[t].eval,eig[t].evec,src,Nconv);
if( Nconv < LPar.Nvec ) { if (Nconv < LPar.Nvec)
{
// NB: Can't assert here since we are processing local slices - i.e. not all nodes would assert // NB: Can't assert here since we are processing local slices - i.e. not all nodes would assert
ConvergenceErrors = 1; ConvergenceErrors = 1;
LOG(Error) << "MDistil::LapEvec : Not enough eigenvectors converged. If this occurs in practice, we should modify the eigensolver to iterate once more to ensure the second convergence test does not take us below the requested number of eigenvectors" << std::endl; LOG(Error) << "MDistil::LapEvec : Not enough eigenvectors converged. If this occurs in practice, we should modify the eigensolver to iterate once more to ensure the second convergence test does not take us below the requested number of eigenvectors" << std::endl;

View File

@ -82,17 +82,13 @@ TNoises<FImpl>::TNoises(const std::string name)
template <typename FImpl> template <typename FImpl>
std::vector<std::string> TNoises<FImpl>::getInput(void) std::vector<std::string> TNoises<FImpl>::getInput(void)
{ {
std::vector<std::string> in; return {};
return in;
} }
template <typename FImpl> template <typename FImpl>
std::vector<std::string> TNoises<FImpl>::getOutput(void) std::vector<std::string> TNoises<FImpl>::getOutput(void)
{ {
std::vector<std::string> out = {getName()}; return {getName()};
return out;
} }
// setup /////////////////////////////////////////////////////////////////////// // setup ///////////////////////////////////////////////////////////////////////
@ -103,8 +99,6 @@ void TNoises<FImpl>::setup(void)
const int Nt{env().getDim(Tdir)}; const int Nt{env().getDim(Tdir)};
const int nnoise{par().nnoise}; const int nnoise{par().nnoise};
const int nvec{par().nvec}; const int nvec{par().nvec};
const int TI{ Hadrons::MDistil::DistilParameters::ParameterDefault( par().TI, Nt, true) };
const int LI{ Hadrons::MDistil::DistilParameters::ParameterDefault( par().LI, nvec, true) };
envCreate(NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns); envCreate(NoiseTensor, getName(), 1, nnoise, Nt, nvec, Ns);
} }
@ -120,9 +114,8 @@ void TNoises<FImpl>::execute(void)
const bool full_tdil{ TI == Nt }; \ const bool full_tdil{ TI == Nt }; \
const bool exact_distillation{ full_tdil && LI == nvec }; \ const bool exact_distillation{ full_tdil && LI == nvec }; \
std::string UniqueIdentifier{par().UniqueIdentifier}; std::string UniqueIdentifier{par().UniqueIdentifier};
if( UniqueIdentifier.length() == 0 ) { if (UniqueIdentifier.empty())
UniqueIdentifier = getName(); UniqueIdentifier = getName();
}
UniqueIdentifier.append( std::to_string( vm().getTrajectory() ) ); UniqueIdentifier.append( std::to_string( vm().getTrajectory() ) );
// We use our own seeds so we can specify different noises per quark // We use our own seeds so we can specify different noises per quark
@ -130,11 +123,11 @@ void TNoises<FImpl>::execute(void)
sRNG.SeedUniqueString(UniqueIdentifier); sRNG.SeedUniqueString(UniqueIdentifier);
Real rn; Real rn;
auto &noise = envGet(NoiseTensor, getName()); auto &noise = envGet(NoiseTensor, getName());
for( int inoise = 0; inoise < nnoise; inoise++ ) { for (int inoise = 0; inoise < nnoise; inoise++) {
for( int t = 0; t < Nt; t++ ) { for (int t = 0; t < Nt; t++) {
for( int ivec = 0; ivec < nvec; ivec++ ) { for (int ivec = 0; ivec < nvec; ivec++) {
for( int is = 0; is < Ns; is++ ) { for (int is = 0; is < Ns; is++) {
if( exact_distillation ) if (exact_distillation)
noise(inoise, t, ivec, is) = 1.; noise(inoise, t, ivec, is) = 1.;
else{ else{
random(sRNG,rn); random(sRNG,rn);

View File

@ -93,7 +93,6 @@ TPerambFromSolve<FImpl>::~TPerambFromSolve(void)
Cleanup(); Cleanup();
}; };
// dependencies/products /////////////////////////////////////////////////////// // dependencies/products ///////////////////////////////////////////////////////
template <typename FImpl> template <typename FImpl>
std::vector<std::string> TPerambFromSolve<FImpl>::getInput(void) std::vector<std::string> TPerambFromSolve<FImpl>::getInput(void)
@ -127,7 +126,8 @@ void TPerambFromSolve<FImpl>::setup(void)
template <typename FImpl> template <typename FImpl>
void TPerambFromSolve<FImpl>::Cleanup(void) void TPerambFromSolve<FImpl>::Cleanup(void)
{ {
if( grid3d != nullptr ) { if (grid3d != nullptr)
{
delete grid3d; delete grid3d;
grid3d = nullptr; grid3d = nullptr;
} }
@ -171,10 +171,10 @@ void TPerambFromSolve<FImpl>::execute(void)
} }
} }
} }
if(grid4d->IsBoss())
if(grid4d->IsBoss()) { {
std::string sPerambName{par().PerambFileName}; std::string sPerambName{par().PerambFileName};
if( sPerambName.length() == 0 ) if (sPerambName.empty())
sPerambName = getName(); sPerambName = getName();
sPerambName.append( "." ); sPerambName.append( "." );
sPerambName.append( std::to_string(vm().getTrajectory())); sPerambName.append( std::to_string(vm().getTrajectory()));
@ -183,7 +183,5 @@ void TPerambFromSolve<FImpl>::execute(void)
} }
END_MODULE_NAMESPACE END_MODULE_NAMESPACE
END_HADRONS_NAMESPACE END_HADRONS_NAMESPACE
#endif // Hadrons_MDistil_PerambFromSolve_hpp_ #endif // Hadrons_MDistil_PerambFromSolve_hpp_

View File

@ -126,7 +126,7 @@ void TPerambulator<FImpl>::setup(void)
grid3d = MakeLowerDimGrid(grid4d); grid3d = MakeLowerDimGrid(grid4d);
DISTIL_PARAMETERS_DEFINE( true ); DISTIL_PARAMETERS_DEFINE( true );
const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName }; const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName };
if( !UnsmearedSinkFileName.empty() ) if (!UnsmearedSinkFileName.empty())
bool bMulti = ( Hadrons::MDistil::DistilParameters::ParameterDefault( par().UnsmearedSinkMultiFile, 1, true ) != 0 ); bool bMulti = ( Hadrons::MDistil::DistilParameters::ParameterDefault( par().UnsmearedSinkMultiFile, 1, true ) != 0 );
envCreate(PerambTensor, getName(), 1, Nt,nvec,LI,nnoise,Nt_inv,SI); envCreate(PerambTensor, getName(), 1, Nt,nvec,LI,nnoise,Nt_inv,SI);
@ -152,7 +152,7 @@ void TPerambulator<FImpl>::setup(void)
template <typename FImpl> template <typename FImpl>
void TPerambulator<FImpl>::Cleanup(void) void TPerambulator<FImpl>::Cleanup(void)
{ {
if( grid3d != nullptr ) if (grid3d != nullptr)
{ {
delete grid3d; delete grid3d;
grid3d = nullptr; grid3d = nullptr;
@ -186,8 +186,6 @@ void TPerambulator<FImpl>::execute(void)
const int Ntfirst{grid4d->LocalStarts()[3]}; const int Ntfirst{grid4d->LocalStarts()[3]};
const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName }; const std::string UnsmearedSinkFileName{ par().UnsmearedSinkFileName };
{
int t_inv;
for (int inoise = 0; inoise < nnoise; inoise++) for (int inoise = 0; inoise < nnoise; inoise++)
{ {
for (int dk = 0; dk < LI; dk++) for (int dk = 0; dk < LI; dk++)
@ -202,7 +200,7 @@ void TPerambulator<FImpl>::execute(void)
evec3d = 0; evec3d = 0;
for (int it = dt; it < Nt; it += TI) for (int it = dt; it < Nt; it += TI)
{ {
if (full_tdil) t_inv = tsrc; else t_inv = it; const int t_inv{full_tdil ? tsrc : it};
if( t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal ) if( t_inv >= Ntfirst && t_inv < Ntfirst + Ntlocal )
{ {
for (int ik = dk; ik < nvec; ik += LI) for (int ik = dk; ik < nvec; ik += LI)
@ -223,9 +221,7 @@ void TPerambulator<FImpl>::execute(void)
result=0; result=0;
v4dtmp = dist_source; v4dtmp = dist_source;
if (Ls_ == 1) if (Ls_ == 1)
{
solver(result, v4dtmp); solver(result, v4dtmp);
}
else else
{ {
mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp); mat.ImportPhysicalFermionSource(v4dtmp, v5dtmp);
@ -233,7 +229,7 @@ void TPerambulator<FImpl>::execute(void)
mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp); mat.ExportPhysicalFermionSolution(v5dtmp_sol, v4dtmp);
result = v4dtmp; result = v4dtmp;
} }
if( !UnsmearedSinkFileName.empty() ) if (!UnsmearedSinkFileName.empty())
unsmeared_sink[inoise+nnoise*(dk+LI*(dt+Nt_inv*ds))] = result; unsmeared_sink[inoise+nnoise*(dk+LI*(dt+Nt_inv*ds))] = result;
for (int is = 0; is < Ns; is++) for (int is = 0; is < Ns; is++)
{ {
@ -252,7 +248,6 @@ void TPerambulator<FImpl>::execute(void)
} }
} }
} }
}
// Now share my timeslice data with other members of the grid // Now share my timeslice data with other members of the grid
const int NumSlices{grid4d->_processors[Tdir] / grid3d->_processors[Tdir]}; const int NumSlices{grid4d->_processors[Tdir] / grid3d->_processors[Tdir]};
if (NumSlices > 1) if (NumSlices > 1)