1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-09 23:45:36 +00:00

Passes make check now single and double compile

This commit is contained in:
Peter Boyle 2018-12-19 11:09:32 +00:00
parent 4e95accf80
commit 35ed1defac
18 changed files with 64 additions and 57 deletions

View File

@ -254,7 +254,7 @@ public:
////////////////////
Geometry geom;
GridBase * _grid;
CartesianStencil<siteVector,siteVector> Stencil;
CartesianStencil<siteVector,siteVector,int> Stencil;
std::vector<CoarseMatrix> A;
@ -309,7 +309,7 @@ public:
_grid(&CoarseGrid),
geom(CoarseGrid._ndimension),
Stencil(&CoarseGrid,geom.npoint,Even,geom.directions,geom.displacements),
Stencil(&CoarseGrid,geom.npoint,Even,geom.directions,geom.displacements,0),
A(geom.npoint,&CoarseGrid)
{
};

View File

@ -199,10 +199,11 @@ public:
typedef WilsonCompressor<SiteHalfCommSpinor,SiteHalfSpinor, SiteSpinor> Compressor;
typedef WilsonImplParams ImplParams;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor> StencilImpl;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor,ImplParams> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
ImplParams Params;
ImplParams Params;
WilsonImpl(const ImplParams &p = ImplParams()) : Params(p){
assert(Params.boundary_phases.size() == Nd);
};
@ -389,11 +390,11 @@ public:
typedef WilsonCompressor<SiteHalfCommSpinor,SiteHalfSpinor, SiteSpinor> Compressor;
typedef WilsonImplParams ImplParams;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor> StencilImpl;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor,ImplParams> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
ImplParams Params;
DomainWallVec5dImpl(const ImplParams &p = ImplParams()) : Params(p){};
template <class ref>
@ -596,11 +597,10 @@ public:
typedef Lattice<SitePropagator> PropagatorField;
typedef Lattice<SiteDoubledGaugeField> DoubledGaugeField;
typedef WilsonCompressor<SiteHalfCommSpinor,SiteHalfSpinor, SiteSpinor> Compressor;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
typedef GparityWilsonImplParams ImplParams;
typedef WilsonCompressor<SiteHalfCommSpinor,SiteHalfSpinor, SiteSpinor> Compressor;
typedef WilsonStencil<SiteSpinor, SiteHalfSpinor, ImplParams> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
ImplParams Params;
@ -636,9 +636,8 @@ public:
// assert our assumptions
assert((distance == 1) || (distance == -1)); // nearest neighbour stencil hard code
assert((sl == 1) || (sl == 2));
Coordinate icoor;
if ( SE->_around_the_world && St.twists[mmu] ) {
if ( SE->_around_the_world && St.parameters.twists[mmu] ) {
if ( sl == 2 ) {
@ -842,9 +841,9 @@ public:
typedef Lattice<SiteDoubledGaugeField> DoubledGaugeField;
typedef Lattice<SitePropagator> PropagatorField;
typedef SimpleCompressor<SiteSpinor> Compressor;
typedef StaggeredImplParams ImplParams;
typedef CartesianStencil<SiteSpinor, SiteSpinor> StencilImpl;
typedef SimpleCompressor<SiteSpinor> Compressor;
typedef CartesianStencil<SiteSpinor, SiteSpinor, ImplParams> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
ImplParams Params;
@ -990,9 +989,9 @@ public:
typedef Lattice<SiteSpinor> FermionField;
typedef SimpleCompressor<SiteSpinor> Compressor;
typedef StaggeredImplParams ImplParams;
typedef CartesianStencil<SiteSpinor, SiteSpinor> StencilImpl;
typedef SimpleCompressor<SiteSpinor> Compressor;
typedef CartesianStencil<SiteSpinor, SiteSpinor, ImplParams> StencilImpl;
typedef typename StencilImpl::View_type StencilView;
ImplParams Params;

View File

@ -212,7 +212,7 @@ class FourierAcceleratedPV {
// now rotate with inverse of
Coeff_t pA = b + c*cosp;
Coeff_t pB = - Coeff_t(0.0,1.0)*c*sinp;
Coeff_t pB = - Coeff_t(0.0,1.0)*Coeff_t(c*sinp);
Coeff_t pABden = pA*pA - pB*pB;
// (pA + pB * G5) * (pA - pB*G5) = (pA^2 - pB^2)

View File

@ -48,9 +48,9 @@ ImprovedStaggeredFermion<Impl>::ImprovedStaggeredFermion(GridCartesian &Fgrid, G
: Kernels(p),
_grid(&Fgrid),
_cbgrid(&Hgrid),
Stencil(&Fgrid, npoint, Even, directions, displacements),
StencilEven(&Hgrid, npoint, Even, directions, displacements), // source is Even
StencilOdd(&Hgrid, npoint, Odd, directions, displacements), // source is Odd
Stencil(&Fgrid, npoint, Even, directions, displacements,p),
StencilEven(&Hgrid, npoint, Even, directions, displacements,p), // source is Even
StencilOdd(&Hgrid, npoint, Odd, directions, displacements,p), // source is Odd
mass(_mass),
Lebesgue(_grid),
LebesgueEvenOdd(_cbgrid),

View File

@ -52,9 +52,9 @@ ImprovedStaggeredFermion5D<Impl>::ImprovedStaggeredFermion5D(GridCartesian
_FiveDimRedBlackGrid(&FiveDimRedBlackGrid),
_FourDimGrid (&FourDimGrid),
_FourDimRedBlackGrid(&FourDimRedBlackGrid),
Stencil (&FiveDimGrid,npoint,Even,directions,displacements),
StencilEven(&FiveDimRedBlackGrid,npoint,Even,directions,displacements), // source is Even
StencilOdd (&FiveDimRedBlackGrid,npoint,Odd ,directions,displacements), // source is Odd
Stencil (&FiveDimGrid,npoint,Even,directions,displacements,p),
StencilEven(&FiveDimRedBlackGrid,npoint,Even,directions,displacements,p), // source is Even
StencilOdd (&FiveDimRedBlackGrid,npoint,Odd ,directions,displacements,p), // source is Odd
mass(_mass),
c1(_c1),
c2(_c2),

View File

@ -244,11 +244,11 @@ template<typename HCS,typename HS,typename S> using WilsonCompressor = WilsonCom
// Fast comms buffer manipulation which should inline right through (avoid direction
// dependent logic that prevents inlining
template<class vobj,class cobj>
class WilsonStencil : public CartesianStencil<vobj,cobj> {
template<class vobj,class cobj,class Parameters>
class WilsonStencil : public CartesianStencil<vobj,cobj,Parameters> {
public:
typedef CartesianStencil<vobj,cobj> Base;
typedef CartesianStencil<vobj,cobj,Parameters> Base;
typedef typename Base::View_type View_type;
typedef typename Base::StencilVector StencilVector;
@ -286,8 +286,8 @@ public:
int npoints,
int checkerboard,
const std::vector<int> &directions,
const std::vector<int> &distances)
: CartesianStencil<vobj,cobj> (grid,npoints,checkerboard,directions,distances)
const std::vector<int> &distances,Parameters p)
: CartesianStencil<vobj,cobj,Parameters> (grid,npoints,checkerboard,directions,distances,p)
{
ZeroCountersi();
surface_list.resize(0);

View File

@ -51,9 +51,9 @@ WilsonFermion<Impl>::WilsonFermion(GaugeField &_Umu, GridCartesian &Fgrid,
Kernels(p),
_grid(&Fgrid),
_cbgrid(&Hgrid),
Stencil(&Fgrid, npoint, Even, directions, displacements),
StencilEven(&Hgrid, npoint, Even, directions,displacements), // source is Even
StencilOdd(&Hgrid, npoint, Odd, directions,displacements), // source is Odd
Stencil(&Fgrid, npoint, Even, directions, displacements,p),
StencilEven(&Hgrid, npoint, Even, directions,displacements,p), // source is Even
StencilOdd(&Hgrid, npoint, Odd, directions,displacements,p), // source is Odd
mass(_mass),
Lebesgue(_grid),
LebesgueEvenOdd(_cbgrid),

View File

@ -55,9 +55,9 @@ WilsonFermion5D<Impl>::WilsonFermion5D(GaugeField &_Umu,
_FiveDimRedBlackGrid(&FiveDimRedBlackGrid),
_FourDimGrid (&FourDimGrid),
_FourDimRedBlackGrid(&FourDimRedBlackGrid),
Stencil (_FiveDimGrid,npoint,Even,directions,displacements),
StencilEven(_FiveDimRedBlackGrid,npoint,Even,directions,displacements), // source is Even
StencilOdd (_FiveDimRedBlackGrid,npoint,Odd ,directions,displacements), // source is Odd
Stencil (_FiveDimGrid,npoint,Even,directions,displacements,p),
StencilEven(_FiveDimRedBlackGrid,npoint,Even,directions,displacements,p), // source is Even
StencilOdd (_FiveDimRedBlackGrid,npoint,Odd ,directions,displacements,p), // source is Odd
M5(_M5),
Umu(_FourDimGrid),
UmuEven(_FourDimRedBlackGrid),

View File

@ -94,7 +94,7 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
distance = st._distances[DIR]; \
sl = st._simd_layout[direction]; \
inplace_twist = 0; \
if(SE->_around_the_world && st.twists[DIR % 4]){ \
if(SE->_around_the_world && st.parameters.twists[DIR % 4]){ \
if(sl == 1){ \
g = (F+1) % 2; \
}else{ \

View File

@ -47,7 +47,7 @@ private:
const unsigned int N = Impl::Group::Dimension;
typedef typename Field::vector_object vobj;
typedef CartesianStencil<vobj, vobj> Stencil;
typedef CartesianStencil<vobj, vobj,int> Stencil;
SimpleCompressor<vobj> compressor;
int npoint = 2 * Ndim;
@ -82,7 +82,7 @@ public:
virtual RealD S(const Field &p)
{
assert(p.Grid()->Nd() == Ndim);
static Stencil phiStencil(p.Grid(), npoint, 0, directions, displacements);
static Stencil phiStencil(p.Grid(), npoint, 0, directions, displacements,0);
phiStencil.HaloExchange(p, compressor);
Field action(p.Grid()), pshift(p.Grid()), phisquared(p.Grid());
phisquared = p * p;
@ -133,7 +133,7 @@ public:
double interm_t = usecond();
// move this outside
static Stencil phiStencil(p.Grid(), npoint, 0, directions, displacements);
static Stencil phiStencil(p.Grid(), npoint, 0, directions, displacements,0);
phiStencil.HaloExchange(p, compressor);
double halo_t = usecond();

View File

@ -111,7 +111,7 @@ struct StencilEntry {
};
// Could pack to 8 + 4 + 4 = 128 bit and use
template<class vobj,class cobj>
template<class vobj,class cobj,class Parameters>
class CartesianStencilView {
public:
typedef AcceleratorVector<int,STENCIL_MAX> StencilVector;
@ -128,7 +128,7 @@ class CartesianStencilView {
StencilVector _permute_type;
StencilVector same_node;
Coordinate _simd_layout;
Coordinate twists;
Parameters parameters;
StencilEntry* _entries_p;
cobj* u_recv_buf_p;
cobj* u_send_buf_p;
@ -170,14 +170,14 @@ class CartesianStencilView {
////////////////////////////////////////
// The Stencil Class itself
////////////////////////////////////////
template<class vobj,class cobj>
class CartesianStencil : public CartesianStencilView<vobj,cobj> { // Stencil runs along coordinate axes only; NO diagonal fill in.
template<class vobj,class cobj,class Parameters>
class CartesianStencil : public CartesianStencilView<vobj,cobj,Parameters> { // Stencil runs along coordinate axes only; NO diagonal fill in.
public:
typedef typename cobj::vector_type vector_type;
typedef typename cobj::scalar_type scalar_type;
typedef typename cobj::scalar_object scalar_object;
typedef CartesianStencilView<vobj,cobj> View_type;
typedef CartesianStencilView<vobj,cobj,Parameters> View_type;
typedef typename View_type::StencilVector StencilVector;
///////////////////////////////////////////
// Helper structs
@ -209,11 +209,18 @@ protected:
public:
GridBase *Grid(void) const { return _grid; }
////////////////////////////////////////////////////////////////////////
// Needed to conveniently communicate gparity parameters into GPU memory
// without adding parameters. Perhaps a template parameter to StenciView is
// required to pass general parameters.
// Generalise as required later if needed
////////////////////////////////////////////////////////////////////////
View_type View(void) const {
View_type accessor(*( (View_type *) this));
return accessor;
}
int face_table_computed;
std::vector<Vector<std::pair<int,int> > > face_table ;
std::vector<int> surface_list;
@ -599,7 +606,8 @@ public:
int npoints,
int checkerboard,
const std::vector<int> &directions,
const std::vector<int> &distances)
const std::vector<int> &distances,
Parameters p)
: comm_bytes_thr(npoints),
comm_enter_thr(npoints),
comm_leave_thr(npoints),
@ -607,7 +615,7 @@ public:
{
face_table_computed=0;
_grid = grid;
this->parameters=p;
/////////////////////////////////////
// Initialise the base
/////////////////////////////////////

View File

@ -80,7 +80,7 @@ int main(int argc, char ** argv) {
Foo=lex;
}
typedef CartesianStencil<vobj,vobj> Stencil;
typedef CartesianStencil<vobj,vobj,int> Stencil;
for(int dir=0;dir<4;dir++){
for(int disp=0;disp<Fine._fdimensions[dir];disp++){
@ -90,7 +90,7 @@ int main(int argc, char ** argv) {
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
Stencil myStencil(&Fine,npoint,0,directions,displacements);
Stencil myStencil(&Fine,npoint,0,directions,displacements,0);
Coordinate ocoor(4);
for(int o=0;o<Fine.oSites();o++){
Fine.oCoorFromOindex(ocoor,o);
@ -181,8 +181,8 @@ int main(int argc, char ** argv) {
std::vector<int> directions(npoint,dir);
std::vector<int> displacements(npoint,disp);
Stencil EStencil(&rbFine,npoint,Even,directions,displacements);
Stencil OStencil(&rbFine,npoint,Odd,directions,displacements);
Stencil EStencil(&rbFine,npoint,Even,directions,displacements,0);
Stencil OStencil(&rbFine,npoint,Odd,directions,displacements,0);
Coordinate ocoor(4);
for(int o=0;o<Fine.oSites();o++){

View File

@ -73,7 +73,7 @@ int main (int argc, char ** argv)
////////////////////////////////////
// Modify the gauge field a little
////////////////////////////////////
RealD dt = 0.001;
RealD dt = 0.01;
LatticeColourMatrix mommu(&Grid);
LatticeColourMatrix forcemu(&Grid);
@ -122,7 +122,7 @@ int main (int argc, char ** argv)
std::cout << GridLogMessage << " Sprime "<<Sprime<<std::endl;
std::cout << GridLogMessage << "dS "<<Sprime-S<<std::endl;
std::cout << GridLogMessage << "pred dS "<< dSpred <<std::endl;
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-2 ) ;
assert( fabs(real(Sprime-S-dSpred)) < 1.0e-1 ) ;
std::cout<< GridLogMessage << "Done" <<std::endl;
Grid_finalize();
}

View File

@ -100,7 +100,7 @@ int main (int argc, char ** argv)
////////////////////////////////////
// Modify the gauge field a little
////////////////////////////////////
RealD dt = 0.0001;
RealD dt = 0.001;
LatticeColourMatrix mommu(UGrid);
LatticeColourMatrix forcemu(UGrid);

View File

@ -48,7 +48,7 @@ int main (int argc, char ** argv)
Coordinate split_coor (mpi_layout.size(),1);
Coordinate split_dim (mpi_layout.size(),1);
std::vector<ComplexD> boundary_phases(Nd,1.);
std::vector<Complex> boundary_phases(Nd,1.);
boundary_phases[Nd-1]=-1.;
params.boundary_phases = boundary_phases;

View File

@ -47,7 +47,7 @@ int main (int argc, char ** argv)
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
std::vector<ComplexD> boundary_phases(Nd,1.);
std::vector<Complex> boundary_phases(Nd,1.);
boundary_phases[Nd-1]=-1.;
params.boundary_phases = boundary_phases;

View File

@ -47,7 +47,7 @@ int main (int argc, char ** argv)
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
std::vector<ComplexD> boundary_phases(Nd,1.);
std::vector<Complex> boundary_phases(Nd,1.);
boundary_phases[Nd-1]=-1.;
params.boundary_phases = boundary_phases;

View File

@ -47,7 +47,7 @@ int main (int argc, char ** argv)
auto simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
auto mpi_layout = GridDefaultMpi();
std::vector<ComplexD> boundary_phases(Nd,1.);
std::vector<Complex> boundary_phases(Nd,1.);
boundary_phases[Nd-1]=-1.;
params.boundary_phases = boundary_phases;