diff --git a/tests/Test_stencil.cc b/tests/Test_stencil.cc index 1b71b8a5..c2a2580f 100644 --- a/tests/Test_stencil.cc +++ b/tests/Test_stencil.cc @@ -66,7 +66,7 @@ int main (int argc, char ** argv) random(fRNG,Foo); gaussian(fRNG,Bar); - /* + Integer stride =1000; { double nrm; @@ -79,7 +79,6 @@ int main (int argc, char ** argv) } Foo=lex; } - */ typedef CartesianStencil Stencil; for(int dir=0;dir<4;dir++){ @@ -92,7 +91,6 @@ int main (int argc, char ** argv) std::vector displacements(npoint,disp); Stencil myStencil(&Fine,npoint,0,directions,displacements); - std::vector ocoor(4); for(int o=0;o 1.0e-4) exit(-1); } } @@ -182,8 +180,6 @@ int main (int argc, char ** argv) SimpleCompressor compress; - EStencil.HaloExchange(EFoo,compress); - OStencil.HaloExchange(OFoo,compress); Bar = Cshift(Foo,dir,disp); @@ -196,6 +192,7 @@ int main (int argc, char ** argv) } // Implement a stencil code that should agree with that darn cshift! + EStencil.HaloExchange(EFoo,compress); for(int i=0;ioSites();i++){ int permute_type; StencilEntry *SE; @@ -209,6 +206,7 @@ int main (int argc, char ** argv) else OCheck._odata[i] = EStencil.CommBuf()[SE->_offset]; } + OStencil.HaloExchange(OFoo,compress); for(int i=0;ioSites();i++){ int permute_type; StencilEntry *SE; @@ -254,6 +252,7 @@ int main (int argc, char ** argv) }}}} + if (nrm > 1.0e-4) exit(-1); } } diff --git a/tests/core/Test_cshift_red_black.cc b/tests/core/Test_cshift_red_black.cc index 43f12e77..ae55cece 100644 --- a/tests/core/Test_cshift_red_black.cc +++ b/tests/core/Test_cshift_red_black.cc @@ -32,6 +32,8 @@ Author: paboyle using namespace Grid; using namespace Grid::QCD; +#define POWER10 + int main (int argc, char ** argv) { Grid_init(&argc,&argv); @@ -52,6 +54,7 @@ int main (int argc, char ** argv) LatticeComplex U(&Fine); LatticeComplex ShiftU(&Fine); LatticeComplex rbShiftU(&Fine); + LatticeComplex err(&Fine); LatticeComplex Ue(&RBFine); LatticeComplex Uo(&RBFine); LatticeComplex ShiftUe(&RBFine); @@ -68,7 +71,11 @@ int main (int argc, char ** argv) Integer i=0; LatticeCoordinate(coor,d); lex = lex + coor*stride+i; +#ifndef POWER10 stride=stride*latt_size[d]; +#else + stride=stride*10; +#endif } U=lex; } @@ -87,28 +94,31 @@ int main (int argc, char ** argv) // if ( dir!=1 ) continue; for(int shift=0;shift coor(4); - std::cout< scoor(coor); scoor[dir] = (scoor[dir]+shift)%latt_size[dir]; +#ifndef POWER10 + std::vector powers=latt_size; Integer slex = scoor[0] + latt_size[0]*scoor[1] + latt_size[0]*latt_size[1]*scoor[2] + latt_size[0]*latt_size[1]*latt_size[2]*scoor[3]; - +#else + std::vector powers({1,10,100,1000}); + Integer slex = scoor[0] + + 10 *scoor[1] + + 100 *scoor[2] + + 1000 *scoor[3]; +#endif Complex scm(slex); double nrm = abs(scm-cm()()()); std::vector peer(4); Complex ctmp = cm; Integer index=real(ctmp); - Lexicographic::CoorFromIndex(peer,index,latt_size); + Lexicographic::CoorFromIndex(peer,index,powers); if (nrm > 0){ std::cout<<"FAIL shift "<< shift<<" in dir "<< dir @@ -145,9 +163,10 @@ int main (int argc, char ** argv) exit(-1); } }}}} + std::cout << " OK !"< scoor(coor); scoor[dir] = (scoor[dir]+shift)%latt_size[dir]; +#ifndef POWER10 + std::vector powers=latt_size; Integer slex = scoor[0] + latt_size[0]*scoor[1] + latt_size[0]*latt_size[1]*scoor[2] + latt_size[0]*latt_size[1]*latt_size[2]*scoor[3]; - +#else + std::vector powers({1,10,100,1000}); + Integer slex = scoor[0] + + 10 *scoor[1] + + 100 *scoor[2] + + 1000 *scoor[3]; +#endif Complex scm(slex); std::vector peer(4); Complex ctmp=cmeo; Integer index=real(ctmp); - Lexicographic::CoorFromIndex(peer,index,latt_size); + Lexicographic::CoorFromIndex(peer,index,powers); double nrm = abs(cmeo()()()-scm); if (nrm != 0) { + + std::cout << " coor "<<" ["< using namespace Grid; using namespace Grid::QCD; +#define POWER10 + int main (int argc, char ** argv) { Grid_init(&argc,&argv); @@ -49,6 +51,7 @@ int main (int argc, char ** argv) GridParallelRNG FineRNG(&Fine); FineRNG.SeedRandomDevice(); + LatticeComplex err(&Fine); LatticeComplex U(&Fine); LatticeComplex ShiftU(&Fine); LatticeComplex rbShiftU(&Fine); @@ -66,9 +69,15 @@ int main (int argc, char ** argv) for(int d=0;d coor(4); - std::cout< scoor(coor); scoor[dir] = (scoor[dir]+shift)%latt_size[dir]; - + +#ifdef POWER10 + std::vector powers({1,10,100,1000}); + Integer slex = scoor[3] + + 10 *scoor[2] + + 100 *scoor[1] + + 1000 *scoor[0]; +#else + std::vector powers=latt_size; Integer slex = scoor[0] + latt_size[0]*scoor[1] + latt_size[0]*latt_size[1]*scoor[2] + latt_size[0]*latt_size[1]*latt_size[2]*scoor[3]; +#endif Complex scm(slex); @@ -132,7 +152,7 @@ int main (int argc, char ** argv) std::vector peer(4); Complex ctmp = cm; Integer index=real(ctmp); - Lexicographic::CoorFromIndex(peer,index,latt_size); + Lexicographic::CoorFromIndex(peer,index,powers); if (nrm > 0){ std::cout<<"FAIL shift "<< shift<<" in dir "<< dir @@ -140,14 +160,16 @@ int main (int argc, char ** argv) << cm()()()<<" expect "< scoor(coor); scoor[dir] = (scoor[dir]+shift)%latt_size[dir]; - + +#ifdef POWER10 + std::vector powers({1,10,100,1000}); + Integer slex = scoor[3] + + 10 *scoor[2] + + 100 *scoor[1] + + 1000 *scoor[0]; +#else + std::vector powers = latt_size; Integer slex = scoor[0] + latt_size[0]*scoor[1] + latt_size[0]*latt_size[1]*scoor[2] + latt_size[0]*latt_size[1]*latt_size[2]*scoor[3]; - +#endif Complex scm(slex); std::vector peer(4); Complex ctmp=cmeo; Integer index=real(ctmp); - Lexicographic::CoorFromIndex(peer,index,latt_size); + Lexicographic::CoorFromIndex(peer,index,powers); double nrm = abs(cmeo()()()-scm); if (nrm != 0) { @@ -189,10 +219,9 @@ int main (int argc, char ** argv) << cmeo()()()<<" expect "<