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

Gparity modifications in the Gparity compressor variant.

This commit is contained in:
Peter Boyle 2015-08-11 06:22:20 +01:00
parent 84a66476ab
commit 0a9ebac514
2 changed files with 46 additions and 9 deletions

View File

@ -8,7 +8,7 @@ class SimpleCompressor {
public:
void Point(int) {};
vobj operator() (const vobj &arg) {
vobj operator() (const vobj &arg,int dimension,int plane,int osite,GridBase *grid) {
return arg;
}
};
@ -24,7 +24,7 @@ Gather_plane_simple (const Lattice<vobj> &rhs,std::vector<cobj,alignedAllocator<
if ( !rhs._grid->CheckerBoarded(dimension) ) {
cbmask = 0x3;
}
int so = plane*rhs._grid->_ostride[dimension]; // base offset for start of plane
int e1=rhs._grid->_slice_nblock[dimension];
@ -36,7 +36,7 @@ PARALLEL_NESTED_LOOP2
int bo = n*rhs._grid->_slice_block[dimension];
int ocb=1<<rhs._grid->CheckerBoardFromOindex(o+b);// Could easily be a table lookup
if ( ocb &cbmask ) {
buffer[bo+b]=compress(rhs._odata[so+o+b]);
buffer[bo+b]=compress(rhs._odata[so+o+b],dimension,plane,so+o+b,rhs._grid);
}
}
}
@ -69,7 +69,7 @@ PARALLEL_NESTED_LOOP2
int ocb=1<<rhs._grid->CheckerBoardFromOindex(o+b);
if ( ocb & cbmask ) {
cobj temp;
temp =compress(rhs._odata[so+o+b]);
temp =compress(rhs._odata[so+o+b],dimension,plane,so+o+b,rhs._grid);
extract<cobj>(temp,pointers,offset);
}
}

View File

@ -19,7 +19,7 @@ namespace QCD {
mu=p;
};
virtual SiteHalfSpinor operator () (const SiteSpinor &in) {
virtual SiteHalfSpinor operator () (const SiteSpinor &in,int dim,int plane,int osite,GridBase *grid) {
return spinproject(in);
}
@ -67,13 +67,50 @@ namespace QCD {
template<class SiteHalfSpinor,class SiteSpinor>
class GparityWilsonCompressor : public WilsonCompressor<SiteHalfSpinor,SiteSpinor>{
public:
GparityWilsonCompressor(int _dag) : WilsonCompressor<SiteHalfSpinor,SiteSpinor> (_dag){};
SiteHalfSpinor operator () (const SiteSpinor &in)
SiteHalfSpinor operator () (const SiteSpinor &in,int dim,int plane,int osite,GridBase *grid)
{
SiteHalfSpinor tmp = spinproject(in);
if( 0 ) tmp = flavourflip(tmp);
std::vector<int> Gbcs({1,0,0,0});
typedef typename SiteHalfSpinor::scalar_object scalar_object;
const int Nsimd = grid->Nsimd();
int ocb=grid->CheckerBoardFromOindex(osite);
SiteHalfSpinor tmp = spinproject(in); // spin projected
//////////////////////////////////////////////////////////////
// Check whether we must flavour flip
// do this if source is plane 0 on processor 0 in dimension dim
//////////////////////////////////////////////////////////////
if ( (this->mu==Xp)||(this->mu==Yp)||(this->mu==Zp)||(this->mu==Tp) ) {
if ( Gbcs[this->mu] && (grid->_processor_coor[dim] == 0) && (plane==0) && (ocb==0) ) {
std::vector<scalar_object> flat(Nsimd);
extract(tmp,flat);
for(int i=0;i<Nsimd;i++) {
std::vector<int> coor;
grid->iCoorFromIindex(coor,i);
if ( coor[dim]==0 ) {
scalar_object stmp;
stmp(0) = flat[i](1);
stmp(1) = flat[i](0);
flat[i] = stmp;
}
}
merge(tmp,flat);
} // coor & bc guard
} // shift guard
return tmp;
}