mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-27 22:25:56 +01:00
Only need to bad non-local dimensions
This commit is contained in:
parent
dd557af84b
commit
7b41b92d99
@ -86,7 +86,9 @@ public:
|
|||||||
// expand up one dim at a time
|
// expand up one dim at a time
|
||||||
for(int d=0;d<dims;d++){
|
for(int d=0;d<dims;d++){
|
||||||
|
|
||||||
|
if ( processors[d] > 1 ) {
|
||||||
plocal[d] += 2*depth;
|
plocal[d] += 2*depth;
|
||||||
|
}
|
||||||
|
|
||||||
for(int d=0;d<dims;d++){
|
for(int d=0;d<dims;d++){
|
||||||
global[d] = plocal[d]*processors[d];
|
global[d] = plocal[d]*processors[d];
|
||||||
@ -98,11 +100,17 @@ public:
|
|||||||
template<class vobj>
|
template<class vobj>
|
||||||
inline Lattice<vobj> Extract(const Lattice<vobj> &in) const
|
inline Lattice<vobj> Extract(const Lattice<vobj> &in) const
|
||||||
{
|
{
|
||||||
|
Coordinate processors=unpadded_grid->_processors;
|
||||||
|
|
||||||
Lattice<vobj> out(unpadded_grid);
|
Lattice<vobj> out(unpadded_grid);
|
||||||
|
|
||||||
Coordinate local =unpadded_grid->LocalDimensions();
|
Coordinate local =unpadded_grid->LocalDimensions();
|
||||||
Coordinate fll(dims,depth); // depends on the MPI spread
|
// depends on the MPI spread
|
||||||
|
Coordinate fll(dims,depth);
|
||||||
Coordinate tll(dims,0); // depends on the MPI spread
|
Coordinate tll(dims,0); // depends on the MPI spread
|
||||||
|
for(int d=0;d<dims;d++){
|
||||||
|
if( processors[d]==1 ) fll[d]=0;
|
||||||
|
}
|
||||||
localCopyRegion(in,out,fll,tll,local);
|
localCopyRegion(in,out,fll,tll,local);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -121,6 +129,7 @@ public:
|
|||||||
template<class vobj>
|
template<class vobj>
|
||||||
inline Lattice<vobj> Expand(int dim, const Lattice<vobj> &in, const CshiftImplBase<vobj> &cshift = CshiftImplDefault<vobj>()) const
|
inline Lattice<vobj> Expand(int dim, const Lattice<vobj> &in, const CshiftImplBase<vobj> &cshift = CshiftImplDefault<vobj>()) const
|
||||||
{
|
{
|
||||||
|
Coordinate processors=unpadded_grid->_processors;
|
||||||
GridBase *old_grid = in.Grid();
|
GridBase *old_grid = in.Grid();
|
||||||
GridCartesian *new_grid = grids[dim];//These are new grids
|
GridCartesian *new_grid = grids[dim];//These are new grids
|
||||||
Lattice<vobj> padded(new_grid);
|
Lattice<vobj> padded(new_grid);
|
||||||
@ -134,6 +143,18 @@ public:
|
|||||||
|
|
||||||
double tins=0, tshift=0;
|
double tins=0, tshift=0;
|
||||||
|
|
||||||
|
int islocal = 0 ;
|
||||||
|
if ( processors[dim] == 1 ) islocal = 1;
|
||||||
|
|
||||||
|
if ( islocal ) {
|
||||||
|
|
||||||
|
double t = usecond();
|
||||||
|
for(int x=0;x<local[dim];x++){
|
||||||
|
InsertSliceLocal(in,padded,x,x,dim);
|
||||||
|
}
|
||||||
|
tins += usecond() - t;
|
||||||
|
|
||||||
|
} else {
|
||||||
// Middle bit
|
// Middle bit
|
||||||
double t = usecond();
|
double t = usecond();
|
||||||
for(int x=0;x<local[dim];x++){
|
for(int x=0;x<local[dim];x++){
|
||||||
@ -162,7 +183,7 @@ public:
|
|||||||
InsertSliceLocal(shifted,padded,x,x,dim);
|
InsertSliceLocal(shifted,padded,x,x,dim);
|
||||||
}
|
}
|
||||||
tins += usecond() - t;
|
tins += usecond() - t;
|
||||||
|
}
|
||||||
std::cout << GridLogPerformance << "PaddedCell::Expand timings: cshift:" << tshift/1000 << "ms, insert-slice:" << tins/1000 << "ms" << std::endl;
|
std::cout << GridLogPerformance << "PaddedCell::Expand timings: cshift:" << tshift/1000 << "ms, insert-slice:" << tins/1000 << "ms" << std::endl;
|
||||||
|
|
||||||
return padded;
|
return padded;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user