diff --git a/lib/communicator/Communicator_base.cc b/lib/communicator/Communicator_base.cc index ce9a3cf0..82913935 100644 --- a/lib/communicator/Communicator_base.cc +++ b/lib/communicator/Communicator_base.cc @@ -102,7 +102,6 @@ void CartesianCommunicator::GlobalSumVector(ComplexD *c,int N) CartesianCommunicator::CartesianCommunicator(const std::vector &processors,const CartesianCommunicator &parent) { _ndimension = processors.size(); - assert(_ndimension = parent._ndimension); ////////////////////////////////////////////////////////////////////////////////////////////////////// // split the communicator @@ -121,10 +120,22 @@ CartesianCommunicator::CartesianCommunicator(const std::vector &processors, std::vector scoor(_ndimension); // coor of split within parent std::vector ssize(_ndimension); // coor of split within parent + std::vector pcoor(_ndimension,0); + std::vector pdims(_ndimension,1); + + if(parent._processors.size()==4 && _ndimension==5){ + for(int i=0;i<4;i++) pcoor[i+1]=parent._processor_coor[i]; + for(int i=0;i<4;i++) pdims[i+1]=parent._processors[i]; + } else { + assert(_ndimension == parent._ndimension); + for(int i=0;i<_ndimension;i++) pcoor[i]=parent._processor_coor[i]; + for(int i=0;i<_ndimension;i++) pdims[i]=parent._processors[i]; + } + for(int d=0;d<_ndimension;d++){ - ccoor[d] = parent._processor_coor[d] % processors[d]; - scoor[d] = parent._processor_coor[d] / processors[d]; - ssize[d] = parent._processors[d]/ processors[d]; + ccoor[d] = pcoor[d] % processors[d]; + scoor[d] = pcoor[d] / processors[d]; + ssize[d] = pdims[d] / processors[d]; } int crank,srank; // rank within subcomm ; rank of subcomm within blocks of subcomms Lexicographic::IndexFromCoor(ccoor,crank,processors); diff --git a/lib/qcd/utils/SpaceTimeGrid.cc b/lib/qcd/utils/SpaceTimeGrid.cc index b2b5d9c8..bdc4262b 100644 --- a/lib/qcd/utils/SpaceTimeGrid.cc +++ b/lib/qcd/utils/SpaceTimeGrid.cc @@ -50,6 +50,7 @@ GridCartesian *SpaceTimeGrid::makeFourDimDWFGrid(const std::vector & latt,c GridCartesian *SpaceTimeGrid::makeFiveDimGrid(int Ls,const GridCartesian *FourDimGrid) { int N4=FourDimGrid->_ndimension; + assert(N4==4); std::vector latt5(1,Ls); std::vector simd5(1,1); diff --git a/lib/util/Lexicographic.h b/lib/util/Lexicographic.h index b922dba5..23c21c1f 100644 --- a/lib/util/Lexicographic.h +++ b/lib/util/Lexicographic.h @@ -18,6 +18,10 @@ namespace Grid{ static inline void IndexFromCoor (const std::vector& coor,int &index,const std::vector &dims){ int nd=dims.size(); + if(nd > coor.size()) { + std::cout<< "coor.size "<dims.size "<