mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-14 01:35:36 +00:00
Splitting communicators first cut
This commit is contained in:
parent
1d7aa673a4
commit
6ebf9f15b7
@ -40,7 +40,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -58,7 +58,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -93,7 +93,7 @@ int main (int argc, char ** argv)
|
|||||||
std::cout << latt_size.back() << "\t\t";
|
std::cout << latt_size.back() << "\t\t";
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
|
LatticeGaugeField Umu(&Grid); random(pRNG,Umu);
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
template<class object> friend class Lattice;
|
template<class object> friend class Lattice;
|
||||||
|
|
||||||
GridBase(const std::vector<int> & processor_grid) : CartesianCommunicator(processor_grid) {};
|
GridBase(const std::vector<int> & processor_grid) : CartesianCommunicator(processor_grid) {};
|
||||||
|
GridBase(const std::vector<int> & processor_grid,
|
||||||
|
const CartesianCommunicator &parent) : CartesianCommunicator(processor_grid,parent) {};
|
||||||
|
|
||||||
// Physics Grid information.
|
// Physics Grid information.
|
||||||
std::vector<int> _simd_layout;// Which dimensions get relayed out over simd lanes.
|
std::vector<int> _simd_layout;// Which dimensions get relayed out over simd lanes.
|
||||||
|
@ -61,10 +61,29 @@ public:
|
|||||||
virtual int CheckerBoardShift(int source_cb,int dim,int shift, int osite){
|
virtual int CheckerBoardShift(int source_cb,int dim,int shift, int osite){
|
||||||
return shift;
|
return shift;
|
||||||
}
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// Constructor takes a parent grid and possibly subdivides communicator.
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
GridCartesian(const std::vector<int> &dimensions,
|
GridCartesian(const std::vector<int> &dimensions,
|
||||||
const std::vector<int> &simd_layout,
|
const std::vector<int> &simd_layout,
|
||||||
const std::vector<int> &processor_grid
|
const std::vector<int> &processor_grid,
|
||||||
) : GridBase(processor_grid)
|
GridCartesian &parent) : GridBase(processor_grid,parent)
|
||||||
|
{
|
||||||
|
Init(dimensions,simd_layout,processor_grid);
|
||||||
|
}
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// Construct from comm world
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
GridCartesian(const std::vector<int> &dimensions,
|
||||||
|
const std::vector<int> &simd_layout,
|
||||||
|
const std::vector<int> &processor_grid) : GridBase(processor_grid)
|
||||||
|
{
|
||||||
|
Init(dimensions,simd_layout,processor_grid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init(const std::vector<int> &dimensions,
|
||||||
|
const std::vector<int> &simd_layout,
|
||||||
|
const std::vector<int> &processor_grid)
|
||||||
{
|
{
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Grid information
|
// Grid information
|
||||||
|
@ -112,24 +112,57 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GridRedBlackCartesian(const GridBase *base) : GridRedBlackCartesian(base->_fdimensions,base->_simd_layout,base->_processors) {};
|
////////////////////////////////////////////////////////////
|
||||||
|
// Create Redblack from original grid; require full grid pointer ?
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
GridRedBlackCartesian(const GridBase *base) : GridBase(base->_processors,*base)
|
||||||
|
{
|
||||||
|
int dims = base->_ndimension;
|
||||||
|
std::vector<int> checker_dim_mask(dims,1);
|
||||||
|
int checker_dim = 0;
|
||||||
|
Init(base->_fdimensions,base->_simd_layout,base->_processors,checker_dim_mask,checker_dim);
|
||||||
|
};
|
||||||
|
|
||||||
GridRedBlackCartesian(const std::vector<int> &dimensions,
|
////////////////////////////////////////////////////////////
|
||||||
|
// Create redblack from original grid, with non-trivial checker dim mask
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
GridRedBlackCartesian(const GridBase *base,
|
||||||
|
const std::vector<int> &checker_dim_mask,
|
||||||
|
int checker_dim
|
||||||
|
) : GridBase(base->_processors,*base)
|
||||||
|
{
|
||||||
|
Init(base->_fdimensions,base->_simd_layout,base->_processors,checker_dim_mask,checker_dim) ;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Create redblack grid ;; deprecate these. Should not
|
||||||
|
// need direct creation of redblack without a full grid to base on
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
GridRedBlackCartesian(const GridBase *base,
|
||||||
|
const std::vector<int> &dimensions,
|
||||||
const std::vector<int> &simd_layout,
|
const std::vector<int> &simd_layout,
|
||||||
const std::vector<int> &processor_grid,
|
const std::vector<int> &processor_grid,
|
||||||
const std::vector<int> &checker_dim_mask,
|
const std::vector<int> &checker_dim_mask,
|
||||||
int checker_dim
|
int checker_dim
|
||||||
) : GridBase(processor_grid)
|
) : GridBase(processor_grid,*base)
|
||||||
{
|
{
|
||||||
Init(dimensions,simd_layout,processor_grid,checker_dim_mask,checker_dim);
|
Init(dimensions,simd_layout,processor_grid,checker_dim_mask,checker_dim);
|
||||||
}
|
}
|
||||||
GridRedBlackCartesian(const std::vector<int> &dimensions,
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
// Create redblack grid
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
GridRedBlackCartesian(const GridBase *base,
|
||||||
|
const std::vector<int> &dimensions,
|
||||||
const std::vector<int> &simd_layout,
|
const std::vector<int> &simd_layout,
|
||||||
const std::vector<int> &processor_grid) : GridBase(processor_grid)
|
const std::vector<int> &processor_grid) : GridBase(processor_grid,*base)
|
||||||
{
|
{
|
||||||
std::vector<int> checker_dim_mask(dimensions.size(),1);
|
std::vector<int> checker_dim_mask(dimensions.size(),1);
|
||||||
Init(dimensions,simd_layout,processor_grid,checker_dim_mask,0);
|
int checker_dim = 0;
|
||||||
|
Init(dimensions,simd_layout,processor_grid,checker_dim_mask,checker_dim);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void Init(const std::vector<int> &dimensions,
|
void Init(const std::vector<int> &dimensions,
|
||||||
const std::vector<int> &simd_layout,
|
const std::vector<int> &simd_layout,
|
||||||
const std::vector<int> &processor_grid,
|
const std::vector<int> &processor_grid,
|
||||||
|
@ -60,7 +60,7 @@ void CartesianCommunicator::ShmBufferFreeAll(void) {
|
|||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Grid information queries
|
// Grid information queries
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
int CartesianCommunicator::Dimensions(void) { return _ndimension; };
|
int CartesianCommunicator::Dimensions(void) { return _ndimension; };
|
||||||
int CartesianCommunicator::IsBoss(void) { return _processor==0; };
|
int CartesianCommunicator::IsBoss(void) { return _processor==0; };
|
||||||
int CartesianCommunicator::BossRank(void) { return 0; };
|
int CartesianCommunicator::BossRank(void) { return 0; };
|
||||||
int CartesianCommunicator::ThisRank(void) { return _processor; };
|
int CartesianCommunicator::ThisRank(void) { return _processor; };
|
||||||
|
@ -68,6 +68,7 @@ class CartesianCommunicator {
|
|||||||
static MPI_Comm communicator_world;
|
static MPI_Comm communicator_world;
|
||||||
MPI_Comm communicator;
|
MPI_Comm communicator;
|
||||||
typedef MPI_Request CommsRequest_t;
|
typedef MPI_Request CommsRequest_t;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
typedef int CommsRequest_t;
|
typedef int CommsRequest_t;
|
||||||
#endif
|
#endif
|
||||||
@ -137,10 +138,23 @@ class CartesianCommunicator {
|
|||||||
static void Init(int *argc, char ***argv);
|
static void Init(int *argc, char ***argv);
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// Constructor of any given grid
|
// Constructors to sub-divide a parent communicator
|
||||||
|
// and default to comm world
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
CartesianCommunicator(const std::vector<int> &processors,const CartesianCommunicator &parent);
|
||||||
CartesianCommunicator(const std::vector<int> &pdimensions_in);
|
CartesianCommunicator(const std::vector<int> &pdimensions_in);
|
||||||
|
|
||||||
|
private:
|
||||||
|
#if defined (GRID_COMMS_MPI)
|
||||||
|
//|| defined (GRID_COMMS_MPI3)
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
// Private initialise from an MPI communicator
|
||||||
|
// Can use after an MPI_Comm_split, but hidden from user so private
|
||||||
|
////////////////////////////////////////////////
|
||||||
|
void InitFromMPICommunicator(const std::vector<int> &processors, MPI_Comm communicator_base);
|
||||||
|
#endif
|
||||||
|
public:
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Wraps MPI_Cart routines, or implements equivalent on other impls
|
// Wraps MPI_Cart routines, or implements equivalent on other impls
|
||||||
////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -54,22 +54,78 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
||||||
|
{
|
||||||
|
InitFromMPICommunicator(processors,communicator_world);
|
||||||
|
std::cout << "Passed communicator world to a new communicator" <<std::endl;
|
||||||
|
}
|
||||||
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,const CartesianCommunicator &parent)
|
||||||
{
|
{
|
||||||
_ndimension = processors.size();
|
_ndimension = processors.size();
|
||||||
std::vector<int> periodic(_ndimension,1);
|
assert(_ndimension = parent._ndimension);
|
||||||
|
|
||||||
_Nprocessors=1;
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
_processors = processors;
|
// split the communicator
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
std::vector<int> ratio(_ndimension);
|
||||||
|
std::vector<int> rcoor(_ndimension);
|
||||||
|
std::vector<int> scoor(_ndimension);
|
||||||
|
|
||||||
|
int Nsubcomm=1;
|
||||||
|
int Nsubrank=1;
|
||||||
|
for(int d=0;d<_ndimension;d++) {
|
||||||
|
ratio[d] = parent._processors[d] / processors[d];
|
||||||
|
rcoor[d] = parent._processor_coor[d] / processors[d];
|
||||||
|
scoor[d] = parent._processor_coor[d] % processors[d];
|
||||||
|
assert(ratio[d] * processors[d] == parent._processors[d]); // must exactly subdivide
|
||||||
|
Nsubcomm *= ratio[d];
|
||||||
|
Nsubrank *= processors[d];
|
||||||
|
}
|
||||||
|
|
||||||
|
int rlex, slex;
|
||||||
|
Lexicographic::IndexFromCoor(rcoor,rlex,ratio);
|
||||||
|
Lexicographic::IndexFromCoor(scoor,slex,processors);
|
||||||
|
|
||||||
|
MPI_Comm comm_split;
|
||||||
|
int ierr= MPI_Comm_split(communicator_world, rlex, slex,&comm_split);
|
||||||
|
assert(ierr==0);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Set up from the new split communicator
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
InitFromMPICommunicator(processors,comm_split);
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Declare victory
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
std::cout << "Divided communicator "<< parent._Nprocessors<<" into "
|
||||||
|
<<Nsubcomm <<" communicators with " << Nsubrank << " ranks"<<std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Take an MPI_Comm and self assemble
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
void CartesianCommunicator::InitFromMPICommunicator(const std::vector<int> &processors, MPI_Comm communicator_base)
|
||||||
|
{
|
||||||
|
if ( communicator_base != communicator_world ) {
|
||||||
|
std::cout << "Cartesian communicator created with a non-world communicator"<<std::endl;
|
||||||
|
}
|
||||||
|
_ndimension = processors.size();
|
||||||
_processor_coor.resize(_ndimension);
|
_processor_coor.resize(_ndimension);
|
||||||
|
|
||||||
MPI_Cart_create(communicator_world, _ndimension,&_processors[0],&periodic[0],1,&communicator);
|
/////////////////////////////////
|
||||||
MPI_Comm_rank(communicator,&_processor);
|
// Count the requested nodes
|
||||||
MPI_Cart_coords(communicator,_processor,_ndimension,&_processor_coor[0]);
|
/////////////////////////////////
|
||||||
|
_Nprocessors=1;
|
||||||
|
_processors = processors;
|
||||||
for(int i=0;i<_ndimension;i++){
|
for(int i=0;i<_ndimension;i++){
|
||||||
_Nprocessors*=_processors[i];
|
_Nprocessors*=_processors[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<int> periodic(_ndimension,1);
|
||||||
|
MPI_Cart_create(communicator_base, _ndimension,&_processors[0],&periodic[0],1,&communicator);
|
||||||
|
MPI_Comm_rank(communicator,&_processor);
|
||||||
|
MPI_Cart_coords(communicator,_processor,_ndimension,&_processor_coor[0]);
|
||||||
|
|
||||||
int Size;
|
int Size;
|
||||||
MPI_Comm_size(communicator,&Size);
|
MPI_Comm_size(communicator,&Size);
|
||||||
|
|
||||||
|
@ -371,6 +371,15 @@ void CartesianCommunicator::ProcessorCoorFromRank(int rank, std::vector<int> &c
|
|||||||
assert(lr!=-1);
|
assert(lr!=-1);
|
||||||
Lexicographic::CoorFromIndex(coor,lr,_processors);
|
Lexicographic::CoorFromIndex(coor,lr,_processors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////
|
||||||
|
// Try to subdivide communicator
|
||||||
|
//////////////////////////////////
|
||||||
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,CartesianCommunicator &parent)
|
||||||
|
: CartesianCommunicator(processors)
|
||||||
|
{
|
||||||
|
std::cout << "Attempts to split MPI3 communicators will fail until implemented" <<std::endl;
|
||||||
|
}
|
||||||
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
||||||
{
|
{
|
||||||
int ierr;
|
int ierr;
|
||||||
|
@ -38,6 +38,9 @@ void CartesianCommunicator::Init(int *argc, char *** arv)
|
|||||||
ShmInitGeneric();
|
ShmInitGeneric();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,CartesianCommunicator &parent)
|
||||||
|
: CartesianCommunicator(processors) {}
|
||||||
|
|
||||||
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
||||||
{
|
{
|
||||||
_processors = processors;
|
_processors = processors;
|
||||||
|
@ -75,6 +75,11 @@ void CartesianCommunicator::Init(int *argc, char ***argv) {
|
|||||||
ShmInitGeneric();
|
ShmInitGeneric();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors,CartesianCommunicator &parent)
|
||||||
|
: CartesianCommunicator(processors)
|
||||||
|
{
|
||||||
|
std::cout << "Attempts to split SHMEM communicators will fail " <<std::endl;
|
||||||
|
}
|
||||||
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
CartesianCommunicator::CartesianCommunicator(const std::vector<int> &processors)
|
||||||
{
|
{
|
||||||
_ndimension = processors.size();
|
_ndimension = processors.size();
|
||||||
|
@ -68,18 +68,21 @@ GridRedBlackCartesian *SpaceTimeGrid::makeFiveDimRedBlackGrid(int Ls,const GridC
|
|||||||
{
|
{
|
||||||
int N4=FourDimGrid->_ndimension;
|
int N4=FourDimGrid->_ndimension;
|
||||||
int cbd=1;
|
int cbd=1;
|
||||||
std::vector<int> latt5(1,Ls);
|
// std::vector<int> latt5(1,Ls);
|
||||||
std::vector<int> simd5(1,1);
|
// std::vector<int> simd5(1,1);
|
||||||
std::vector<int> mpi5(1,1);
|
// std::vector<int> mpi5(1,1);
|
||||||
std::vector<int> cb5(1,0);
|
std::vector<int> cb5(1,0);
|
||||||
|
|
||||||
for(int d=0;d<N4;d++){
|
for(int d=0;d<N4;d++){
|
||||||
latt5.push_back(FourDimGrid->_fdimensions[d]);
|
// latt5.push_back(FourDimGrid->_fdimensions[d]);
|
||||||
simd5.push_back(FourDimGrid->_simd_layout[d]);
|
// simd5.push_back(FourDimGrid->_simd_layout[d]);
|
||||||
mpi5.push_back(FourDimGrid->_processors[d]);
|
// mpi5.push_back(FourDimGrid->_processors[d]);
|
||||||
cb5.push_back( 1);
|
cb5.push_back( 1);
|
||||||
}
|
}
|
||||||
return new GridRedBlackCartesian(latt5,simd5,mpi5,cb5,cbd);
|
GridCartesian *tmp = makeFiveDimGrid(Ls,FourDimGrid);
|
||||||
|
GridRedBlackCartesian *ret = new GridRedBlackCartesian(tmp,cb5,cbd);
|
||||||
|
delete tmp;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -99,24 +102,30 @@ GridCartesian *SpaceTimeGrid::makeFiveDimDWFGrid(int Ls,const GridCartes
|
|||||||
}
|
}
|
||||||
return new GridCartesian(latt5,simd5,mpi5);
|
return new GridCartesian(latt5,simd5,mpi5);
|
||||||
}
|
}
|
||||||
|
///////////////////////////////////////////////////
|
||||||
|
// Interface is inefficient and forces the deletion
|
||||||
|
// Pass in the non-redblack grid
|
||||||
|
///////////////////////////////////////////////////
|
||||||
GridRedBlackCartesian *SpaceTimeGrid::makeFiveDimDWFRedBlackGrid(int Ls,const GridCartesian *FourDimGrid)
|
GridRedBlackCartesian *SpaceTimeGrid::makeFiveDimDWFRedBlackGrid(int Ls,const GridCartesian *FourDimGrid)
|
||||||
{
|
{
|
||||||
int N4=FourDimGrid->_ndimension;
|
int N4=FourDimGrid->_ndimension;
|
||||||
int nsimd = FourDimGrid->Nsimd();
|
|
||||||
int cbd=1;
|
int cbd=1;
|
||||||
std::vector<int> latt5(1,Ls);
|
|
||||||
std::vector<int> simd5(1,nsimd);
|
|
||||||
std::vector<int> mpi5(1,1);
|
|
||||||
std::vector<int> cb5(1,0);
|
std::vector<int> cb5(1,0);
|
||||||
|
// int nsimd = FourDimGrid->Nsimd();
|
||||||
|
// std::vector<int> latt5(1,Ls);
|
||||||
|
// std::vector<int> simd5(1,nsimd);
|
||||||
|
// std::vector<int> mpi5(1,1);
|
||||||
|
|
||||||
for(int d=0;d<N4;d++){
|
for(int d=0;d<N4;d++){
|
||||||
latt5.push_back(FourDimGrid->_fdimensions[d]);
|
// latt5.push_back(FourDimGrid->_fdimensions[d]);
|
||||||
simd5.push_back(1);
|
// simd5.push_back(1);
|
||||||
mpi5.push_back(FourDimGrid->_processors[d]);
|
// mpi5.push_back(FourDimGrid->_processors[d]);
|
||||||
cb5.push_back(1);
|
cb5.push_back(1);
|
||||||
}
|
}
|
||||||
return new GridRedBlackCartesian(latt5,simd5,mpi5,cb5,cbd);
|
GridCartesian *tmp = makeFiveDimDWFGrid(Ls,FourDimGrid);
|
||||||
|
GridRedBlackCartesian *ret = new GridRedBlackCartesian(tmp,cb5,cbd);
|
||||||
|
delete tmp;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace Grid{
|
|||||||
class Lexicographic {
|
class Lexicographic {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static inline void CoorFromIndex (std::vector<int>& coor,int index,std::vector<int> &dims){
|
static inline void CoorFromIndex (std::vector<int>& coor,int index,const std::vector<int> &dims){
|
||||||
int nd= dims.size();
|
int nd= dims.size();
|
||||||
coor.resize(nd);
|
coor.resize(nd);
|
||||||
for(int d=0;d<nd;d++){
|
for(int d=0;d<nd;d++){
|
||||||
@ -16,7 +16,7 @@ namespace Grid{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void IndexFromCoor (std::vector<int>& coor,int &index,std::vector<int> &dims){
|
static inline void IndexFromCoor (const std::vector<int>& coor,int &index,const std::vector<int> &dims){
|
||||||
int nd=dims.size();
|
int nd=dims.size();
|
||||||
int stride=1;
|
int stride=1;
|
||||||
index=0;
|
index=0;
|
||||||
|
@ -49,7 +49,7 @@ int main (int argc, char ** argv)
|
|||||||
double volume = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
double volume = latt_size[0]*latt_size[1]*latt_size[2]*latt_size[3];
|
||||||
|
|
||||||
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian rbFine(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian rbFine(&Fine);
|
||||||
GridParallelRNG fRNG(&Fine);
|
GridParallelRNG fRNG(&Fine);
|
||||||
|
|
||||||
// fRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
// fRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9});
|
||||||
|
@ -47,7 +47,7 @@ int main (int argc, char ** argv)
|
|||||||
mask[0]=0;
|
mask[0]=0;
|
||||||
|
|
||||||
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
GridRedBlackCartesian RBFine(&Fine,mask,1);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int main (int argc, char ** argv)
|
|||||||
mask[0]=0;
|
mask[0]=0;
|
||||||
|
|
||||||
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
GridCartesian Fine (latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBFine(latt_size,simd_layout,mpi_layout,mask,1);
|
GridRedBlackCartesian RBFine(&Fine,mask,1);
|
||||||
|
|
||||||
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
GridParallelRNG FineRNG(&Fine); FineRNG.SeedFixedIntegers(std::vector<int>({45,12,81,9}));
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ int main (int argc, char ** argv)
|
|||||||
vol = vol * latt_size[d];
|
vol = vol * latt_size[d];
|
||||||
}
|
}
|
||||||
GridCartesian GRID(latt_size,simd_layout,mpi_layout);
|
GridCartesian GRID(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGRID(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGRID(&GRID);
|
||||||
|
|
||||||
LatticeComplexD one(&GRID);
|
LatticeComplexD one(&GRID);
|
||||||
LatticeComplexD zz(&GRID);
|
LatticeComplexD zz(&GRID);
|
||||||
|
@ -40,7 +40,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -84,7 +84,7 @@ int main(int argc, char **argv) {
|
|||||||
double volume = latt_size[0] * latt_size[1] * latt_size[2] * latt_size[3];
|
double volume = latt_size[0] * latt_size[1] * latt_size[2] * latt_size[3];
|
||||||
|
|
||||||
GridCartesian Fine(latt_size, simd_layout, mpi_layout);
|
GridCartesian Fine(latt_size, simd_layout, mpi_layout);
|
||||||
GridRedBlackCartesian rbFine(latt_size, simd_layout, mpi_layout);
|
GridRedBlackCartesian rbFine(&Fine);
|
||||||
GridParallelRNG FineRNG(&Fine);
|
GridParallelRNG FineRNG(&Fine);
|
||||||
GridSerialRNG SerialRNG;
|
GridSerialRNG SerialRNG;
|
||||||
GridSerialRNG SerialRNG1;
|
GridSerialRNG SerialRNG1;
|
||||||
|
@ -40,7 +40,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -51,7 +51,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -42,7 +42,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -42,7 +42,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -42,7 +42,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -42,7 +42,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
|
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
int threads = GridThread::GetThreads();
|
int threads = GridThread::GetThreads();
|
||||||
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
std::cout<<GridLogMessage << "Grid is setup to use "<<threads<<" threads"<<std::endl;
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc, char **argv) {
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd, vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
GridCartesian Grid(latt_size, simd_layout, mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size, simd_layout, mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1, 2, 3, 4, 5});
|
std::vector<int> seeds({1, 2, 3, 4, 5});
|
||||||
GridSerialRNG sRNG;
|
GridSerialRNG sRNG;
|
||||||
|
@ -40,7 +40,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4,5});
|
std::vector<int> seeds({1,2,3,4,5});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
@ -57,7 +57,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
@ -52,7 +52,7 @@ int main (int argc, char ** argv)
|
|||||||
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
std::vector<int> simd_layout = GridDefaultSimd(Nd,vComplex::Nsimd());
|
||||||
std::vector<int> mpi_layout = GridDefaultMpi();
|
std::vector<int> mpi_layout = GridDefaultMpi();
|
||||||
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
GridCartesian Grid(latt_size,simd_layout,mpi_layout);
|
||||||
GridRedBlackCartesian RBGrid(latt_size,simd_layout,mpi_layout);
|
GridRedBlackCartesian RBGrid(&Grid);
|
||||||
|
|
||||||
std::vector<int> seeds({1,2,3,4});
|
std::vector<int> seeds({1,2,3,4});
|
||||||
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
GridParallelRNG pRNG(&Grid); pRNG.SeedFixedIntegers(seeds);
|
||||||
|
Loading…
Reference in New Issue
Block a user