mirror of
https://github.com/paboyle/Grid.git
synced 2025-10-22 08:44:48 +01:00
Staples work in icoso-plane
This commit is contained in:
@@ -177,7 +177,7 @@ public:
|
||||
|
||||
if( (pcoor[xdim]==pgrid[xdim]-1) && (pcoor[ydim]==0) && (pcoor[Ndm1]==0) ){
|
||||
hasSouthPole =1;
|
||||
southPoleOsite=this->_osites;
|
||||
southPoleOsite=this->_osites;
|
||||
southPoleOsites=OrthogSize;
|
||||
this->_osites += OrthogSize;
|
||||
} else {
|
||||
@@ -195,11 +195,11 @@ public:
|
||||
northPoleOsites=0;
|
||||
northPoleOsite=0;
|
||||
}
|
||||
std::cout << "Icosahedral vertex field volume " << this->_osites<<std::endl;
|
||||
std::cout << "Icosahedral south pole offset " << this->southPoleOsite<<std::endl;
|
||||
std::cout << "Icosahedral north pole offset " << this->northPoleOsite<<std::endl;
|
||||
std::cout << "Icosahedral south pole size " << this->southPoleOsites<<std::endl;
|
||||
std::cout << "Icosahedral north pole size " << this->northPoleOsites<<std::endl;
|
||||
std::cout << GridLogDebug<<"Icosahedral vertex field volume " << this->_osites<<std::endl;
|
||||
std::cout << GridLogDebug<<"Icosahedral south pole offset " << this->southPoleOsite<<std::endl;
|
||||
std::cout << GridLogDebug<<"Icosahedral north pole offset " << this->northPoleOsite<<std::endl;
|
||||
std::cout << GridLogDebug<<"Icosahedral south pole size " << this->southPoleOsites<<std::endl;
|
||||
std::cout << GridLogDebug<<"Icosahedral north pole size " << this->northPoleOsites<<std::endl;
|
||||
};
|
||||
|
||||
};
|
||||
|
@@ -252,7 +252,7 @@ inline std::ostream& operator<< (std::ostream& stream, const vComplexF &o){
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& stream, const vComplexD &o){
|
||||
int nn=vComplexD::Nsimd();
|
||||
std::vector<ComplexD,alignedAllocator<ComplexD> > buf(nn);
|
||||
std::vector<ComplexD> buf(nn);
|
||||
vstore(o,&buf[0]);
|
||||
stream<<"<";
|
||||
for(int i=0;i<nn;i++){
|
||||
@@ -272,7 +272,7 @@ inline std::ostream& operator<< (std::ostream& stream, const vComplexD2 &o){
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& stream, const vRealF &o){
|
||||
int nn=vRealF::Nsimd();
|
||||
std::vector<RealF,alignedAllocator<RealF> > buf(nn);
|
||||
std::vector<RealF> buf(nn);
|
||||
vstore(o,&buf[0]);
|
||||
stream<<"<";
|
||||
for(int i=0;i<nn;i++){
|
||||
|
@@ -208,7 +208,7 @@ public:
|
||||
if ( north ) {
|
||||
NbrCoor[0] = L-1-Coor[1];
|
||||
NbrCoor[1] = L-1;
|
||||
NbrCoor[nd-1]=periAdd(HemiPatch,+1,HemiPatches) + SouthernHemisphere;
|
||||
NbrCoor[nd-1]=periAdd(HemiPatch,-1,HemiPatches) + NorthernHemisphere;
|
||||
return;
|
||||
}
|
||||
assert(0);
|
||||
@@ -376,17 +376,17 @@ public:
|
||||
// Check going Up, forward in X and forward Diag match; subtleties at poles and rotation in cross patch
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::cout << "*************************************"<<std::endl;
|
||||
std::cout << " Icosahedral Stencil Geometry Test !"<<std::endl;
|
||||
std::cout << "*************************************"<<std::endl;
|
||||
std::cout << GridLogMessage<< "*************************************"<<std::endl;
|
||||
std::cout << GridLogMessage<< " Icosahedral Stencil Geometry Test !"<<std::endl;
|
||||
std::cout << GridLogMessage<< "*************************************"<<std::endl;
|
||||
|
||||
const int triangle_ref = cart_sites;
|
||||
std::cout << " Base triangle count for each type " <<triangle_ref;
|
||||
std::cout << GridLogMessage<< " Base triangle count for each type " <<triangle_ref;
|
||||
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << "testing +x+y vs +diag"<<std::endl;
|
||||
std::cout << "testing +y+x vs +diag"<<std::endl;
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "testing +x+y vs +diag"<<std::endl;
|
||||
std::cout << GridLogMessage<< "testing +y+x vs +diag"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
int xyd_pole_count=0;
|
||||
int xyd_count=0;
|
||||
int yxd_pole_count=0;
|
||||
@@ -431,10 +431,10 @@ public:
|
||||
}
|
||||
|
||||
if(isPole) {
|
||||
std::cout << "Forward xyd triangle "<<Coor<<"-Pole["<<XpCoor[2]<<"]-"<<YpXpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
std::cout << GridLogDebug<<"Forward xyd triangle "<<Coor<<"-Pole["<<XpCoor[2]<<"]-"<<YpXpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
xyd_pole_count++;
|
||||
} else {
|
||||
std::cout << "Forward xyd triangle "<<Coor<<"-"<<XpCoor<<"-"<<YpXpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
std::cout << GridLogDebug<<"Forward xyd triangle "<<Coor<<"-"<<XpCoor<<"-"<<YpXpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
xyd_count++;
|
||||
}
|
||||
for(int d=0;d<DiagCoor.size();d++) {
|
||||
@@ -459,23 +459,23 @@ public:
|
||||
|
||||
if(isPole) {
|
||||
yxd_pole_count++;
|
||||
std::cout << "Forward yxd triangle "<<Coor<<"-Pole["<<YpCoor[2]<<"]-"<<XpYpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
std::cout << GridLogDebug<<"Forward yxd triangle "<<Coor<<"-Pole["<<YpCoor[2]<<"]-"<<XpYpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
} else {
|
||||
yxd_count++;
|
||||
std::cout << "Forward yxd triangle "<<Coor<<"-"<<YpCoor<<"-"<<XpYpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
std::cout <<GridLogDebug << "Forward yxd triangle "<<Coor<<"-"<<YpCoor<<"-"<<XpYpCoor<<" should be " <<DiagCoor<<std::endl;
|
||||
}
|
||||
for(int d=0;d<DiagCoor.size();d++) {
|
||||
assert(DiagCoor[d]==XpYpCoor[d]);
|
||||
}
|
||||
}
|
||||
std::cout << " xyd_count "<<xyd_count<<" + poles_count "<<xyd_pole_count<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout << " yxd_count "<<yxd_count<<" + poles_count "<<yxd_pole_count<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout << GridLogMessage<< " xyd_count "<<xyd_count<<" + poles_count "<<xyd_pole_count<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout << GridLogMessage<<" yxd_count "<<yxd_count<<" + poles_count "<<yxd_pole_count<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
assert(xyd_count+xyd_pole_count == triangle_ref);
|
||||
assert(yxd_count+yxd_pole_count == triangle_ref);
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << "testing -diag +x+y = identity"<<std::endl;
|
||||
std::cout << "testing -diag +y+x = identity"<<std::endl;
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "testing -diag +x+y = identity"<<std::endl;
|
||||
std::cout << GridLogMessage<< "testing -diag +y+x = identity"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
|
||||
int dmxy_count=0;
|
||||
int dmyx_count=0;
|
||||
@@ -503,7 +503,7 @@ public:
|
||||
Coordinate DmCoor;
|
||||
GetNbrForMinusDiagonal(grid,Coor,DmCoor,missingLink);
|
||||
if ( missingLink ) {
|
||||
std::cout << Coor << " has no backwards diagonal link "<<std::endl;
|
||||
std::cout << GridLogDebug<< Coor << " has no backwards diagonal link "<<std::endl;
|
||||
num_missing++;
|
||||
} else {
|
||||
|
||||
@@ -542,35 +542,35 @@ public:
|
||||
dmxy_count++;
|
||||
dmyx_count++;
|
||||
}
|
||||
std::cout << Coor<<" DmXpYp triangle YpXpDm"<<YpXpDmCoor<<"-XpDm"<<XpDmCoor<<"-Dm"<<DmCoor<<" should be " <<Coor<<std::endl;
|
||||
std::cout<< GridLogDebug << Coor<<" DmXpYp triangle YpXpDm"<<YpXpDmCoor<<"-XpDm"<<XpDmCoor<<"-Dm"<<DmCoor<<" should be " <<Coor<<std::endl;
|
||||
for(int d=0;d<Coor.size();d++) {
|
||||
assert(Coor[d]==YpXpDmCoor[d]);
|
||||
}
|
||||
|
||||
std::cout << Coor<<"DmXpYp triangle XpYpDm"<<XpYpDmCoor<<"-YpDm"<<YpDmCoor<<"-Dm"<<DmCoor<<" should be " <<Coor<<std::endl;
|
||||
std::cout << GridLogDebug<< Coor<<"DmXpYp triangle XpYpDm"<<XpYpDmCoor<<"-YpDm"<<YpDmCoor<<"-Dm"<<DmCoor<<" should be " <<Coor<<std::endl;
|
||||
for(int d=0;d<Coor.size();d++) {
|
||||
assert(Coor[d]==XpYpDmCoor[d]);
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout << " dmxy_count "<<dmxy_count<<" + special "<<dmxy_count_special<<" + missing "<<num_missing<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout << " dmyx_count "<<dmyx_count<<" + special "<<dmyx_count_special<<" + missing "<<num_missing<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout <<GridLogMessage<<" dmxy_count "<<dmxy_count<<" + special "<<dmxy_count_special<<" + missing "<<num_missing<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
std::cout <<GridLogMessage<<" dmyx_count "<<dmyx_count<<" + special "<<dmyx_count_special<<" + missing "<<num_missing<<" expect "<<triangle_ref<<" triangles "<<std::endl;
|
||||
assert(dmxy_count + dmxy_count_special + num_missing == triangle_ref);
|
||||
assert(dmyx_count + dmyx_count_special + num_missing == triangle_ref);
|
||||
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << "testing diag -x-y = identity "<<std::endl;
|
||||
std::cout << "testing diag -y-x = identity"<<std::endl;
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "NOT testing diag -x-y = identity "<<std::endl;
|
||||
std::cout << GridLogMessage<< "NOT testing diag -y-x = identity"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << "testing -diag = -x-y "<<std::endl;
|
||||
std::cout << "testing -diag = -y-x "<<std::endl;
|
||||
std::cout << "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
std::cout << GridLogMessage<< "NOT testing -diag = -x-y "<<std::endl;
|
||||
std::cout << GridLogMessage<< "NOT testing -diag = -y-x "<<std::endl;
|
||||
std::cout << GridLogMessage<< "------------------------------------"<<std::endl;
|
||||
|
||||
std::cout << "*************************************"<<std::endl;
|
||||
std::cout << " Icosahedral Stencil Geometry Test Complete"<<std::endl;
|
||||
std::cout << "*************************************"<<std::endl;
|
||||
std::cout << GridLogMessage<< "*************************************"<<std::endl;
|
||||
std::cout << GridLogMessage<< " Icosahedral Stencil Geometry Test Complete"<<std::endl;
|
||||
std::cout << GridLogMessage<< "*************************************"<<std::endl;
|
||||
}
|
||||
IcosahedralStencil(GridBase *grid) // Must be +1 or -1
|
||||
{
|
||||
@@ -581,14 +581,181 @@ public:
|
||||
void NearestNeighbourStencil(void)
|
||||
{
|
||||
GridBase * grid = this->_grid;
|
||||
assert(grid->isIcosahedralVertex());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* For gauge action implementation
|
||||
*/
|
||||
int isVertex = grid->isIcosahedralVertex();
|
||||
|
||||
int osites = grid->oSites();
|
||||
|
||||
uint64_t cart_sites = grid->CartesianOsites();
|
||||
uint64_t Npole_sites = grid->NorthPoleOsites();
|
||||
uint64_t Spole_sites = grid->SouthPoleOsites();
|
||||
Coordinate pcoor = grid->ThisProcessorCoor();
|
||||
Coordinate pgrid = grid->ProcessorGrid();
|
||||
/*
|
||||
* resize the stencil entries array and set npoints
|
||||
*/
|
||||
const int np=6;
|
||||
this->_npoints=np; // Move to template param?
|
||||
this->_entries.resize(this->_npoints * cart_sites);
|
||||
this->_entries_p = &_entries[0];
|
||||
|
||||
for(uint64_t site=0;site<cart_sites; site ++) {
|
||||
|
||||
Coordinate Coor;
|
||||
Coordinate NbrCoor;
|
||||
|
||||
int nd = grid->Nd();
|
||||
int L = grid->LocalDimensions()[0];
|
||||
|
||||
Integer lexXp = site*np ;
|
||||
Integer lexYp = site*np+1;
|
||||
Integer lexDp = site*np+2;
|
||||
Integer lexXm = site*np+3;
|
||||
Integer lexYm = site*np+4;
|
||||
Integer lexDm = site*np+5;
|
||||
|
||||
IcosahedralStencilEntry SE;
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// Outer index of neighbour Offset calculation
|
||||
////////////////////////////////////////////////
|
||||
grid->oCoorFromOindex(Coor,site);
|
||||
NbrCoor = Coor;
|
||||
assert( grid->LocalDimensions()[1]==grid->LocalDimensions()[0]);
|
||||
assert( grid->_simd_layout[0]==1); // Cannot vectorise in these dims
|
||||
assert( grid->_simd_layout[1]==1);
|
||||
assert( grid->_processors[0]==1); // Cannot mpi distribute in these dims
|
||||
assert( grid->_processors[1]==1);
|
||||
|
||||
int Patch = Coor[nd-1];
|
||||
int HemiPatch = Patch%HemiPatches;
|
||||
int north = Patch/HemiPatches;
|
||||
int south = 1-north;
|
||||
int isPoleY;
|
||||
int isPoleX;
|
||||
int missingLink;
|
||||
assert(Patch<IcosahedralPatches);
|
||||
assert((north==1)||(south==1));
|
||||
|
||||
/*
|
||||
* Just get all six neighbours (if present).
|
||||
*/
|
||||
Coordinate XpCoor;
|
||||
Coordinate YpCoor;
|
||||
Coordinate DpCoor;
|
||||
Coordinate XmCoor;
|
||||
Coordinate YmCoor;
|
||||
Coordinate DmCoor;
|
||||
|
||||
GetNbrForPlusDiagonal(grid,Coor,DpCoor);
|
||||
GetNbrForPlusX(grid,Coor,XpCoor,isPoleX);
|
||||
GetNbrForPlusY(grid,Coor,YpCoor,isPoleY);
|
||||
|
||||
GetNbrForMinusDiagonal(grid,Coor,DmCoor,missingLink);
|
||||
GetNbrForMinusX(grid,Coor,XmCoor);
|
||||
GetNbrForMinusY(grid,Coor,YmCoor);
|
||||
|
||||
int DpPatch = DpCoor[nd-1];
|
||||
int DpHemiPatch = DpCoor[nd-1]%HemiPatches;
|
||||
int DpHemisphere = DpCoor[nd-1]/HemiPatches;
|
||||
|
||||
int YpHemiPatch = YpCoor[nd-1]%HemiPatches;
|
||||
int XpHemiPatch = XpCoor[nd-1]%HemiPatches;
|
||||
// For negative direction cannot use the Diagonal link
|
||||
// as this may not be present on the 5-points
|
||||
// Makes for a hemisphere dependent behaviour
|
||||
int XmHemiPatch = XmCoor[nd-1]%HemiPatches;
|
||||
int XmHemisphere = XmCoor[nd-1]/HemiPatches;
|
||||
int YmHemiPatch = YmCoor[nd-1]%HemiPatches;
|
||||
int YmHemisphere = YmCoor[nd-1]/HemiPatches;
|
||||
|
||||
if ( isVertex ) assert(0);
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// XpCoor stencil entry
|
||||
// Store in look up table
|
||||
////////////////////////////////////////////////
|
||||
// Basis rotates dictates BOTH adjoint and polarisation
|
||||
// Could reduce the amount of information stored here
|
||||
SE._adjoint = false;
|
||||
SE._is_local = true;
|
||||
SE._missing_link = false;
|
||||
if ( DpHemiPatch != HemiPatch && south ) {
|
||||
SE._offset = grid->oIndex(DpCoor);
|
||||
SE._polarisation = IcosahedronPatchX;
|
||||
SE._adjoint = true;
|
||||
} else {
|
||||
SE._offset = grid->oIndex(XpCoor);
|
||||
SE._polarisation = IcosahedronPatchY;
|
||||
}
|
||||
acceleratorPut(this->_entries[lexXp],SE);
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// for YpCoor
|
||||
////////////////////////////////////////////////
|
||||
SE._adjoint = false;
|
||||
SE._is_local = true;
|
||||
SE._missing_link = false;
|
||||
if ( YpHemiPatch != HemiPatch && north ) {
|
||||
SE._offset = grid->oIndex(DpCoor);
|
||||
SE._polarisation = IcosahedronPatchY;
|
||||
SE._adjoint = true;
|
||||
} else {
|
||||
SE._offset = grid->oIndex(YpCoor);
|
||||
SE._polarisation = IcosahedronPatchX;
|
||||
}
|
||||
acceleratorPut(this->_entries[lexYp],SE);
|
||||
|
||||
SE._adjoint = false;
|
||||
SE._is_local = true;
|
||||
SE._missing_link = false;
|
||||
////////////////////////////////////////////////
|
||||
// XmCoor stencil entry
|
||||
// Store in look up table
|
||||
////////////////////////////////////////////////
|
||||
if ( XmHemiPatch != HemiPatch && north ) {
|
||||
SE._offset = grid->oIndex(XmCoor);
|
||||
SE._polarisation = IcosahedronPatchY; // nbrs Y instead of diagonal in North hemisphere exceptional case
|
||||
} else {
|
||||
SE._offset = grid->oIndex(XmCoor);
|
||||
SE._polarisation = IcosahedronPatchDiagonal;
|
||||
}
|
||||
acceleratorPut(this->_entries[lexXm],SE);
|
||||
|
||||
////////////////////////////////////////////////
|
||||
// for YmCoor
|
||||
////////////////////////////////////////////////
|
||||
if ( YmHemiPatch != HemiPatch && south ) {
|
||||
SE._offset = grid->oIndex(YmCoor);
|
||||
SE._polarisation = IcosahedronPatchX; // Basis rotates
|
||||
} else {
|
||||
SE._offset = grid->oIndex(YmCoor);
|
||||
SE._polarisation = IcosahedronPatchDiagonal;
|
||||
}
|
||||
acceleratorPut(this->_entries[lexYm],SE);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// for DpCoor ; never needed for staples, only for vertex diff ops
|
||||
// no polarisation rotation
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
SE._offset = grid->oIndex(DpCoor);
|
||||
SE._polarisation = IcosahedronPatchDiagonal; // should ignore
|
||||
acceleratorPut(this->_entries[lexDp],SE);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// for DmCoor ; never needed for staples, only for vertex diff ops
|
||||
// no polarisation rotation
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
SE._offset = grid->oIndex(DmCoor);
|
||||
SE._polarisation = IcosahedronPatchDiagonal; // should ignore
|
||||
SE._missing_link = missingLink;
|
||||
acceleratorPut(this->_entries[lexDm],SE);
|
||||
}
|
||||
}
|
||||
/*************************************************************
|
||||
* For gauge action implementation
|
||||
*************************************************************
|
||||
*/
|
||||
void FaceStencil(void)
|
||||
{
|
||||
GridBase * grid = this->_grid;
|
||||
@@ -671,10 +838,10 @@ public:
|
||||
GetNbrForPlusX(grid,Coor,XpCoor,isPoleX);
|
||||
GetNbrForPlusY(grid,Coor,YpCoor,isPoleY);
|
||||
|
||||
int XpHemiPatch = XpCoor[nd-1]%HemiPatches;
|
||||
int XpHemisphere = XpCoor[nd-1]/HemiPatches;
|
||||
// int XpHemiPatch = XpCoor[nd-1]%HemiPatches;
|
||||
// int XpHemisphere = XpCoor[nd-1]/HemiPatches;
|
||||
|
||||
int DpPatch = DpCoor[nd-1];
|
||||
int DpPatch = DpCoor[nd-1];
|
||||
int DpHemiPatch = DpCoor[nd-1]%HemiPatches;
|
||||
int DpHemisphere = DpCoor[nd-1]/HemiPatches;
|
||||
|
||||
@@ -700,10 +867,12 @@ public:
|
||||
////////////////////////////////////////////////
|
||||
acceleratorPut(this->_entries[lexXY],SE);
|
||||
|
||||
// failed in the if case here
|
||||
////////////////////////////////////////////////
|
||||
// for trace [ U_y(z) adj(U_d(z)) U_x(z+\hat y) ]
|
||||
// for trace [ U_y(z) U_x(z+\hat y) adj(U_d(z)) ]
|
||||
////////////////////////////////////////////////
|
||||
if ( DpHemiPatch != HemiPatch && north ) {
|
||||
int YpHemiPatch = YpCoor[nd-1]%HemiPatches;
|
||||
if ( YpHemiPatch != HemiPatch && north ) {
|
||||
SE._offset = grid->oIndex(DpCoor);
|
||||
SE._is_local = true;
|
||||
SE._polarisation = IcosahedronPatchY;
|
||||
@@ -722,7 +891,6 @@ public:
|
||||
acceleratorPut(this->_entries[lexYX],SE);
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* For gauge action derivative implementation
|
||||
* Staple
|
||||
@@ -739,30 +907,7 @@ public:
|
||||
* There is no complex rotation of links on other site
|
||||
*
|
||||
* Case2: I x I loops
|
||||
*
|
||||
* Y staple: need
|
||||
* Diag @ (xy)
|
||||
* X @ y++ ; care needed for rotation
|
||||
* Diag @ x-- ; care needed for rotation
|
||||
* X @ x-- ; care needed for rotation
|
||||
*
|
||||
* X staple: need
|
||||
* Diag @ (xy)
|
||||
* X @ y++ ; care needed for rotation
|
||||
* Diag @ x-- ; care needed for rotation
|
||||
* X @ x-- ; care needed for rotation
|
||||
*
|
||||
* Diag staple: need
|
||||
*
|
||||
* X@ (xy)
|
||||
* Y@ x++ ; care needed for rotation
|
||||
* Y@ (xy)
|
||||
* X@ y++ ; care needed for rotation
|
||||
* Just use a general 6 point stencil and cherry pick terms
|
||||
*/
|
||||
void StapleDiagStencil(void){ }
|
||||
void StapleXpStencil(void) { }
|
||||
void StapleYpStencil(void) { }
|
||||
void StapleTpStencil(void) { }
|
||||
|
||||
};
|
||||
NAMESPACE_END(Grid);
|
||||
|
@@ -229,9 +229,9 @@ void GridParseLayout(char **argv,int argc,
|
||||
}
|
||||
// Copy back into coordinate format
|
||||
int nd = mpi.size();
|
||||
std::cout << "mpi.size() "<<nd<<std::endl;
|
||||
std::cout << "latt.size() "<<latt.size()<<std::endl;
|
||||
std::cout << "Nd "<<Nd<<std::endl;
|
||||
// std::cout << "mpi.size() "<<nd<<std::endl;
|
||||
// std::cout << "latt.size() "<<latt.size()<<std::endl;
|
||||
// std::cout << "Nd "<<Nd<<std::endl;
|
||||
assert(latt.size()==nd);
|
||||
latt_c.resize(nd);
|
||||
mpi_c.resize(nd);
|
||||
|
@@ -69,11 +69,13 @@ public:
|
||||
GridBase *VertexGrid;
|
||||
GridBase *EdgeGrid;
|
||||
IcosahedralStencil FaceStencil;
|
||||
IcosahedralStencil NNStencil;
|
||||
|
||||
IcosahedralEdgeSupport(GridBase *_VertexGrid,GridBase *_EdgeGrid)
|
||||
: FaceStencil (EdgeGrid), VertexGrid(_VertexGrid), EdgeGrid(_EdgeGrid)
|
||||
: FaceStencil (EdgeGrid), NNStencil(EdgeGrid), VertexGrid(_VertexGrid), EdgeGrid(_EdgeGrid)
|
||||
{
|
||||
FaceStencil.FaceStencil();
|
||||
NNStencil.NearestNeighbourStencil(); // Vertex nearest neighbour
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -110,8 +112,10 @@ public:
|
||||
|
||||
coalescedWrite(plaq1_v[ss](),trace(Lx*L1*adj(Ld) ) );
|
||||
}
|
||||
|
||||
// for trace [ U_y(z) adj(U_d(z)) U_x(z+\hat y) ]
|
||||
|
||||
// This was wrong after GT
|
||||
// Could be EITHER the GT or the the plaq / stencil
|
||||
// for trace [ U_y(z) U_x(z+\hat y) adj(U_d(z)) ]
|
||||
{
|
||||
auto SE2 = stencil_v.GetEntry(1,ss);
|
||||
auto doAdj = SE2->_adjoint;
|
||||
@@ -120,17 +124,156 @@ public:
|
||||
auto L2 = Umu_v(s2)(pol);
|
||||
if(doAdj)
|
||||
L2 = adj(L2);
|
||||
|
||||
coalescedWrite(plaq2_v[ss](),trace(Ly*adj(Ld)*L2 ) );
|
||||
coalescedWrite(plaq2_v[ss](),trace(Ly*L2*adj(Ld) ) );
|
||||
// std::cout << "site "<< ss<<" plaq "<< plaq2_v[ss] << " doAdj "<< (int) doAdj<<" pol "<<(int) pol <<std::endl;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Staples for gauge force
|
||||
void IcosahedralStaples(GaugeField &Umu,
|
||||
GaugeLinkField &stapleXY,
|
||||
GaugeLinkField &stapleYX,
|
||||
GaugeLinkField &stapleXD,
|
||||
GaugeLinkField &stapleDX,
|
||||
GaugeLinkField &stapleYD,
|
||||
GaugeLinkField &stapleDY)
|
||||
{
|
||||
autoView(Umu_v,Umu,AcceleratorRead);
|
||||
autoView(stapleXY_v,stapleXY,AcceleratorWrite);
|
||||
autoView(stapleYX_v,stapleYX,AcceleratorWrite);
|
||||
autoView(stapleXD_v,stapleXD,AcceleratorWrite);
|
||||
autoView(stapleDX_v,stapleDX,AcceleratorWrite);
|
||||
autoView(stapleYD_v,stapleYD,AcceleratorWrite);
|
||||
autoView(stapleDY_v,stapleDY,AcceleratorWrite);
|
||||
autoView(stencil_v,NNStencil,AcceleratorRead);
|
||||
|
||||
const int np = NNStencil._npoints;
|
||||
|
||||
accelerator_for(ss,EdgeGrid->oSites(),vComplex::Nsimd(),{
|
||||
|
||||
const int ent_Xp = 0;
|
||||
const int ent_Yp = 1;
|
||||
const int ent_Xm = 3;
|
||||
const int ent_Ym = 4;
|
||||
|
||||
Integer lexXp = ss*np+ent_Xp;
|
||||
Integer lexYp = ss*np+ent_Yp;
|
||||
Integer lexXm = ss*np+ent_Xm;
|
||||
Integer lexYm = ss*np+ent_Ym;
|
||||
// Integer lexDp = ss*np+2; // Not touched by staples.
|
||||
// Integer lexDm = ss*np+5;
|
||||
|
||||
const int x = IcosahedronPatchX;
|
||||
const int y = IcosahedronPatchY;
|
||||
const int d = IcosahedronPatchDiagonal;
|
||||
|
||||
// Three forward links from this site
|
||||
auto Lx = Umu_v(ss)(x);
|
||||
auto Ly = Umu_v(ss)(y);
|
||||
auto Ld = Umu_v(ss)(d);
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Terms for the staple orthog to PlusDiagonal
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// adj( U_y(z+\hat x)) adj(U_x(z))
|
||||
{
|
||||
auto SE1 = stencil_v.GetEntry(ent_Xp,ss);
|
||||
auto doAdj = SE1->_adjoint;
|
||||
auto pol = SE1->_polarisation;
|
||||
auto s1 = SE1->_offset;
|
||||
auto Ly_at_xp = Umu_v(s1)(pol);
|
||||
if(doAdj)
|
||||
Ly_at_xp = adj(Ly_at_xp);
|
||||
coalescedWrite(stapleXY_v[ss](),adj(Ly_at_xp)*adj(Lx) );
|
||||
}
|
||||
// adj( U_y(z) ) adj(U_x(z+\hat y))
|
||||
{
|
||||
auto SE2 = stencil_v.GetEntry(ent_Yp,ss);
|
||||
auto doAdj = SE2->_adjoint;
|
||||
auto pol = SE2->_polarisation;
|
||||
auto s2 = SE2->_offset;
|
||||
auto Lx_at_yp = Umu_v(s2)(pol);
|
||||
if(doAdj)
|
||||
Lx_at_yp = adj(Lx_at_yp);
|
||||
|
||||
coalescedWrite(stapleYX_v[ss](),adj(Lx_at_yp)*adj(Ly) );
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Terms for the staple covering Xp : Dp Yp(x++) and Yp(y--) Dp(y--)
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// U_y(z+\hat x)*adj(U_d(z))
|
||||
{
|
||||
auto SE1 = stencil_v.GetEntry(ent_Xp,ss);
|
||||
auto doAdj = SE1->_adjoint;
|
||||
auto pol = SE1->_polarisation;
|
||||
auto s1 = SE1->_offset;
|
||||
auto Ly_at_xp = Umu_v(s1)(pol);
|
||||
if(doAdj)
|
||||
Ly_at_xp = adj(Ly_at_xp);
|
||||
coalescedWrite(stapleDY_v[ss](), Ly_at_xp *adj(Ld));
|
||||
}
|
||||
// adj(U_d(z-\hat y)) U_y(z-\hat y)
|
||||
{
|
||||
auto SE2 = stencil_v.GetEntry(ent_Ym,ss);
|
||||
auto doAdj = SE2->_adjoint;
|
||||
auto pol = SE2->_polarisation;
|
||||
auto s2 = SE2->_offset;
|
||||
int pol1 = IcosahedronPatchY;
|
||||
int pol2 = IcosahedronPatchDiagonal;
|
||||
if ( pol != IcosahedronPatchDiagonal ) {
|
||||
pol1 = IcosahedronPatchDiagonal;
|
||||
pol2 = IcosahedronPatchX;
|
||||
}
|
||||
auto Ly_at_ym = Umu_v(s2)(pol1);
|
||||
auto Ld_at_ym = Umu_v(s2)(pol2);
|
||||
coalescedWrite(stapleYD_v[ss](),adj(Ld_at_ym)*Ly_at_ym );
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Terms for the staple covering Yp : Dp Xp(y++) and Xp(x--) Dp(x--)
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// U_x(z+\hat y)adj(U_d(z))
|
||||
{
|
||||
auto SE1 = stencil_v.GetEntry(ent_Yp,ss);
|
||||
auto doAdj = SE1->_adjoint;
|
||||
auto pol = SE1->_polarisation;
|
||||
auto s1 = SE1->_offset;
|
||||
auto Lx_at_yp = Umu_v(s1)(pol);
|
||||
if(doAdj)
|
||||
Lx_at_yp = adj(Lx_at_yp);
|
||||
coalescedWrite(stapleDX_v[ss](),Lx_at_yp*adj(Ld) );
|
||||
}
|
||||
|
||||
// adj(U_d(z-\hat x))U_x(z-\hat x)
|
||||
{
|
||||
auto SE2 = stencil_v.GetEntry(ent_Xm,ss);
|
||||
auto doAdj = SE2->_adjoint;
|
||||
auto pol = SE2->_polarisation;
|
||||
auto s2 = SE2->_offset;
|
||||
int pol1 = IcosahedronPatchX;
|
||||
int pol2 = IcosahedronPatchDiagonal;
|
||||
if ( pol != IcosahedronPatchDiagonal ) {
|
||||
pol1 = IcosahedronPatchDiagonal;
|
||||
pol2 = IcosahedronPatchY;
|
||||
}
|
||||
auto Ly = Umu_v(ss)(IcosahedronPatchY);
|
||||
auto Lx_at_xm = Umu_v(s2)(pol1);
|
||||
auto Ld_at_xm = Umu_v(s2)(pol2);
|
||||
coalescedWrite(stapleXD_v[ss](),adj(Ld_at_xm)*Lx_at_xm );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* This routine is slow and single threaded on CPU
|
||||
*/
|
||||
void GaugeTransform(GaugeLinkField >, GaugeField &Umu)
|
||||
{
|
||||
assert(gt.Grid()==VertexGrid);
|
||||
assert(Umu.Grid()==EdgeGrid);
|
||||
assert(VertexGrid->isIcosahedralVertex());
|
||||
assert(EdgeGrid->isIcosahedralEdge());
|
||||
|
||||
GridBase * vgrid = VertexGrid;
|
||||
GridBase * grid = EdgeGrid;
|
||||
@@ -208,13 +351,13 @@ public:
|
||||
uint64_t dp_idx;
|
||||
if ( isPoleX ) {
|
||||
assert(vgrid->ownsSouthPole());
|
||||
xp_idx = pole_osite + grid->SouthPoleOsite();
|
||||
xp_idx = pole_osite + vgrid->SouthPoleOsite();
|
||||
} else {
|
||||
xp_idx = grid->oIndex(XpCoor);
|
||||
}
|
||||
if ( isPoleY ) {
|
||||
assert(vgrid->ownsNorthPole());
|
||||
yp_idx = pole_osite + grid->NorthPoleOsite();
|
||||
yp_idx = pole_osite + vgrid->NorthPoleOsite();
|
||||
} else {
|
||||
yp_idx = grid->oIndex(YpCoor);
|
||||
}
|
||||
@@ -279,24 +422,24 @@ int main (int argc, char ** argv)
|
||||
std::cout << GridLogMessage << " E = "<<norm2(Umu)<<std::endl;
|
||||
std::cout << GridLogMessage << " Expect "<<latt_size[0]*latt_size[1]*latt_size[2]*10*4<<std::endl;
|
||||
|
||||
// std::cout << " Umu "<<Umu<<std::endl;
|
||||
// std::cout << " Phi "<<Phi<<std::endl;
|
||||
// std::cout << " Umu "<<Umu<<std::endl; // debugged, so comment out to reduce verbose
|
||||
// std::cout << " Phi "<<Phi<<std::endl; // debugged, so comment out to reduce verbose
|
||||
LatticePole(Phi,South);
|
||||
// std::cout << " Phi South Pole set\n"<<Phi<<std::endl;
|
||||
// std::cout << " Phi South Pole set\n"<<Phi<<std::endl; // debugged, so comment out to reduce verbose
|
||||
|
||||
LatticePole(Phi,North);
|
||||
// std::cout << " Phi North Pole set\n"<<Phi<<std::endl;
|
||||
// std::cout << " Phi North Pole set\n"<<Phi<<std::endl; // debugged, so comment out to reduce verbose
|
||||
|
||||
for(int mu=0;mu<VertexGrid._ndimension;mu++){
|
||||
std::cout << " Calling lattice coordinate mu="<<mu<<std::endl;
|
||||
std::cout << GridLogMessage << " Calling lattice coordinate mu="<<mu<<std::endl;
|
||||
LatticeCoordinate(Phi,mu);
|
||||
// std::cout << " Phi coor mu="<<mu<<"\n"<<Phi<<std::endl;
|
||||
// std::cout << GridLogMessage << " Phi coor mu="<<mu<<"\n"<<Phi<<std::endl; // debugged, so comment out to reduce verbose
|
||||
}
|
||||
|
||||
std::cout << "Creating face stencil"<<std::endl;
|
||||
std::cout << GridLogMessage << "Creating face stencil"<<std::endl;
|
||||
IcosahedralEdgeSupport<IcosahedralGimpl> Support(&VertexGrid,&EdgeGrid);
|
||||
|
||||
std::cout << " Calling Test Geometry "<<std::endl;
|
||||
std::cout << GridLogMessage << " Calling Test Geometry "<<std::endl;
|
||||
Support.FaceStencil.TestGeometry();
|
||||
|
||||
|
||||
@@ -304,32 +447,99 @@ int main (int argc, char ** argv)
|
||||
LatticeComplex plaq1(&EdgeGrid);
|
||||
LatticeComplex plaq2(&EdgeGrid);
|
||||
|
||||
LatticeComplex plaq_ref(&EdgeGrid);
|
||||
plaq_ref=1.0;
|
||||
|
||||
Support.ForwardTriangles(Umu,plaq1,plaq2);
|
||||
std::cout << " plaq1 "<< norm2(plaq1)<<std::endl;
|
||||
std::cout << " plaq2 "<< norm2(plaq2)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq1 "<< norm2(plaq1)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq2 "<< norm2(plaq2)<<std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " plaq1 err "<< norm2(plaq1-plaq_ref)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq2 err "<< norm2(plaq2-plaq_ref)<<std::endl;
|
||||
|
||||
// Random gauge xform
|
||||
std::vector<int> seeds({1,2,3,4});
|
||||
GridParallelRNG vRNG(&EdgeGrid); vRNG.SeedFixedIntegers(seeds);
|
||||
LatticeIcosahedralColourMatrix g(&VertexGrid);
|
||||
|
||||
// SU<Nc>::LieRandomize(vRNG,g);
|
||||
|
||||
LatticeIcosahedralColourMatrix g(&VertexGrid);
|
||||
LatticeReal gr(&VertexGrid);
|
||||
LatticeComplex gc(&VertexGrid);
|
||||
gr = 1.0;
|
||||
gaussian(vRNG,gr);
|
||||
Complex ci(0.0,1.0);
|
||||
gc = toComplex(gr);
|
||||
g=one;
|
||||
g = g * exp(ci*gc);
|
||||
|
||||
std::cout << "applying gauge transform"<<std::endl;
|
||||
std::cout << GridLogMessage << "****************************************"<<std::endl;
|
||||
std::cout << GridLogMessage << " Check plaquette is gauge invariant "<<std::endl;
|
||||
std::cout << GridLogMessage << "****************************************"<<std::endl;
|
||||
std::cout << GridLogMessage << " applying gauge transform"<<std::endl;
|
||||
Support.GaugeTransform(g,Umu);
|
||||
std::cout << "applied gauge transform "<<Umu<<std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " applied gauge transform "<<std::endl;
|
||||
// std::cout << "Umu\n"<< Umu << std::endl;
|
||||
std::cout << GridLogMessage << " recalculating plaquette "<<std::endl;
|
||||
Support.ForwardTriangles(Umu,plaq1,plaq2);
|
||||
std::cout << " plaq1 "<< norm2(plaq1)<<std::endl;
|
||||
std::cout << " plaq2 "<< norm2(plaq2)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq1 "<< norm2(plaq1)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq2 "<< norm2(plaq2)<<std::endl;
|
||||
|
||||
// std::cout << " plaq1 "<< plaq1<<std::endl;
|
||||
// std::cout << " plaq2 "<< plaq2<<std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " plaq1 err "<< norm2(plaq1-plaq_ref)<<std::endl;
|
||||
std::cout << GridLogMessage << " plaq2 err "<< norm2(plaq2-plaq_ref)<<std::endl;
|
||||
|
||||
|
||||
typedef IcosahedralGimpl::GaugeLinkField GaugeLinkField;
|
||||
typedef IcosahedralGimpl::GaugeField GaugeField;
|
||||
|
||||
GaugeLinkField stapleXY(&EdgeGrid);
|
||||
GaugeLinkField stapleYX(&EdgeGrid);
|
||||
GaugeLinkField stapleXD(&EdgeGrid);
|
||||
GaugeLinkField stapleDX(&EdgeGrid);
|
||||
GaugeLinkField stapleYD(&EdgeGrid);
|
||||
GaugeLinkField stapleDY(&EdgeGrid);
|
||||
|
||||
GaugeLinkField linkX(&EdgeGrid);
|
||||
GaugeLinkField linkY(&EdgeGrid);
|
||||
GaugeLinkField linkD(&EdgeGrid);
|
||||
std::cout << GridLogMessage << "****************************************"<<std::endl;
|
||||
std::cout << GridLogMessage << " Check triangular staples match plaquette "<<std::endl;
|
||||
std::cout << GridLogMessage << "****************************************"<<std::endl;
|
||||
|
||||
Support.IcosahedralStaples(Umu,stapleXY,stapleYX,
|
||||
stapleXD,stapleDX,
|
||||
stapleYD,stapleDY);
|
||||
|
||||
linkX = peekLorentz(Umu,IcosahedronPatchX);
|
||||
linkY = peekLorentz(Umu,IcosahedronPatchY);
|
||||
linkD = peekLorentz(Umu,IcosahedronPatchDiagonal);
|
||||
|
||||
// OK
|
||||
std::cout << GridLogMessage << " trace D*StapleXY "<<norm2(trace(linkD * stapleXY))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkD * stapleXY)-plaq_ref)<<std::endl;
|
||||
|
||||
// BAD
|
||||
std::cout << GridLogMessage << " trace D*StapleYX "<<norm2(trace(linkD * stapleYX))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkD * stapleYX)-plaq_ref)<<std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " trace X*StapleYD "<<norm2(trace(linkX * stapleYD))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkX * stapleYD)-plaq_ref)<<std::endl;
|
||||
std::cout << GridLogMessage << " trace X*StapleDY "<<norm2(trace(linkX * stapleDY))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkX * stapleDY)-plaq_ref)<<std::endl;
|
||||
|
||||
std::cout << GridLogMessage << " trace Y*StapleXD "<<norm2(trace(linkY * stapleXD))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkY * stapleXD)-plaq_ref)<<std::endl;
|
||||
std::cout << GridLogMessage << " trace Y*StapleDX "<<norm2(trace(linkY * stapleDX))<<std::endl;
|
||||
std::cout << GridLogMessage << " err " << norm2(trace(linkY * stapleDX)-plaq_ref)<<std::endl;
|
||||
|
||||
// std::cout << " D " << linkD<<std::endl;
|
||||
// std::cout << " X " << linkX<<std::endl;
|
||||
// std::cout << " Y " << linkY<<std::endl;
|
||||
// std::cout << " DXY\n " << closure(linkD * stapleYX) <<std::endl;
|
||||
// std::cout << " YXD\n " << closure(linkY * stapleXD) <<std::endl;
|
||||
|
||||
|
||||
|
||||
Grid_finalize();
|
||||
|
Reference in New Issue
Block a user