mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-12 15:10:46 +01:00
Merge pull request #24 from ThomasWurm/feature/gpt
Put GlobalSum outside the slice loop in sliceSum
This commit is contained in:
commit
49ecbc81d4
@ -361,6 +361,7 @@ template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<
|
|||||||
// But easily avoided by using double precision fields
|
// But easily avoided by using double precision fields
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
typedef typename vobj::scalar_object sobj;
|
typedef typename vobj::scalar_object sobj;
|
||||||
|
typedef typename vobj::scalar_object::scalar_type scalar_type;
|
||||||
GridBase *grid = Data.Grid();
|
GridBase *grid = Data.Grid();
|
||||||
assert(grid!=NULL);
|
assert(grid!=NULL);
|
||||||
|
|
||||||
@ -419,20 +420,19 @@ template<class vobj> inline void sliceSum(const Lattice<vobj> &Data,std::vector<
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sum over nodes.
|
// sum over nodes.
|
||||||
sobj gsum;
|
|
||||||
for(int t=0;t<fd;t++){
|
for(int t=0;t<fd;t++){
|
||||||
int pt = t/ld; // processor plane
|
int pt = t/ld; // processor plane
|
||||||
int lt = t%ld;
|
int lt = t%ld;
|
||||||
if ( pt == grid->_processor_coor[orthogdim] ) {
|
if ( pt == grid->_processor_coor[orthogdim] ) {
|
||||||
gsum=lsSum[lt];
|
result[t]=lsSum[lt];
|
||||||
} else {
|
} else {
|
||||||
gsum=Zero();
|
result[t]=Zero();
|
||||||
}
|
}
|
||||||
|
|
||||||
grid->GlobalSum(gsum);
|
|
||||||
|
|
||||||
result[t]=gsum;
|
|
||||||
}
|
}
|
||||||
|
scalar_type * ptr = (scalar_type *) &result[0];
|
||||||
|
int words = fd*sizeof(sobj)/sizeof(scalar_type);
|
||||||
|
grid->GlobalSumVector(ptr, words);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class vobj>
|
template<class vobj>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user