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

Review changes

This commit is contained in:
Michael Marshall 2019-11-18 11:59:13 +00:00
parent 7bf42b9c0e
commit 18177d9709
5 changed files with 7 additions and 14 deletions

View File

@ -30,9 +30,6 @@
#ifndef Hadrons_MDistil_Distil_hpp_ #ifndef Hadrons_MDistil_Distil_hpp_
#define Hadrons_MDistil_Distil_hpp_ #define Hadrons_MDistil_Distil_hpp_
#define _USE_MATH_DEFINES
#include <math.h>
#include <Hadrons/NamedTensor.hpp> #include <Hadrons/NamedTensor.hpp>
#include <Hadrons/Module.hpp> #include <Hadrons/Module.hpp>
#include <Hadrons/ModuleFactory.hpp> #include <Hadrons/ModuleFactory.hpp>
@ -72,15 +69,13 @@ struct DistilParameters: Serializable {
int, TI, int, TI,
int, LI, int, LI,
int, SI ) int, SI )
DistilParameters() = default;
DistilParameters( const DistilParameters &p ) = default; // member-wise copy
}; };
/****************************************************************************** /******************************************************************************
Make a lower dimensional grid in preparation for local slice operations Make a lower dimensional grid in preparation for local slice operations
******************************************************************************/ ******************************************************************************/
inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD ) inline void MakeLowerDimGrid( std::unique_ptr<GridCartesian> &up, GridCartesian * gridHD )
{ {
int nd{static_cast<int>(gridHD->_ndimension)}; int nd{static_cast<int>(gridHD->_ndimension)};
Coordinate latt_size = gridHD->_gdimensions; Coordinate latt_size = gridHD->_gdimensions;
@ -89,8 +84,7 @@ inline GridCartesian * MakeLowerDimGrid( GridCartesian * gridHD )
simd_layout.push_back( 1 ); simd_layout.push_back( 1 );
Coordinate mpi_layout = gridHD->_processors; Coordinate mpi_layout = gridHD->_processors;
mpi_layout[nd-1] = 1; mpi_layout[nd-1] = 1;
GridCartesian * gridLD = new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD); up.reset( new GridCartesian(latt_size,simd_layout,mpi_layout,*gridHD) );
return gridLD;
} }
/************************************************************************************* /*************************************************************************************

View File

@ -137,7 +137,7 @@ void TDistilVectors<FImpl>::setup(void)
simd_layout_3.push_back( 1 ); simd_layout_3.push_back( 1 );
mpi_layout[Nd-1] = 1; mpi_layout[Nd-1] = 1;
GridCartesian * const grid4d{env().getGrid()}; GridCartesian * const grid4d{env().getGrid()};
grid3d.reset(MakeLowerDimGrid(grid4d)); MakeLowerDimGrid(grid3d, grid4d);
envTmp(LatticeSpinColourVector, "source4d",1,LatticeSpinColourVector(grid4d)); envTmp(LatticeSpinColourVector, "source4d",1,LatticeSpinColourVector(grid4d));
envTmp(LatticeSpinColourVector, "source3d",1,LatticeSpinColourVector(grid3d.get())); envTmp(LatticeSpinColourVector, "source3d",1,LatticeSpinColourVector(grid3d.get()));
@ -170,7 +170,6 @@ void TDistilVectors<FImpl>::execute(void)
const int Nt_inv{ full_tdil ? 1 : dp.TI }; const int Nt_inv{ full_tdil ? 1 : dp.TI };
int vecindex; int vecindex;
int t_inv;
if (!RhoName.empty()) if (!RhoName.empty())
{ {
auto &rho = envGet(std::vector<FermionField>, RhoName); auto &rho = envGet(std::vector<FermionField>, RhoName);

View File

@ -142,7 +142,7 @@ template <typename GImpl>
void TLapEvec<GImpl>::setup(void) void TLapEvec<GImpl>::setup(void)
{ {
GridCartesian * gridHD = env().getGrid(); GridCartesian * gridHD = env().getGrid();
gridLD.reset(MakeLowerDimGrid(gridHD)); MakeLowerDimGrid(gridLD,gridHD);
const int Ntlocal{gridHD->LocalDimensions()[Tdir]}; const int Ntlocal{gridHD->LocalDimensions()[Tdir]};
// Temporaries // Temporaries
envTmpLat(GaugeField, "Umu_stout"); envTmpLat(GaugeField, "Umu_stout");
@ -305,7 +305,7 @@ void TLapEvec<GImpl>::execute(void)
} }
GridLogIRL.Active( PreviousIRLLogState ); GridLogIRL.Active( PreviousIRLLogState );
gridHD->GlobalSum(ConvergenceErrors); gridHD->GlobalSum(ConvergenceErrors);
if(!ConvergenceErrors==0) if(ConvergenceErrors!=0)
{ {
HADRONS_ERROR(Program,"The eingensolver failed to find enough eigenvectors on at least one node"); HADRONS_ERROR(Program,"The eingensolver failed to find enough eigenvectors on at least one node");
} }

View File

@ -112,7 +112,7 @@ void TPerambFromSolve<FImpl>::setup(void)
const int Nt{env().getDim(Tdir)}; const int Nt{env().getDim(Tdir)};
const bool full_tdil{ dp.TI == Nt }; const bool full_tdil{ dp.TI == Nt };
const int Nt_inv{ full_tdil ? 1 : dp.TI }; const int Nt_inv{ full_tdil ? 1 : dp.TI };
grid3d.reset( MakeLowerDimGrid( env().getGrid() ) ); MakeLowerDimGrid( grid3d, env().getGrid() );
const int nvec_reduced{par().nvec_reduced}; const int nvec_reduced{par().nvec_reduced};
const int LI_reduced{ par().LI_reduced}; const int LI_reduced{ par().LI_reduced};
envCreate(PerambTensor, getName(), 1, Nt,nvec_reduced,LI_reduced,dp.nnoise,Nt_inv,dp.SI); envCreate(PerambTensor, getName(), 1, Nt,nvec_reduced,LI_reduced,dp.nnoise,Nt_inv,dp.SI);

View File

@ -99,7 +99,7 @@ std::vector<std::string> TPerambulator<FImpl>::getOutput(void)
template <typename FImpl> template <typename FImpl>
void TPerambulator<FImpl>::setup(void) void TPerambulator<FImpl>::setup(void)
{ {
grid3d.reset( MakeLowerDimGrid( env().getGrid() ) ); MakeLowerDimGrid(grid3d, env().getGrid());
const DistilParameters &dp = envGet(DistilParameters, par().DistilParams); const DistilParameters &dp = envGet(DistilParameters, par().DistilParams);
const int Nt{env().getDim(Tdir)}; const int Nt{env().getDim(Tdir)};
const bool full_tdil{ dp.TI == Nt }; const bool full_tdil{ dp.TI == Nt };